Intro
What dev doesn’t want to run stuff from the command line just to look cool? I knew about youtube-dl before but thought it looked too complicated to bother with. Tried it today and it’s actually super slick!
Setup
Install Python 3.7+
Just head to the
Python official site
and install it. Make sure to check Add Python x.x to PATH during installation.
Install yt-dlp
yt-dlp is a fork of youtube-dl , and from my tests, it’s noticeably faster.
Download
Go to the
releases page
and grab yt-dlp.exe.
Setup Path
Drop the downloaded file into a fixed location. Open This PC’s Properties, then go to Advanced system settings -> Environment Variables -> System variables. Select Path, click Edit, then in the new window, click New and enter the path where your yt-dlp.exe file is.
Click OK three times to close all windows.
Test It Out
Hit Win+R, type cmd, and press Enter.
In cmd, type yt-dlp. If you see Usage: yt-dlp [OPTIONS] URL [URL...], you’re good to go.
Update
Just type yt-dlp -U in cmd.
Download Videos
In cmd, simply type yt-dlp + space + YouTube video link to start downloading.
Default download is 720P, saved to C:/Users/%UserName%/.
Change Download Location
Create a new folder named yt-dlp in C:\Users\%UserName%\AppData\Roaming. Go into this new folder and create a file called config.txt.
Add this line to the file:
| |
Here, C:/Users/%UserName%/Downloads/Video/ is your download directory.
%(title)s.%(ext)s defines the filename format; here, it’s video title.extension.
Download 1080P
For 1080P and higher videos, audio and video are separate streams, so you’ll need to download ffmpeg first.
ffmpeg
Head to the official site , pick your system type from the bottom left, then download.
I went with
Releases · BtbN/FFmpeg-Builds
and downloaded ffmpeg-n5.0-latest-win64-gpl-5.0.zip.
Then put it in a fixed folder and add the bin directory to your system’s Path.
Test It Out
Open cmd, type ffmpeg -version. If you see the version number, you’re set.
Check Available Formats
Enter yt-dlp -D [URL] to see all available formats for the current video (query only, no download).
Download Command
Use yt-dlp -f [ID] [URL] to download a specific format. You can combine [ID]+[ID] to download video and audio separately; yt-dlp -f [ID]+[ID] [URL]. They’ll merge automatically after downloading.
Note: To download the best quality video and audio: -f "bv+ba/b"
Integrate aria2
Just add --external-downloader aria2c --external-downloader-args "-x 16 -k 1M" to your download command.
Download Subtitles
| |
Download Playlists
| |
GUI Option
Releases · jely2002/youtube-dl-gui