Downloading 1080p videos from youtube and elsewhere using the youtube-dl utility

andyc56

Member
Thread Starter
Joined
Jun 2, 2017
Messages
41
I've been using a video downloader add-on for Firefox called FVD (Flash Video Downloader) that's capable of downloading 1080p videos from youtube, but recent developmens with Firefox led me to believe this add-on would be rendered invalid when Firefox 57 rolls out this month. The download process for 1080p videos from youtube requires separate downloading of audio-only and video-only tracks, then combining them into one file afterwards. In searching for a replacement, I discovered a nifty free command-line utility called youtube-dl (download). This utility also requires FFMPEG (download) in order to do the combining of audio and video tracks. This post will show you how to download 1080p videos from youtube and many other sources, if available, using youtube-dl and FFMPEG. Many browser-based video downloaders don't support that. Some people using such downloaders may not even be aware that 1080p versions of their favorite videos might be available.

For Windows, both of these utilities should be installed in a directory that's not under C:\Program Files or C:\Program Files (x86). That's because these directories are protected by Windows User Account Control (UAC) and the super-easy update of youtube-dl that I'll describe shortly requires that the directory it's in be writable. I have several old Windows programs and also Unix-style utilities that either don't work correctly under UAC or don't work correctly when installed in directories having spaces in their name. So I have created a directory called C:\Programs-no-uac under which I install such programs. In this case, I've copied both youtube-dl and FFMPEG executable files into C:\Programs-no-uac\util. These files are as follows. I'm not sure all of them are needed.

youtube-dl.exe
ffmpeg.exe
ffplay.exe
ffprobe.exe

Then I added C:\Programs-no-uac\util to the Windows PATH environment variable. See "Environment Variables" in Windows Help for how to do this.

The command-line options of youtube-dl are daunting, but fortunately there's only a small number of them you'll need to use in most cases.

youtube-dl is updated roughly once a week. You won't have to browse the web and download a new version of youtube-dl to get the latest, though. Just type:
Code:
youtube-dl -U
from a command prompt to update it. Done! That's why it should be put into a directory that's not controlled by Windows UAC. The executable file is updated in place. All youtube-dl options are case-sensitive, so make sure you use the capital U.

In the examples below, I'll use an interesting and informative video, by a guy named BrolicBeast, that talks about the QSC Q-Sys DSP hardware. That video can be found here. You may want to practice on a much shorter video, because this one is huge and takes a long time to download. The easiest way to use youtube-dl to download this video is to navigate to the desired destination folder in Windows Explorer, shift-right-click and choose "Open command window here". In the system menu of the command window, choose "Properties", go to the "Options" tab, and make sure "Insert mode" and "QuickEdit mode" are checked. The latter will allow you to paste from the clipboard using the right mouse button.

The simplest way to download the video, but the one with the least control, is done by just invoking it with the URL of the video as argument. The URL is as follows:
Code:
https://www.youtube.com/watch?v=zOQVduUtKi0&feature=youtu.be

The "&feature=youtu.be" messes up youtube-dl, so we delete it from the end as follows:
Code:
https://www.youtube.com/watch?v=zOQVduUtKi0

Note: You won't get this erroneous "&feature=youtu.be" if you obtain the URL from the "Share" button under the video on the youtube web site.

So the youtube-dl command line becomes the one below. Remember you can just use the right mouse button to paste the URL from the clipboard onto the command line.
Code:
youtube-dl https://www.youtube.com/watch?v=zOQVduUtKi0

This will download separate audio-only and video-only files, and combine them in a huge file that's over 900 MB. When I try to play it on my somewhat wimpy computer, the audio skips. YMMV. What's going on? Let's find out by looking at the available audio and video formats using the -F option. This will show the available formats without downloading the video or audio.
Code:
youtube-dl -F https://www.youtube.com/watch?v=zOQVduUtKi0

This results in the output:
Code:
[youtube] zOQVduUtKi0: Downloading webpage
[youtube] zOQVduUtKi0: Downloading video info webpage
[youtube] zOQVduUtKi0: Extracting video information
[youtube] zOQVduUtKi0: Downloading MPD manifest
[youtube] zOQVduUtKi0: Downloading MPD manifest
[info] Available formats for zOQVduUtKi0:
format code  extension  resolution note
139          m4a        audio only DASH audio   57k , m4a_dash container, mp4a.40.5@ 48k (22050Hz)
140          m4a        audio only DASH audio  136k , m4a_dash container, mp4a.40.2@128k (44100Hz)
160          mp4        256x144    DASH video  108k , avc1.4d400b, 30fps, video only
133          mp4        426x240    DASH video  242k , avc1.4d400c, 30fps, video only
134          mp4        640x360    DASH video  700k , avc1.4d401e, 30fps, video only
135          mp4        854x480    DASH video 1155k , avc1.4d4014, 30fps, video only
136          mp4        1280x720   DASH video 2310k , avc1.4d4016, 30fps, video only
298          mp4        1280x720   DASH video 3465k , avc1.4d4016, 60fps, video only
137          mp4        1920x1080  DASH video 4331k , avc1.64001e, 30fps, video only
299          mp4        1920x1080  DASH video 6849k , avc1.64002a, 60fps, video only
17           3gp        176x144    small , mp4v.20.3, mp4a.40.2@ 24k
36           3gp        320x180    small , mp4v.20.3, mp4a.40.2
43           webm       640x360    medium , vp8.0, vorbis@128k
18           mp4        640x360    medium , avc1.42001E, mp4a.40.2@ 96k
22           mp4        1280x720   hd720 , avc1.64001F, mp4a.40.2@192k (best)

We can see that the highest available resolution in a combined video and audio file is 720p, but if we download separate audio and video files and combine them, we can get higher resolution. That's what the default downloading behavior of youtube-dl does. If it needs to download separate audio and video files to get the highest video resolution possible, it will do so. So in this case, it is using video-only format 299 (60 fps 1080p) and combining it with audio format 140 to make the final mp4 file.

I mentioned the audio was skipping on my wimpy computer. Through trial and error, I found this was due to using the 60 fps video that youtube-dl chooses by default. Picking a specific combination of audio and video formats involves using the -f option. Let's pick video format 137 (30 fps 1080p) and audio format 140. The -f option is used by specifying the video format number, followed by a "+" sign, then the audio format number with no spaces in between the numbers and the "+" sign, as follows:
Code:
youtube-dl -f 137+140 https://www.youtube.com/watch?v=zOQVduUtKi0

This file is 762 MB and doesn't skip when played on my system.

If there is no 1080p video, then the -f option of youtube-dl is not needed. You can just type:
Code:
youtube-dl https://some.url
to get the best available version.

To sum up, once you have youtube-dl installed, have a video url you wish to use for download, and have launched a command prompt in the desired destination directory, do the following to find the available formats:
Code:
youtube-dl -F https://some.url

Once you have determined the desired video format number (vid_fmt_num) and audio format number (aud_fmt_num), do the following:
Code:
youtube-dl -f vid_fmt_num+aud_fmt_num https://some.url

After having discovered this program, I realized I had previously downloaded many videos at resolutions lower than the maximum available. The -F option is a nifty way of finding out the available resolutions without downloading the video itself. If you combine incompatible audio and video streams, say webm audio and MP4 video, youtube-dl will package the result into an MKV file.
 
Last edited:

timcarterr

New Member
Joined
Jan 13, 2019
Messages
2
Why even go for add-ons dude? Just use an online utility for downloading videos, there's plenty of them. I personally use tubegeter(dot)com. Even with the recent developments, it still works and you can also download entire playlists with it.
 

andyc56

Member
Thread Starter
Joined
Jun 2, 2017
Messages
41
Why even go for add-ons dude? Just use an online utility for downloading videos, there's plenty of them. I personally use tubegeter(dot)com. Even with the recent developments, it still works and you can also download entire playlists with it.

youtube-dl isn't an "add-on". It's a command-line program. And despite its name, it isn't limited to youtube at all.

Other than that, you're doing great on your first post.
 
Top Bottom