SVT-VP9 icon indicating copy to clipboard operation
SVT-VP9 copied to clipboard

File size control in CQP mode

Open brauliobo opened this issue 2 years ago • 1 comments

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?

brauliobo avatar Apr 24 '23 14:04 brauliobo

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.

davidebeatrici avatar Mar 27 '24 17:03 davidebeatrici