Thursday, May 23, 2024
rated 0 times [  650] [ 0]  / answers: 1 / hits: 980063  / 2 Years ago, sun, march 20, 2022, 1:50:51

I have installed youtube-dl in my 14.04.

I can download video by following command,

$ youtube-dl [youtube-link]

But I want to know how to select available pixel quality of youtube video(i.e 1080p, 720p, 480p, etc).

In software description they said it's possible(shown in image below), but how to do..


More From » command-line


To download a video, you type the URL after the command like so:

youtube-dl ''

To select the video quality, first use the -F option to list the available formats, here’s an example,

youtube-dl -F ''

Here’s the output:

[youtube] Setting language
[youtube] P9pzm5b6FFY: Downloading webpage
[youtube] P9pzm5b6FFY: Downloading video info webpage
[youtube] P9pzm5b6FFY: Extracting video information
[info] Available formats for P9pzm5b6FFY:
format code extension resolution note
140 m4a audio only DASH audio , audio@128k (worst)
160 mp4 144p DASH video , video only
133 mp4 240p DASH video , video only
134 mp4 360p DASH video , video only
135 mp4 480p DASH video , video only
136 mp4 720p DASH video , video only
17 3gp 176x144
36 3gp 320x240
5 flv 400x240
43 webm 640x360
18 mp4 640x360
22 mp4 1280x720 (best)

The best quality is 22 so use -f 22 instead of -F to download the MP4 video with 1280x720 resolution like this:

youtube-dl -f 22 ''

Or optionally use the following flags to automatically download the best audio and video tracks that are available as a single file:

youtube-dl -f best ''

If you encounter any error during the muxing process or an issue with the video quality selection, you can use one of the following commands:

youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/bestvideo+bestaudio' --merge-output-format mp4 ''

or as Gabriel Staples pointed out here, the following command will typically select the actual best single file video quality resolution instead of video quality bit-rate:

youtube-dl -f best ''

These commands will ensure you download the highest quality mp4 video and m4a audio from the video as a single file or will merge them back into a single mp4 (using ffmpeg in my case). If ffmpeg or avconv is not available, youtube-dl should fall back to the single file -f best option instead of the default.

Click here for more detailed information and some different examples.

Also, click to see this related answer by Gabriel Staples.



[#24510] Sunday, March 20, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 292
Total Questions: 106
Total Answers: 115

Location: Cape Verde
Member since Fri, Sep 16, 2022
2 Years ago
ormlai questions
Wed, Sep 28, 22, 00:17, 2 Years ago
Sun, Aug 7, 22, 22:05, 2 Years ago
Wed, Jun 16, 21, 03:50, 3 Years ago
Sun, Feb 6, 22, 09:11, 2 Years ago
Mon, Jul 12, 21, 10:00, 3 Years ago