Select Certain Videos for Youtube-Dl Using Format Codes

Select Certain Videos for Youtube-Dl Using Format Codes

So I have youtube-dl setup and am trying to "automate" a way that I download videos. I have got it mostly setup however I need a way to be able to only select videos that have a format code starting with "en" and ignore the ones beginning with other characters. The output of the -F list is below.

format code     extension  resolution note
en_br-hls-1249  mp4        640x360    1249k , avc1.4d001e, mp4a.40.2
ja_br-hls-1452  mp4        640x360    1452k , avc1.4d001e, mp4a.40.2
en_br-hls-1762  mp4        854x480    1762k , avc1.4d001f, mp4a.40.2
ja_br-hls-2067  mp4        854x480    2067k , avc1.4d001f, mp4a.40.2
en_br-hls-2991  mp4        1280x720   2991k , avc1.640029, mp4a.40.2
ja_br-hls-3513  mp4        1280x720   3513k , avc1.640029, mp4a.40.2
en_br-hls-5857  mp4        1920x1080  5857k , avc1.640029, mp4a.40.2
ja_br-hls-6904  mp4        1920x1080  6904k , avc1.640029, mp4a.40.2 (best)

As you can see from the list above the "best" is currently on the format that begins with ja and sometimes it reverses so the best is listed as "en". What I want is a way for it to always select the best "en" stream and not the ja which it currently does when I feed it the "-f best" variable.

Any help would help as I'm not exactly sure how I do this, or even if there is a way in youtube-dl by default. if not then a way to make it do what I want in the site code itself could work.

Any pointers?

1 Answer

So it seems I have found out how I didn't remove this so it gives others who are having the same issue as me to find it.

So with the format selecting you are able to add filters to them, I was initially trying to use the --match-filter variable but all I needed to actually do was.

-f "best[format_id^=en]"

This basically tells youtube-dl to only use formats were the id begins with "en"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.