[Live-devel] H.264 in MPEG-2 TS streams roughly at the start
Warren Young
warren at etr-usa.com
Thu Sep 20 04:11:54 PDT 2012
On 9/11/2012 2:54 PM, Mojtaba Nouri wrote:
> We had the same problem, and we solved it by creating cbr ts files
> stuffed with NULL packets.
> The following thread shows the ffmpeg command parameters to create h.264
> cbr files:
> http://stackoverflow.com/questions/7125446/encoding-h-264-cbr-videos-with-ffmpeg
Thanks for the pointer.
The magic parameter is -muxrate. The magic involving -x264opts is
completely unnecessary. You can use ffmpeg's native bit rate
parameters, as I had in my original post.
The mux rate needs to be equal to the video bandwidth plus the audio
bandwidth, plus 5-10% to cover TS overhead and video encoder peaking.
So for 10 Mbit/s video + 128 kbit/s audio, we found it necessary to go
with a 12 Mbit/s mux rate to avoid muxing errors.
(We didn't tune that very carefully, but we increased from 10128 kbit/s
up to about 11.3 Mbit/s before giving up and jumping to 12 Mbit/s.)
The other posts claiming that setting min=avg=max == CBR are bogus.
libx264 is pretty much incapable of true CBR. You have to do
null-stuffing to get a CBR-like result, and even then, you end up with a
fair bit of variability. I have bitrate graphs to prove it. :)
More information about the live-devel
mailing list