1

I use yt-dlp frequently and like it. But there is a problem I can't find documented anywhere.

yt-dlp -v -f "bv*[height<=720]+ba*[ext=m4a]" -N 4 "https://www.youtube.com/xxx"

Will find the best video that does not exceed 720 resolution.

yt-dlp -v -f "bv*[ext=mp4]+ba*[ext=m4a]" -N 4 "https://www.youtube.com/xxx"

will find the best video of type MP4 regardless of resolution.

I would like to select both the extension/codec (avc1) and limit the height.

yt-dlp -v -f "bv*[height<=720,ext=mp4]+ba*[ext=m4a]" -N 4 "https------"

would seem to make sense, but it fails with;

SyntaxError: Invalid filter specification 'height<=720,ext=mp4'

I've tried various characters to separate the two filters (; & + etc.) but can't find the proper syntax, if it exists. I've done a variety of web searches, but cannot find an example of using two qualifiers like maximum resolution and file type together.

I also tried:

yt-dlp -v -f "bv*[height<=720]+bv*[ext=mp4]+ba*[ext=m4a]" -N 4 "http----"

which runs without errors, but only the first "BV" filter, setting the maximum height, is used. It appears that the second filter specifying MP4, is ignored.

So my questions: is it possible to specify two or more filters for video, or is this something that yt-dlp just doesn't do?

If it is supposed to be possible, could someone supply the proper syntax? Or point to the exact web page that says what it is?

Destroy666
  • 5,299
  • 7
  • 16
  • 35
  • I added info about codec, but please check the list **carefully** before progressing further to make sure what you exactly want and what's on the list as I don't know how you missed all the `mp4`s with `vp9`/`vp09` and the question is becoming a mess. – Destroy666 Aug 15 '23 at 18:49
  • Please don't use your question as a forum :( The question should be concise and include only the problem and any sort of important details related to it. Thank yous, side notes, etc. should be in comments. I edited it back to a more readable state - if you'd like to add more, please try to fit it in one "thought" without any lengthy references to my earlier comments or long command results. And if the answer solved your issue, please mark it properly with tick/upvote. – Destroy666 Aug 16 '23 at 21:12

1 Answers1

0

According to the documentation, this should work:

yt-dlp -v -f "bv*[height<=720][ext=mp4]+ba*[ext=m4a]" -N 4 "https://www.youtube.com/xxx"

So basically you specify each filter in separate square bracket pair.

If you want to also download a specific codec, which was not specified before, you can also add filter for that:

yt-dlp -v -f "bv*[height<=720][ext=mp4][vcodec^=avc1]+ba*[ext=m4a]" -N 4 "https://www.youtube.com/xxx"

^= means "starts with", as the avc1 codecs seem to have some additional hash or whatever after . in the list.

Destroy666
  • 5,299
  • 7
  • 16
  • 35