Is it possible for youtube-dl prefer certain formats within a given resolution?
See original GitHub issueChecklist
- I’m asking a question
- I’ve looked through the README and FAQ for similar questions
- I’ve searched the bugtracker for similar questions including closed ones
Question
Hello!
I would like youtube-dl to always download the highest resolution video available. However, if a particular resolution is available as either a VP9 or an H.264 stream, I want youtube-dl to prefer H.264.
So, I want youtube-dl to select the VP9 stream for this video, because the highest resolution available is not offered in H.264. However, I want youtube-dl to select the H.264 for this and this video, because the highest resolutions available (1080p and 540x480, respectively) are offered in both H.264 and VP9.
The format selector I’m currently using (bestvideo[vcodec!^=av01]+bestaudio[ext=m4a]/best
) downloads the 1080p video as H264 as desired, but it downloads the 540x480 video as VP9.
Is there a format selector that will make youtube-dl do what I want? Thank you so much!
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top GitHub Comments
Very clever @Roasty-Float, thank you!
The ability to select by height is nifty, I didn’t know you could do that. I do wish I didn’t have to rely on resolution since the formats Youtube offers per resolution could theoretically change some day, but then it has been pretty consistent about this for many years.
Btw, the final selector I went with is:
Because I want to make sure Youtube doesn’t ever download av1 streams, which I’ve found does happen otherwise for some videos.
Because
best
means the best quality that’s available as a single file, which on Youtube is (almost?) always 720p. Whereasbestvideo+bestaudio
means “the best individual video stream combined with the best individual audio stream”.You could leave out
best
altogether if you only download from Youtube, but that would fail on other websites which don’t offer separate audio and video streams.