Download YouTube videos from youtube-dl

How to download a 720p YouTube video from youtube-dl ? I tried downloading a sample playlist from YouTube and the videos were not in HD. Has anyone tried downloading in the HD format ?

If anyone knows how to download the HD format, please let me know.

Thanks, Rahul


In YouTube not every video is available in HD format, you need to first check the video whether it is HD or not using following command.

# youtube-dl --list-formats

Sample Output

[youtube] Setting language [youtube] QFtEJDkQL2o: Downloading webpage [youtube] QFtEJDkQL2o: Downloading video info webpage [youtube] QFtEJDkQL2o: Extracting video information [info] Available formats for QFtEJDkQL2o: format code extension resolution note 140 m4a audio only DASH audio , audio@128k (worst) 160 mp4 192p DASH video 133 mp4 240p DASH video 134 mp4 360p DASH video 135 mp4 480p DASH video 136 mp4 720p DASH video 137 mp4 1080p DASH video 17 3gp 176x144 36 3gp 320x240 43 webm 640x360 18 mp4 640x360 22 mp4 **1280x720** (best)
Do you see the video is available in HD format as highlighted, To download a preferred file format, use the option ‘-f’ option as shown below. # youtube-dl -f 22 Here number **22** is the format of file. For more usage on YouTube-DL, I suggest you to read following article.