OpenVisualCloud / SVT-VP9

SVT VP9 encoder. Scalable Video Technology (SVT) is a software-based video coding technology that is highly optimized for Intel® Xeon® processors. Using the open source SVT-VP9 encoder, it is possible to spread video encoding processing across multiple Intel® Xeon® processors to achieve a real advantage of processing efficiency.
Other
215 stars 46 forks source link

File size control in CQP mode #165

Open brauliobo opened 1 year ago

brauliobo commented 1 year ago

Hi, I'm speaking as the author of https://github.com/brauliobo/media-downloader-bot

I need to ensure the file size isn't bigger than Telegram 50mb limit for bot uploads. I'm using the CQP setting there to provide a consistent quality.

In H264 I can provide a buffer size of 50M and restrict the max rate while using -crf option in FFMpeg (see https://github.com/brauliobo/media-downloader-bot/blob/main/zipper.rb#L33)

How can I do something similar with SVT-VP9?

davidebeatrici commented 3 months ago

If you know the video duration in advance you can calculate the maximum bitrate in order for the resulting file not to exceed 50 MB.

Let's suppose the duration is 100 seconds:

50 MB * 8 = 400 Mb
400 Mb / 100 s = 4 Mb/s

The command would be:

ffmpeg -i vid.mp4 -c:v libsvt_vp9 -rc 1 -b:v 4M vid.webm

Please note that the resulting file size is not determined by the video track(s) alone. Audio track(s) and the container itself should be taken into account.