yt-dlp is a powerful linux command that I use often to download Youtube video files.
By default yt-dlp will download the video file with the highest quality/resolution. This has posed some problems for me as my computer is a bit out-dated (Intel i5-7400 CPU) and slightly sluggish in playing videos with resolution higher than 4K (3840x2160). As 4K Youtube videos are more more common nowadays, I often need to find a way to download a lower resolution version of the 4K videos. 4K video Downloader is good solution but it allows only a few downloads for free.
To download a specific version of a Youtube video file using yt-dlp is actually not very difficult. The process involves listing the available formats (on a monitor) and then choosing the desired one with specific command. But before that, you need to ensure that "ffmpeg" is installed on your computer for merging video and audio files.
For Arch or Arch-based Distros, you can use this command to check the presence of ffmpeg,:
ffmpeg -version
The following shows that ffmpeg is present on my computer.
![]() |
Steps to Download a Specific Version
1. List Available Formats
Use the command below to see all available formats for the video:
yt-dlp -F <video_url>
For example: yt-dlp -F https://www.youtube.com/watch?v=5NY5M8KBQJ8
will give the following result, which shows a long list of available versions of the video to be downloaded:
There are many ways to download Specific Format.
You may download by Format Code: e.g., 229 (from the above diagram), and then use the following command line to download:
yt-dlp -f 229 <video_url>
You may also download it with a specific resolution (e.g., 720p):
yt-dlp -f "best[height=720]" <video_url>
If you are looking for the best MP4 format, you may use this command:
yt-dlp -f mp4 <video_url>
For best video and audio (requires Ffmpeg), you may use:
yt-dlp -f "bestvideo+bestaudio" <video_url>
Note, the above methods may sometimes result in getting videos without sound!
To play safe, I usually use the following command line which will combine Video and Audio with Specific Criteria:
yt-dlp -f "bv*[height=720]+ba" <video_url>
which will download the best 720p video with the best audio.
Here, bv* means best video, [height=720] filters for 720p, and +ba adds the best audio.
The following is what I used to download the 1080p version the 4K file:
[4K] 역사적인 한일 합동 공연, 말러 교향곡 제1번 '거인' ⧸ 정명훈 지휘 G. Mahler, Symphony No.1 'Titan' [5NY5M8KBQJ8].webm
yt-dlp -f "bv*[height=1080]+ba" https://www.youtube.com/watch?v=5NY5M8KBQJ8
沒有留言:
張貼留言