FFMPEG Bitrate Calculation / Optimization

心已入冬 提交于 2019-12-01 01:14:57

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 <file> -vcodec libx264 -vpre slower -acodec copy <outfile>

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.

You want to look for the Shannon-Entropy -log(P)/log(2). This is the minimum bits any information can be think of. But I'm unsure if it is useful to you.

I ended up using the -sameq flag, I read somewhere that this doesn't translate to the same quality but for now this is better than forcing the original bit rate.

Anyway, I've come across this Bash script that suggests that my thinking is right, I still don't know how to calculate the output bit rate without having the output size as a constrain. If anyone knows, please share!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!