I\'m trying to encode a video with ffmpeg into H.264 (via the libx264 library) with a constant bit rate. I know, I know, VBR is often preferred, but for this specific job I\'m
This may be a clue (assuming you have a bitrate set) "CBR is when maxrate == bitrate and bufsize is set" http://ffmpeg-users.933282.n4.nabble.com/Does-constant-bitrate-exist-in-libx264-td2255554.html
bufsize is supposed to be the "receiving client's" max buffer size.
I too have been working on trying to get CBR out of x264. I found this blog post by Dark Shakari quite interesting.
Here is what I have for low-latency CBR video to an MPEG tranport stream:
ffmpeg -i sintel_trailer-720p.mp4 -an -tune zerolatency \
-x264opts bitrate=4000:vbv-maxrate=4000:vbv-bufsize=166 \
-vcodec libx264 -f mpegts -muxrate 4000K -y trailer.ts
According the x264 developer's blog you set:
Finally, set the ffmpeg switch for x264 of -tune zerolatency.
Hope that's helpful. And, if anyone has improvements to this please do let me know!
Specify -nal-hrd cbr
after -bufsize 400000
.
Ok, so I think I may have found part of the problem. Making -bufsize greater than the data rate seems to have solved the problem. Of course, I don't know if it's encoding real CBR, but the data rate that Quick Time Inspector reads looks right now.