YTDLP¶
BL used: youtube-dl -f 'bestvideo[height<=1080]+bestaudio/best[height<=1080]’ -o '%(title)s.f%(format_id)s.%(ext)s'
Some common usage examples for yt-dlp:
Print out the available formats and information with:
yt-dlp --list-formats <video>
Print JSON information for the video and audio streams:
yt-dlp --dump-json <video>
Single video or audio downloads
Download the best format (video + audio) that is equal to or greater than 720p width. Save this file as video_id.extension (1La4QzGeaaQ.mp4):
yt-dlp -f "best[height>=720]" <video> -o '%(id)s.%(ext)s'
Download and merge the best video stream with the best audio stream:
yt-dlp -f 'bv*+ba' <video> -o '%(id)s.%(ext)s'
Download 1080p video and merge with best audio stream:
yt-dlp -f 'bv*[height=1080]+ba' <video> -o '%(id)s.%(ext)s'
Download 1080p video that is mp4 format and merge with best m4a audio format:
yt-dlp -f 'bv[height=1080][ext=mp4]+ba[ext=m4a]' --merge-output-format mp4 <video> -o '%(id)s.mp4'
Embed video thumbnail into video file use --embed-thumbnail:
yt-dlp -f 'bv[height=1080][ext=mp4]+ba[ext=m4a]' --embed-thumbnail --merge-output-format mp4 <video> -o '%(id)s.mp4'
Embed subtitles to video file (if they exist) --embed-subs :
yt-dlp -f 'bv[height=1080][ext=mp4]+ba[ext=m4a]' --embed-subs --merge-output-format mp4 <video> -o '%(id)s.mp4'
Embed metadata about the video --embed-metadata :
yt-dlp -f 'bv[height=1080][ext=mp4]+ba[ext=m4a]' --embed-metadata --merge-output-format mp4 <video> -o '%(id)s.mp4'
Get the best audio into mp3 file:
yt-dlp -f 'ba' -x --audio-format mp3 <video> -o '%(id)s.mp3'
All the options for format selection and filtering can be found here, There are a lot. Playlists
Download a YouTube playlist with the videos being 1080p and the best audio. Save into channel_id/playlist_id directory with the video added to an archive text file:
yt-dlp -f 'bv*[height=1080]+ba' --download-archive videos.txt -o '%(channel_id)s/%(playlist_id)s/%(id)s.%(ext)s'
Channels
Download an entire YouTube channel as 720p video with best audio. Save into a folder named after the channel name with the video files being the title of the video (Foo the Flowerhorn/5 Months Update – Flowerhorn Foods.webm).
yt-dlp -f 'bv*[height=720]+ba' --download-archive videos.txt