title: MPEG-TS Encoding
body: <p>I have a file that i need to convert to MPEG-TS so that it fits the below specification:</p>
  
  <p>Elementary stream bitrate [kbit/s]
  video: 2575
  audio: 2 x 192
  subtitle: -
  PAT/PMT: -
  Stuffing: -</p>
  
  <p>Component TS bitrate [kbit/s]
  video: 2652
  audio: 395
  subtitle: 45
  PAT/PMT: 45
  Stuffing: 62
  Total: 3200 CBR</p>
  
  <p>Additional required components:
  PAT
  PMT
  Null packets</p>
  
  <p>Components that might pop up:
  NIT, SDT, EIT, etc.</p>
  
  <pre><code>vcodec="h264"
  acodec="mpga"
  bitrate="2500"
  arate="192"
  samplerate=48000
  ext="mpg"
  mux="ts"
  vlc="/usr/bin/vlc"
  fmt="mpg"
  dst="/home/adam/test/"
  
  for a in *$fmt; do
  $vlc -I dummy -vvv "/home/adam/test/" --sout "#transcode{vcodec=$vcodec,venc=x264{profile=main,level=3.0,hrd=cbr,bframes=2},vb=$bitrate,acodec=$acodec,ab=$arate,samplerate=$samplerate,channels=2}:standard{mux=$mux,dst=\"$dst$a.$ext\",ac$
  done
  </code></pre>
  
  <p>After encoding with the above script everything seems to be ok (for both video and audio bitrate codec is constant) apart from two things: Bitrate of the container should also remain CBR but this is not the case. Also, stuffing component (0x1 ffff) - null packet is missing. Is it possible for you to correct the script to make null packet as well as bitrate of the container constant (3,2 Mbps CBR) ?</p>
  
  <p>The second option is encoding with ffmpeg:</p>
  
  <pre><code>ffmpeg -i video_input.mpg -i audio_input.mp2 -acodec copy -tune zerolatency -x264opts bitrate=2600:vbv-maxrate=2600:vbv-bufsize=166:nal_hrd=cbr -vpre libx264-iptv -vcodec libx264 -f mpegts -muxrate 3200K -y output.ts
  </code></pre>
  
  <p>but how to unset/disable/remove SDT table?</p>