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

Optional filter specification for "ext" doesn't work #7522

Closed
realnc opened this issue Nov 16, 2015 · 5 comments
Closed

Optional filter specification for "ext" doesn't work #7522

realnc opened this issue Nov 16, 2015 · 5 comments

Comments

@realnc
Copy link

@realnc realnc commented Nov 16, 2015

Videos that are provided only in "mp4" by YouTube break youtube-dl when using a filter specification such as:

$ youtube-dl -f 'bestvideo[ext=?webm]+bestaudio' -g https://www.youtube.com/watch?v=1UE2x2OcfxI
ERROR: requested format not available

I have [ext=?webm] stored as a default option, so that WebM is preferred, but if it doesn't exist (like in the video given in the example above), then H.264 video is OK. The point is that WebM should be preferred if both are available, but it shouldn't fail if WebM is not available, since the filter operator is =?, not just =.

In case it matters, the same thing happens with audio. Same error message if I try bestvideo+bestaudio[ext=?webm].

A workaround exists, but it can get rather long. For example, this doesn't work:

bestvideo[ext=?webm]+bestaudio[ext=?webm]

But the longer equivalent does work:

bestvideo[ext=webm]+bestaudio[ext=webm]/bestvideo[ext=mp4]+bestaudio[ext=webm]/bestvideo[ext=mp4]+bestaudio[ext=mp4]/bestvideo[ext=webm]+bestaudio[ext=mp4]

(The reason I prefer webm is because YouTube's H.264 encodes are lower quality compared to their VP9 encodes, even though the former has a higher bitrate compared to the latter.)

@phihag
Copy link
Contributor

@phihag phihag commented Nov 16, 2015

That's not how =? works. [ext=?webm] matches either webm or unset ext values, but all of the formats of the video have non-webm extensions.

@phihag phihag closed this Nov 16, 2015
@realnc
Copy link
Author

@realnc realnc commented Nov 16, 2015

Oh. Is that useful though? Shouldn't it mean "webm, and if that's not available, then whatever you would have picked instead."

The current behavior doesn't sound useful, or at least not as useful.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 17, 2015

@realnc You may want to try -f 'bestvideo[ext=webm]+bestaudio/bestvideo+bestaudio/best'.

@realnc
Copy link
Author

@realnc realnc commented Nov 17, 2015

@yan1212 As mentioned already, I'm using bestvideo[ext=webm]+bestaudio[ext=webm]/bestvideo[ext=mp4]+bestaudio[ext=webm]/bestvideo[ext=mp4]+bestaudio[ext=mp4]/bestvideo[ext=webm]+bestaudio[ext=mp4], which is kind of a monstrosity. But it that's how it's designed to be...

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Nov 17, 2015

FYI: Grouping in format filters is requested in #5242 and implemented in #6124. You may want to try it. I guess (bestvideo[ext=webm]/bestvideo[ext=mp4])+(bestaudio[ext=webm]/bestaudio[ext=mp4]) works the same as the previous filter.

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

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.