youtube, windows, linux
📝 This article is a translation of the original Japanese post. View original
What Is yt-dlp?
An open source tool that parses things like the json api of the YouTube site and downloads videos.
yt-dlp/yt-dlp: A feature-rich command-line audio/video downloader
I used yt-dlp because I wanted to download, for personal use, a private video I had uploaded to YouTube, and I didn’t want to use a sketchy web site.
Installation
It’s documented in Installation · yt-dlp/yt-dlp Wiki, so that’s a good reference. In my environment python3 is installed in wsl, so
1python3 -m pip install -U yt-dlp
was all it took.
Downloading in High Quality
The -F option shows the formats and resolutions available for download.
1$ yt-dlp -F --progress "https://www.youtube.com/watch?v=xxxxxxxxx"
2
3[info] Available formats for :
4ID EXT RESOLUTION FPS HDR CH │ FILESIZE TBR PROTO │ VCODEC VBR ACODEC ABR ASR MORE INFO
5─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
6sb3 mhtml 48x27 0 │ mhtml │ images storyboard
7sb2 mhtml 80x45 0 │ mhtml │ images storyboard
8sb1 mhtml 160x90 0 │ mhtml │ images storyboard
9sb0 mhtml 320x180 0 │ mhtml │ images storyboard
10233 mp4 audio only │ m3u8 │ audio only unknown [ja] Default
11234 mp4 audio only │ m3u8 │ audio only unknown [ja] Default
12139 m4a audio only 2 │ 13.70MiB 49k https │ audio only mp4a.40.5 49k 22k [ja] low, m4a_dash
13140 m4a audio only 2 │ 36.35MiB 129k https │ audio only mp4a.40.2 129k 44k [ja] medium, m4a_dash
14251 webm audio only 2 │ 37.16MiB 132k https │ audio only opus 132k 48k [ja] medium, webm_dash
15269 mp4 256x144 29 │ ~ 54.47MiB 189k m3u8 │ avc1.4D400C 189k video only
16160 mp4 256x144 29 │ 22.38MiB 80k https │ avc1.4D400C 80k video only 144p, mp4_dash
17603 mp4 256x144 29 │ ~ 47.97MiB 167k m3u8 │ vp09.00.11.08 167k video only
18278 webm 256x144 29 │ 24.57MiB 88k https │ vp09.00.11.08 88k video only 144p, webm_dash
19631 mp4 256x144 29 10 │ ~ 63.81MiB 222k m3u8 │ vp09.02.11.10 222k video only
20330 webm 256x144 29 10 │ 39.78MiB 142k https │ vp09.02.11.10 142k video only 144p HDR, webm_dash
21229 mp4 426x240 29 │ ~103.40MiB 360k m3u8 │ avc1.4D4015 360k video only
22133 mp4 426x240 29 │ 48.49MiB 173k https │ avc1.4D4015 173k video only 240p, mp4_dash
23604 mp4 426x240 29 │ ~ 86.37MiB 300k m3u8 │ vp09.00.20.08 300k video only
24242 webm 426x240 29 │ 47.07MiB 168k https │ vp09.00.20.08 168k video only 240p, webm_dash
25632 mp4 426x240 29 10 │ ~ 95.90MiB 334k m3u8 │ vp09.02.21.10 334k video only
26331 webm 426x240 29 10 │ 71.67MiB 255k https │ vp09.02.21.10 255k video only 240p HDR, webm_dash
27230 mp4 640x360 29 │ ~229.20MiB 797k m3u8 │ avc1.4D401E 797k video only
28134 mp4 640x360 29 │ 91.30MiB 325k https │ avc1.4D401E 325k video only 360p, mp4_dash
2918 mp4 640x360 29 2 │ 117.62MiB 419k https │ avc1.42001E mp4a.40.2 44k [ja] 360p
30605 mp4 640x360 29 │ ~163.72MiB 570k m3u8 │ vp09.00.21.08 570k video only
31243 webm 640x360 29 │ 85.98MiB 306k https │ vp09.00.21.08 306k video only 360p, webm_dash
32633 mp4 640x360 29 10 │ ~211.74MiB 737k m3u8 │ vp09.02.30.10 737k video only
33332 webm 640x360 29 10 │ 154.75MiB 551k https │ vp09.02.30.10 551k video only 360p HDR, webm_dash
34231 mp4 854x480 29 │ ~394.27MiB 1372k m3u8 │ avc1.4D401F 1372k video only
35135 mp4 854x480 29 │ 172.61MiB 615k https │ avc1.4D401F 615k video only 480p, mp4_dash
36606 mp4 854x480 29 │ ~271.20MiB 943k m3u8 │ vp09.00.30.08 943k video only
37244 webm 854x480 29 │ 151.19MiB 538k https │ vp09.00.30.08 538k video only 480p, webm_dash
38634 mp4 854x480 29 10 │ ~362.73MiB 1262k m3u8 │ vp09.02.31.10 1262k video only
39333 webm 854x480 29 10 │ 292.98MiB 1043k https │ vp09.02.31.10 1043k video only 480p HDR, webm_dash
4022 mp4 1280x720 29 2 │ ≈383.02MiB 1332k https │ avc1.64001F mp4a.40.2 44k [ja] 720p
41232 mp4 1280x720 29 │ ~727.85MiB 2532k m3u8 │ avc1.64001F 2532k video only
42136 mp4 1280x720 29 │ 338.06MiB 1204k https │ avc1.64001F 1204k video only 720p, mp4_dash
43609 mp4 1280x720 29 │ ~506.91MiB 1763k m3u8 │ vp09.00.31.08 1763k video only
44247 webm 1280x720 29 │ 318.46MiB 1134k https │ vp09.00.31.08 1134k video only 720p, webm_dash
45635 mp4 1280x720 29 10 │ ~782.44MiB 2722k m3u8 │ vp09.02.40.10 2722k video only
46334 webm 1280x720 29 10 │ 665.27MiB 2369k https │ vp09.02.40.10 2369k video only 720p HDR, webm_dash
47270 mp4 1920x1080 29 │ ~ 1.43GiB 5100k m3u8 │ avc1.640028 5100k video only
48137 mp4 1920x1080 29 │ 744.60MiB 2652k https │ avc1.640028 2652k video only 1080p, mp4_dash
49614 mp4 1920x1080 29 │ ~813.61MiB 2830k m3u8 │ vp09.00.40.08 2830k video only
50248 webm 1920x1080 29 │ 525.06MiB 1870k https │ vp09.00.40.08 1870k video only 1080p, webm_dash
51636 mp4 1920x1080 29 10 │ ~ 1.25GiB 4439k m3u8 │ vp09.02.41.10 4439k video only
52335 webm 1920x1080 29 10 │ 1.11GiB 4031k https │ vp09.02.41.10 4031k video only 1080p HDR, webm_dash
You can pick and merge high-quality video & audio as below, but note that ffmpeg must be installed.
1yt-dlp -f 636+251 -N10 --progress "https://www.youtube.com/watch?v=xxxxxxxxx"
2
3# without ffmpeg installed you get the warning below
4WARNING: You have requested merging of multiple formats but ffmpeg is not installed. The formats won't be merged
If they end up downloaded separately, merging them with video editing software is probably the way to go.