How to Download YouTube Videos with yt-dlp

A guide for Windows users and other confused people This article originally appeared as a forum post on Agora Road. I’ve updated it to use yt-dlp instead of youtube-dl, which is no longer being maintained.

Picture of an old man turning on a TV

yt-dlp is a great tool for downloading YouTube videos and a far better alternative to the hundreds of more popular websites, browser extensions, and bloated adware programs that claim to do the same thing. It’s a command-line program, which might be a little intimidating for the technically-impaired, but the process is actually incredibly easy once you get used to it. Here’s a quick guide for getting it to work on Windows (this is all old news for Linux users):

  1. Download yt-dlp and ffmpeg. The yt-dlp devs recommend using their own custom builds of ffmpeg for better compatibility.
  2. Extract yt-dlp.exe, ffmpeg.exe, and ffprobe.exe to a folder somewhere on your hard drive.
  3. Type “environment variable” into the evil Microsoft search bar and select the result that says “Edit the system environment variables.” Steps 3 and 4 were written specifically with Windows 10 in mind. If you’re using an older or newer version of the Worst Operating System Ever Designed™ you’ll have to look it up yourself. Click the “Environment Variables” button in the “System Properties” window that pops up.
  4. Look through the “System Variables” menu and find the variable “Path.” Click “Edit,” and then “New.” Paste in the path to the directory you created in step 2. (Don’t edit or delete any of the other entries in Path unless you want to go to hell before you die.)
  5. Type cmd in the evil search bar to open up a command prompt window.
  6. Type in yt-dlp [URL of the video you want to download]
  7. Hit enter, the video will download to C:\Users\[You] (The directory command prompt opens in by default.)

The resulting file will probably not be the highest resolution video available on YouTube. You can stop here if you don’t care about video quality for some reason, but there’s a more advanced way of downloading videos that will allow you to pick and choose the resolution and audio quality you want. (This is where ffmpeg comes into play.)

  1. Type yt-dlp -F [URL of the video you want to download] into the command prompt. Make sure you use a capital F.
  2. You will see a list of available files. Starting from the top there will be a few audio tracks labeled “audio only”, followed by a larger number of video tracks labeled “video only”, and a couple of combination audio+video files at the end. (One of these will be tagged “best,” this is what yt-dlp downloads by default.) Every entry will have a “format code” number listed on the left-hand side.
  3. Pick the audio file and video file you want. When in doubt, bigger numbers = better quality = bigger filesize. Take this advice with a grain of salt. Note the format codes.
  4. Type in yt-dlp -f [video format code]+[audio format code] [URL of the video you want to download] Lower-case f this time. Your command should look something like this: yt-dlp -f 137+140 https://www.youtube.com/watch?v=jQpr9G2fhCI
  5. Mash enter, yt-dlp will download both files and have ffmpeg automatically combine them into one high-quality video you can watch at your leisure. ffmpeg isn’t able to merge webm files with non-webm files and will tell you it’s going to combine the two into a mkv container instead. This isn’t that big of a deal if you have a modern video player installed, but if you’re planning on converting or editing the result it may be a better idea to avoid mixing and matching. Congratulations!

That’s all there is to it. Again, this will probably be redundant to most people reading this site, but I still think it’s worth sharing. We can’t trust YouTube to keep the videos we like available forever. The more people downloading and backing up their favorites (without using those terrible adware converters), the better.


Back Home