Encoding H.264 CBR videos with FFmpeg

后端 未结 4 1138
长发绾君心
长发绾君心 2021-02-04 09:25

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

4条回答
  •  灰色年华
    2021-02-04 10:00

    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:

    • vbv-maxrate = bitrate = B = target bitrate
    • vbv-bufsize = B / fps (in this video's case that's 24 fps)

    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!

提交回复
热议问题