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

Format Selection Limit Output File Total Size #2518

Open
4 tasks done
Phantom1472 opened this issue Jan 27, 2022 · 4 comments
Open
4 tasks done

Format Selection Limit Output File Total Size #2518

Phantom1472 opened this issue Jan 27, 2022 · 4 comments
Labels
enhancement New feature or request

Comments

@Phantom1472
Copy link

Checklist

Description

When using format selection with the default format (-f bestvideo*+bestaudio/best), I was trying to limit the size of the output file, using this syntax: -f "bestvideo*[filesize<400M]+bestaudio[filesize<400M]/best[filesize<400M]", which works except this limits video and audio individually, but my constraint (for example, I need to upload said output file to somewhere, but can't upload files bigger than 400MB) is on the output file total size, and not on the files (audio+video) making it.

Can we have a format syntax to tell yt-dlp to limit the total output file size? if is it not exactly known (because combining will probably make it smaller by a bit), the approximate size is the sum of the audio and video anyway, and probably (I don't know for sure, if I'm wrong correct me please) this limit is an upper limit (meaning size(audio)+size(video) is always <= size(audio+video)), so even if it's not exact, that's still good as an approximate limit.

If this is currently possible, please let me know how can I do that right now.

Thanks!

@Phantom1472 Phantom1472 added enhancement New feature or request triage Untriaged issue labels Jan 27, 2022
@pukkandan
Copy link
Member

Currently not possible and implementing this would require some serious modifications to the format selection code

@pukkandan pukkandan removed the triage Untriaged issue label Jan 28, 2022
@Phantom1472
Copy link
Author

Yeah I assumed so... Oh well, Thanks anyway!

@pukkandan
Copy link
Member

I have an initial implementation of this ready - master...pukkandan:yt-dlp-dev:features/formats (Also addresses #389, #1176).

But, there is the issue of backward compatibility. Currently (A+B)[C] behaves as A[C]+B[C]. But adding this feature would require the filter to be instead run on the merged format. I suspect there are configurations that depend on the current behavior. So this change will need to go through a deprecation cycle.

That is, unless someone can think of a syntax that would support this while maintaining compat

@natopotato390
Copy link

Perhaps some way of automatically balancing out video size and audio size so that a good ratio comes out that meets the filelimit requirements.
ex. 8MB file limit, uses: bv*[filesize<7M]+ba*[filesize<1M]

But yeah pretty hacky way of doing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: format selection
Development

No branches or pull requests

3 participants