Get youtube-dl video for a particular size, like 480p or 720p

1

This answer is very involved:

youtube-dl -f 'bestvideo[height<=480]+bestaudio/best[height<=480]'

I have a hard time believing that software as advanced as youtube-dl does not have a straightforward way to get video of a certain size.

I am aware that I can use -F to get a list of streams, and then -f to select both the audio and the video. I thought there must be some simpler shortcut to a certain video size, since it is such a common task.

I have read the help, in fact searched for every occurrence of the word "size", and they are all references to file size, none to video size.

felwithe

Posted 2019-11-05T11:12:10.553

Reputation: 383

Answers

0

No, there isn't a one-letter shortcut option.

The simplified version, changed to request an exact height (= vs <=), is:

youtube-dl -f 'bestvideo[height=480]+bestaudio'

This longer version is needed because all new YouTube uploads use separate audio and video streams. If you had used -f 'best[height=480]' only, it would work for low-resolution modes (e.g. 360p), but often wouldn't find any combined high-resolution stream at all.

Youtube-dl ended up having this kind of format specification because its users wanted flexibility – it's not just that you need a specific resolution, but other users also need specific formats (e.g. H.264 video only; MP4 container only; any audio except OPUS; etc.), or specific stream types (e.g. audio only), or various other constraints.

You did not find any results in documentation because as you noticed, the term "size" is ambiguous, so pixel dimensions are referred to as "resolution" instead. Indeed the documentation contains this example:

If you want to only download some DASH formats (for example if you are not interested in getting videos with a resolution higher than 1080p), you can add -f bestvideo[height<=?1080]+bestaudio/best to your configuration file.

So the earlier answer is correct and matches the youtube-dl author's recommended approach.

user1686

Posted 2019-11-05T11:12:10.553

Reputation: 283 655

I really thought it must have been an oversight. Ok, thank you. I understand wanting flexibility-- but, for example, youtube-dl gets the best video and audio by default, right? So, I thought, can't I tell it to just get the best at 720p? And it will make all of the same decisions it would with no arguments, except it would use the best 720p video instead of the best maximum size video. ("Best" being however it already determines "best".) – felwithe – 2019-11-05T15:12:03.763

0

I have a hard time believing that software as advanced as youtube-dl does not have a straightforward way to get video of a certain size.

If you're interested in using a non-CLI solution that has an intuitive GUI, you might want to try this:

  1. Install 4K Video Downloader (the free version will most likely do everything you need).

  2. Choose your desired video download quality:

enter image description here

  1. Download:

enter image description here

Mr Ethernet

Posted 2019-11-05T11:12:10.553

Reputation: 3 563