9

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
  • 12,350
Bart Lederman
  • 367
  • 1
  • 4
  • 11

1 Answers1

10

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
  • 12,350