YT-DLP the most useful command line tool for YouTube

YT-DLP has to be one of my all time favorite open-source and publically availiable command line tools for YouTube (and thousands of other video sites). This project allows users to download youtube videos or entire playlists from YouTube for whatever offline purpose. My primary use case is downloading videos for offline use primarily while flying. Despite having a fairly comprehensive github page, using yt-dlp can be obtuse at times so I've constructed a list of my favorite commands you can use quickly as a reference.

Download entire YouTube Playlist in 720p MP4 format

yt-dlp -f "bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best" --merge-output-format mp4 --yes-playlist -o "%(playlist_index)02d-%(title)s.%(ext)s" --embed-thumbnail "playlist_url_here"

Download a single YouTube video in 720p MP4 format

yt-dlp -f "bestvideo[height<=720][ext=mp4]+bestaudio[ext=m4a]/best[height<=720][ext=mp4]/best[height<=720]" --merge-output-format mp4 --embed-thumbnail --embed-metadata -o "%(title)s.%(ext)s" "video_url_here"

Download a YouTube Music video audio only in best quality MP3 format

yt-dlp -f bestaudio -x --audio-format mp3 --audio-quality 0 --embed-thumbnail --embed-metadata -o "%(title)s.%(ext)s" "video_url_here"