Articles & Snippets

How to Use yt-dlp to Download YouTube Videos

yt-dlp is a command line tool that downloads video and audio from YouTube and many other platforms. You control format, quality, subtitles, and file naming.

Install yt-dlp

Using pip

pip install yt-dlp

If needed:

python -m pip install yt-dlp

Basic Download

yt-dlp "VIDEO_URL"

Example:

yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"

Download Video Only

yt-dlp -f bestvideo "VIDEO_URL"

Limit to 1080p:

yt-dlp -f "bestvideo[height<=1080]" "VIDEO_URL"

Download Audio Only

yt-dlp -f bestaudio "VIDEO_URL"

Convert to MP3:

yt-dlp -x --audio-format mp3 "VIDEO_URL"

Download Video With Audio

yt-dlp -f bestvideo+bestaudio "VIDEO_URL"

Force MP4:

yt-dlp -f "bv+ba[ext=m4a]/b[ext=mp4]" "VIDEO_URL"

List Available Formats

yt-dlp -F "VIDEO_URL"

Download specific format ID:

yt-dlp -f 137 "VIDEO_URL"

Control Output File Name

Default format:

yt-dlp -o "%(title)s.%(ext)s" "VIDEO_URL"

Custom folder:

yt-dlp -o "downloads/%(title)s.%(ext)s" "VIDEO_URL"

Custom name:

yt-dlp -o "myvideo.%(ext)s" "VIDEO_URL"

Download Playlists

yt-dlp "PLAYLIST_URL"

Specific range:

yt-dlp --playlist-start 1 --playlist-end 5 "PLAYLIST_URL"

Download Subtitles

Subtitles only:

yt-dlp --write-subs --skip-download "VIDEO_URL"

Auto subtitles:

yt-dlp --write-auto-subs "VIDEO_URL"

Embed subtitles:

yt-dlp --write-subs --embed-subs "VIDEO_URL"

Download Thumbnail

yt-dlp --write-thumbnail "VIDEO_URL"

Embed thumbnail:

yt-dlp --embed-thumbnail "VIDEO_URL"

Add Metadata

yt-dlp --embed-metadata "VIDEO_URL"

Limit Download Speed

yt-dlp -r 1M "VIDEO_URL"

Resume Interrupted Download

yt-dlp -c "VIDEO_URL"

Use Proxy

yt-dlp --proxy "http://127.0.0.1:8080" "VIDEO_URL"

Download Multiple Videos From File

Create a file called urls.txt with one URL per line.

yt-dlp -a urls.txt

Common Format Selectors

  • best
  • bestvideo
  • bestaudio
  • bestvideo+bestaudio
  • worst
  • worstvideo
  • worstaudio

Best Practices

  • Check the video license
  • Only download content you have rights to
  • Use -F before selecting manual format IDs
  • Set custom file names for better organization

yt-dlp  YouTube