Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File size control in CQP mode #165

Open
brauliobo opened this issue Apr 24, 2023 · 1 comment
Open

File size control in CQP mode #165

brauliobo opened this issue Apr 24, 2023 · 1 comment

Comments

@brauliobo
Copy link

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
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants