[FFmpeg-user] 2 pass CBR or VBR not really fixing the bitrate?

Jonathan Baecker jonbae77 at gmail.com
Mon Jul 31 21:30:04 EEST 2017

Am 31.07.2017 um 03:52 schrieb Manuel Tiglio:
> Hi there,
> I apologize for my delay in replying, I found that the mailing list messages were being sent to my junk folder :-(
>> On Jul 29, 2017, at 1:51 PM, Moritz Barsnick <barsnick at gmx.net> wrote:
>> On Sat, Jul 29, 2017 at 13:16:07 -0700, Manuel Tiglio wrote:
>>> ffmpeg -I <input> -c:v libx264 -pass 1 -f mp4 /dev/null
>>> ffmpeg -I <input> -c:v libx264 -b:v avg -maxrate max -minrate min -bufsize buf -pass 2 <output>
>> Have you tried using the identical video encoding settings for pass 1
>> and pass 2? I seem to recall that that is important.
> Yes, I have tried. All kind of combinations. Interestingly enough, different options do make a difference, in the sense that the results are slightly different,  but still no luck in trying to control the bitrate.
>>> Can anyone post an example of a case in which ffmpeg really gets CBR or say 110% VBR?
>> I can't, but I can point out that ffmpeg mostly does ABR, not CBR.
> Thanks for sharing! But apparently I cannot even do 110% VBR, it seems to somewhat control the bitrate fluctuations but far from what it should do. I would imagine that people have already gone through this, so I am kind of puzzled.
> Thanks again so much.
how about this command?:

ffmpeg -i input.mp4 -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 1M -minrate 1M -maxrate 1M -bufsize 2M

Source: https://trac.ffmpeg.org/wiki/Encode/H.264

Of course it needs a bit modification to fit your two pass encoding. You just worry about hls, or your really need to get this close persistence?
Because we make life streaming with crf and maxrate/buffsize over hls and never had problems with it.

More information about the ffmpeg-user mailing list