For rendering, the time it takes is very different.
-b 3500K -minrate 0K -maxrate 8000Ktakes 1hr 17minvb=3000ktakes 2.5 hours
What is vb 3000k and how is it different from -b 3500K -minrate 0K -maxrate 8000K?
Are these variable bit rate settings?
If I changed to -b 3500K -minrate 3500K -maxrate 3500K, is that constant bit rate?
1 Answer
Please read the documentation for FFmpeg, and run ffmpeg -h full for the list of options. Also, have a look at this article I wrote, which shows the differences between rate control modes in encoders like x264 and x265.
Generally, here's what the options mean:
-b:v(or-vb, the same) specifies the target average bit rate for the encoder to use:-b<int>E..VA. set bitrate (in bits/s) (from 0 to INT_MAX)-minratespecifies a minimum tolerance to be used:-minrate<int>E..VA. Set minimum bitrate tolerance (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise. (from INT_MIN to INT_MAX)-maxratespecifies a maximum tolerance. However, as the documentation indicates, this is only used in conjunction withbufsize:-maxrate<int>E..VA. Set maximum bitrate tolerance (in bits/s). Requiresbufsizeto be set. (from INT_MIN to INT_MAX)-bufsize<int>E..VA. set ratecontrol buffer size (in bits) (from INT_MIN to INT_MAX)This only makes sense for variable bit rate encoding, where instead of using a constant bit rate or constant quality model, the encoder simulates a transmission with a virtual buffer at the decoder. The
-minrate/-maxrate/-bufsizeoptions control that buffer size. You typically only use this mode for streaming, since the technique will constrain the bit rate in order to not exceed a certain value which would cause the decoder buffer to over- or underflow.
To summarize, you have several options for limiting bitrate:
To set up a CBR process, you have to check what the encoder offers. Typically, you cannot achieve a "perfect" constant bitrate, since the encoder will not waste bits. Setting
-b:v,-minrate, and-maxrateto the same levels will achieve that, for example for libx264:ffmpeg -i input.mp4 -c:v libx264 -x264-params "nal-hrd=cbr" -b:v 1M -minrate 1M -maxrate 1M -bufsize 2M output.tsWarning: This might result in low quality for videos that are hard to encode, and it will waste bits. Unless you absolutely need to achieve a constant rate output, do not use this option.
Set up a constrained / variable bit rate process for streaming. Use
-b:v 3500K -maxrate 3500K -bufsize 1000K, for example. You'll have to adjust the rate and buffer sizes to the context obviously. The higher the buffer size, the higher the allowed bitrate variation.Use a constant quality target and limit the bitrate only to catch spikes. For example, use
-c:v libx264 -crf 23 -maxrate 4M -bufsize 4Mto encode at variable bitrate with a target CRF of 23, but limit the output to a maximum of 4 MBit/s.