天天看點

FFmpeg H.264 Constant Bitrate (CBR) Encoding

轉自:​​https://brokenpipe.wordpress.com/2016/10/07/ffmpeg-h-264-constant-bitrate-cbr-encoding-for-iptv/​​

Copy From: ​​https://brokenpipe.wordpress.com/2016/10/07/ffmpeg-h-264-constant-bitrate-cbr-encoding-for-iptv/​​

Example command using a single-frame VBV:

ffmpeg -i <input> -r 25 -c:v libx264 -x264opts nal-hrd=cbr:force-cfr=1 -b:v 2500k -minrate 2500k -maxrate 2500k -bufsize 100k output.ts

where:

nal-hrd=cbr set the hypothetical reference decoder (HRD) to CBR and pack the bitstream to the specified bitrate
force-cfr=1 force constant framerate timestamp generation
-b:v the video bitrate

-minrate

-maxrate

same as the video bitrate for constant bitrate
  • for even lower latency use -tune zerolatency and intra-refresh.
  • single-frame VBV ​​can be inaccurate with small frame-sizes and multi-threading​​.  If the encoder reports many VBV underflows try setting -threads 1
ide