FFMPEG Bitrate Calculation / Optimization

前端 未结 3 1827
暗喜
暗喜 2021-01-07 09:50

I wrote the following wrapper for FFMPEG:

function Video($input, $crop = null, $scale = null, $output = null, $extra = null)
{
    $input = @new ffmpeg_movie         


        
3条回答
  •  鱼传尺愫
    2021-01-07 10:23

    In general you shouldn't specify a bitrate at all. It's only useful for streaming, in which case you need to respect VBV as well (which specifies a maximum bitrate over time, as well as the average bitrate).

    Use x264 crf 23 - its default constant-quality mode- and be happy. In the case of ffmpeg, this is something like:

    ffmpeg -i  -vcodec libx264 -vpre slower -acodec copy 
    

    As for audio, it's best directly copied if the input was compressed. This is not possible in some situations, such as if the input was vorbis and the output is a .flv file. In that case I would stick to whatever the default of the audio encoder selected is.

提交回复
热议问题