Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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..

ss

share|improve this question
    
The description above is obsolete. From the man page: "youtube-dl now defaults to downloading the highest available quality as reported by YouTube, which will be 1080p or 720p in some cases." –  Jos Jun 21 '14 at 10:08
    
Note that YouTube has employed some sort of protection that prevents downloading tools from downloading (or even seeing) the 1080p version, but you can still download all other resolutions up to and including 720p. –  neon_overload Oct 1 '14 at 3:19

3 Answers 3

up vote 14 down vote accepted

To download a video, you type the URL after the command like this.

youtube-dl http://www.youtube.com/watch?v=P9pzm5b6FFY

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

youtube-dl -F http://www.youtube.com/watch?v=P9pzm5b6FFY

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 http://www.youtube.com/watch?v=P9pzm5b6FFY

Done

source: http://www.webupd8.org/2014/02/video-downloader-youtube-dl-gets.html

share|improve this answer
1  
Make sure that you do not choose DASH. That will be unplayable! –  prakharsingh95 Sep 13 '14 at 4:21
    
@prakharsingh95 the DASH audio only can be converted to standard wave or mp3 format using gnac or similar software. –  mchid Sep 17 '14 at 12:09
    
I meant DASH Video. I tried to download 4K, but that's all in DASH format (DASH allows youtube to preserve bandwidth). It's radically different it will mostly be unplayable. –  prakharsingh95 Sep 24 '14 at 19:41
    
@prakharsingh95 Yeah if anything you might be able to view the mp4 using VLC as VLC allows you to sync the video with a separate file for audio. I haven't tried it though. Have you tried converting the mp4 file from the DASH download to avi format? I think they are similar. –  mchid Sep 25 '14 at 5:05
    
Yes. Dash is of course playable, but you need to mux the streams with something like avconv. Too slow for 4K. –  prakharsingh95 Sep 29 '14 at 8:39

You can download 1080p using youtube-dl, but you need to do a little extra work. Usually it will only download 720p as its max even if you can see 1080p on youtube.com.

Run with -F to see available formats:

youtube-dl -F https://www.youtube.com/watch\?v\=-pxRXP3w-sQ

171         webm      audio only  DASH audio  115k , audio@128k (44100Hz), 2.59MiB (worst)
140         m4a       audio only  DASH audio  129k , audio@128k (44100Hz), 3.02MiB
141         m4a       audio only  DASH audio  255k , audio@256k (44100Hz), 5.99MiB
160         mp4       256x144     DASH video  111k , 12fps, video only, 2.56MiB
247         webm      1280x720    DASH video 1807k , 1fps, video only, 23.48MiB
136         mp4       1280x720    DASH video 2236k , 24fps, video only, 27.73MiB
248         webm      1920x1080   DASH video 3993k , 1fps, video only, 42.04MiB
137         mp4       1920x1080   DASH video 4141k , 24fps, video only, 60.28MiB
43          webm      640x360
18          mp4       640x360
22          mp4       1280x720    (best)

notice that youtube-dl has labeled the last option 1280x720 as the 'best' quality and that's what it will download by default, but that the line starting with 137 is actually higher quality 1920x1080. Youtube has separated the video and audio streams for the lines labeled DASH so we also need to pick the highest quality audio which in this case is the line starting with 141. Then we run youtube-dl again this time specifying the audio and video:

youtube-dl -f 137+141 https://www.youtube.com/watch\?v\=-pxRXP3w-sQ

and it will download the 1080p video and auto-merge it with the highest-quality audio. It should also auto-deleted the separate downloaded parts. This method is a little extra work, but will get you the best results.

share|improve this answer

By default, youtube-dl will pick the best quality.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.