ffmpeg 2-pass

Assume to limit the output less than 20 MB.

  1. 1st-pass crf :

    ffmpeg -i input.mkv -an -ss 00:55 -t 00:10 -pass 1 -passlogfile text.log -codec:v libx264 -x264opts crf=22 output.mp4

    20 MiB = 8 * 20 Mib = 8 * 20 * 1024 * 1024 bits = 167772160 bits

    bitrate = 167772160 bits / 10 sec = 16777216 bps = (16777216 / 1000) * K bps ~= 16777 K bps

  2. 2nd-pass 會參考 crf 22 的 bitrate 分配方式 等比例縮小到 16777 K bps

    ffmpeg -i input.mkv -an -ss 00:55 -t 00:10 -pass 2 -passlogfile text.log -codec:v libx264 -b:v 16777k output.mp4

Leave a Reply

Your email address will not be published. Required fields are marked *