πŸŒ™ β˜€οΈ

The yt-dlp Guide

Everything you need to master the most powerful media downloader. Interactive examples, a command builder, and a full reference β€” all in one place.

⚑

Installation

yt-dlp is a feature-rich command-line audio/video downloader forked from youtube-dl. It supports thousands of sites and is actively maintained.

Windows β€” winget / scoop
# Using winget (built-in on Windows 10+)
winget install yt-dlp

# Or using Scoop
scoop install yt-dlp

# Or download the .exe from GitHub Releases
# https://github.com/yt-dlp/yt-dlp/releases/latest
macOS β€” Homebrew
brew install yt-dlp
Linux
# Package manager
sudo apt install yt-dlp        # Debian/Ubuntu
sudo pacman -S yt-dlp           # Arch
sudo dnf install yt-dlp         # Fedora

# Or download the binary directly
sudo curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp
sudo chmod a+rx /usr/local/bin/yt-dlp
pip (cross-platform)
pip install yt-dlp

# Update later:
pip install -U yt-dlp

# Or using pipx for isolated install:
pipx install yt-dlp
πŸ’‘
Recommended: Also install ffmpeg β€” yt-dlp uses it for merging video+audio, converting formats, and embedding metadata. Install via brew install ffmpeg, winget install ffmpeg, or sudo apt install ffmpeg.
Verify installation
yt-dlp --version
yt-dlp -U              # Update to latest version
β–Ά

Basic Usage

The simplest command is just yt-dlp URL. By default it downloads the best quality available.

πŸ’‘
Key concept: YouTube serves video and audio as separate streams. yt-dlp automatically merges the best video + best audio. The -F flag shows all streams individually. Use -f (lowercase) to select specific ones.
Simulate / preview
yt-dlp -s "URL"            # Simulate (no download)
yt-dlp --print filename "URL" # Show what file would be created
yt-dlp -j "URL"            # Print full JSON metadata
🎞

Formats & Quality

The -f flag is your primary tool for controlling download quality. This is what you'll use most often.

Format Selection Syntax

SyntaxDescription
bestBest single file (video+audio combined)
bestvideo+bestaudioBest separate streams, merged (default)
worstLowest quality single file
bestaudioBest audio-only stream
[height<=720]Filter: max 720p height
[ext=mp4]Filter: only mp4 container
[fps<=30]Filter: max 30fps
[vcodec^=avc1]Filter: H.264 video codec
[filesize<50M]Filter: file under 50MB
f1/f2Fallback: try f1 first, then f2
Advanced format combos
# Prefer H.264 codec (better device compatibility)
yt-dlp -f "bestvideo[vcodec^=avc1]+bestaudio/best" "URL"

# Prefer AV1 codec (better quality-to-size)
yt-dlp -f "bestvideo[vcodec^=av01]+bestaudio/best" "URL"

# Best quality under 100MB
yt-dlp -f "best[filesize<100M]" "URL"

# 60fps preferred
yt-dlp -f "bestvideo[fps>=50]+bestaudio/best" "URL"
⚠️
Note: The /best at the end is a fallback β€” if no separate streams match, it'll try a single pre-merged file. Always add this to avoid errors.
🎡

Audio Extraction

Extract just the audio track from any video. Perfect for music, podcasts, and lectures.

πŸ’‘
Pro tip: YouTube audio is usually Opus or AAC. Using --audio-format m4a or opus avoids re-encoding and keeps original quality.
πŸ“

Output & Naming

Control where files are saved and how they're named using the -o template system.

Template Variables

VariableDescriptionExample
%(title)sVideo titleMy Video
%(id)sVideo IDdQw4w9WgXcQ
%(ext)sFile extensionmp4
%(uploader)sUploader nameRick Astley
%(channel)sChannel nameRick Astley
%(upload_date)sUpload date20091025
%(upload_date>%Y)sUpload year2009
%(resolution)sResolution1920x1080
%(duration)sDuration (seconds)212
%(playlist)sPlaylist nameMy Playlist
%(playlist_index)sIndex in playlist1, 2, 3…
Safe filenames
yt-dlp --restrict-filenames -o "%(title)s.%(ext)s" "URL"
# Replaces spaces β†’ underscores, removes special chars
πŸ“‹

Playlists & Channels

Channel downloads
# All videos from channel
yt-dlp "https://www.youtube.com/@ChannelName/videos"

# Only after a date
yt-dlp --dateafter 20240101 "CHANNEL_URL"

# Date range
yt-dlp --dateafter 20240601 --datebefore 20241231 "CHANNEL_URL"

# Skip already-downloaded (essential for recurring runs)
yt-dlp --download-archive archive.txt "CHANNEL_URL"
πŸ’‘
Archive mode: --download-archive archive.txt saves video IDs to a file. Future runs skip already-downloaded videos. Essential for scheduled downloads.
Playlist control
# Don't download playlist when URL has &list= param
yt-dlp --no-playlist "URL_WITH_PLAYLIST_PARAM"

# Force treat URL as playlist
yt-dlp --yes-playlist "URL"
πŸ’¬

Subtitles

πŸ”’

Authentication

Access age-restricted, members-only, or private content.

Username & password
yt-dlp -u USERNAME -p PASSWORD "URL"
πŸš€

Speed & Network

Speed and connection options
# Limit speed
yt-dlp -r 5M "URL"             # Max 5 MB/s

# Multiple connections (faster!)
yt-dlp -N 4 "URL"               # 4 concurrent fragments

# Proxy
yt-dlp --proxy socks5://127.0.0.1:1080 "URL"

# Geo-bypass
yt-dlp --geo-bypass-country US "URL"

# Retry on failure
yt-dlp --retries 10 --fragment-retries 10 "URL"

# Resume partial download
yt-dlp -c "URL"
πŸ’‘
Speed boost: -N 4 downloads 4 fragments at a time β€” dramatically faster for long videos.
πŸ”§

Post-Processing

Convert & split
# Re-encode to MP4
yt-dlp --recode-video mp4 "URL"

# Merge output to specific container
yt-dlp --merge-output-format mkv "URL"

# Split by chapters
yt-dlp --split-chapters "URL"

# Split with naming
yt-dlp --split-chapters -o "chapter:%(section_title)s.%(ext)s" "URL"
πŸ“¦

Batch Downloads

Filter by metadata
# Only videos under 10 minutes
yt-dlp --match-filter "duration < 600" "PLAYLIST"

# Only 1M+ views
yt-dlp --match-filter "view_count >= 1000000" "CHANNEL"

# Skip live streams
yt-dlp --match-filter "!is_live" "CHANNEL"

# Title contains keyword
yt-dlp --match-filter "title ~= 'tutorial'" "CHANNEL"
🏷

Metadata & Thumbnails

Embed metadata and thumbnails
yt-dlp --embed-metadata "URL"       # Embed tags
yt-dlp --embed-thumbnail "URL"      # Embed cover art
yt-dlp --write-thumbnail "URL"      # Save thumbnail file
yt-dlp --write-description "URL"    # Save description
yt-dlp --write-comments "URL"      # Save comments (JSON)
yt-dlp --write-info-json "URL"     # Save all metadata

# Full music archival combo
yt-dlp -x --audio-format mp3 --embed-metadata --embed-thumbnail "URL"
βš™οΈ

Config Files

Tired of typing the same flags every time? A config file saves your preferred settings so yt-dlp uses them automatically. You create it once, and every future download uses your defaults. Here's exactly how to set it up.

Step 1 β€” Create the config folder and file
# Run these two commands in Terminal, one at a time:

# 1. Create the config folder
mkdir -p $HOME/.config/yt-dlp

# 2. Open the config file in the nano text editor
#    (this creates the file if it doesn't exist)
nano $HOME/.config/yt-dlp/config
πŸ’‘
What is nano? It's a simple text editor that runs inside your Terminal. Once it opens, you'll see a blank screen with controls at the bottom. You can type or paste text directly into it.
Step 1 β€” Create the config folder and file
# Run these in Command Prompt or PowerShell, one at a time:

# 1. Create the config folder
mkdir %APPDATA%\yt-dlp

# 2. Open the config file in Notepad
#    (click "Yes" if it asks to create a new file)
notepad %APPDATA%\yt-dlp\config.txt
Step 2 β€” Paste these defaults into the editor
# Copy everything below and paste it into nano / Notepad.
# Remove or add lines to suit your needs.
# Lines starting with # are comments and are ignored.

# Save videos to your Downloads folder
--output ~/Downloads/%(title)s.%(ext)s

# Always output as MP4
--merge-output-format mp4

# Embed metadata (title, artist, date) into the file
--embed-metadata

# Embed the video thumbnail as cover art
--embed-thumbnail

# Download and embed English subtitles
--embed-subs
--sub-langs en

# Skip videos you've already downloaded
--download-archive ~/.config/yt-dlp/archive.txt

# Use 4 connections for faster downloads
--concurrent-fragments 4

# Remove special characters from filenames
--restrict-filenames
⚠️
Windows users: Change the ~/Downloads/ path to C:/Users/YourName/Downloads/ and the archive path to %APPDATA%/yt-dlp/archive.txt in the config above.
Step 3 β€” Save and close the file
# macOS/Linux (nano editor):
#   1. Press  Ctrl + X   (exit)
#   2. Press  Y           (yes, save changes)
#   3. Press  Enter       (confirm the filename)
#
# You'll see something like:
#   File Name to Write: /Users/you/.config/yt-dlp/config
#   Just press Enter β€” that's the correct path.
#
# Windows (Notepad):
#   Just press Ctrl + S to save, then close Notepad.
πŸ’‘
That's it! From now on, every time you run yt-dlp "URL", all your defaults apply automatically. No extra flags needed β€” just paste a URL and go.
Step 4 β€” Test it and learn overrides
# Just run this β€” your config defaults apply automatically:
yt-dlp "https://www.youtube.com/watch?v=VIDEO_ID"

# You can still add extra flags on top of your defaults:
yt-dlp -f "bestvideo[height<=720]+bestaudio" "URL"

# Need to ignore your config for one download?
yt-dlp --ignore-config "URL"

# Want to use a completely different config file?
yt-dlp --config-location /path/to/other-config.txt "URL"

# To edit your config later, just run the nano command again:
nano $HOME/.config/yt-dlp/config
πŸ› 

Command Builder

Interactive Command Builder

Select your options and get a ready-to-use command.

βœ“ Audio Only (MP3)
βœ“ Embed Metadata
βœ“ Embed Thumbnail
βœ“ Subtitles
βœ“ Fast (4 threads)
βœ“ Safe Filenames
βœ“ Chrome Cookies
βœ“ Archive Mode
yt-dlp "URL"
πŸ“–

Quick Reference

FlagDescriptionCategory
-FList available formatsFormats
-f FORMATSelect format / qualityFormats
--merge-output-formatContainer for merged outputFormats
--recode-videoRe-encode video to formatFormats
-xExtract audio onlyAudio
--audio-formatAudio format (mp3, m4a, opus…)Audio
--audio-qualityAudio quality (0=best, or bitrate)Audio
-o TEMPLATEOutput filename templateOutput
-P DIRDownload directory pathOutput
--restrict-filenamesSafe characters onlyOutput
--write-subsDownload subtitlesSubtitles
--write-auto-subsDownload auto-generated subsSubtitles
--sub-langs LANGSubtitle language(s)Subtitles
--embed-subsEmbed subs in videoSubtitles
--list-subsList available subtitlesSubtitles
-a FILEBatch file of URLsBatch
-I RANGEPlaylist item rangePlaylist
--no-playlistSingle video onlyPlaylist
--download-archiveSkip already-downloadedPlaylist
--dateafter DATEVideos after dateFilter
--match-filterFilter by metadataFilter
--embed-metadataEmbed metadata tagsMetadata
--embed-thumbnailEmbed thumbnail artMetadata
--write-thumbnailSave thumbnail fileMetadata
--cookies-from-browserUse browser cookiesAuth
-N NUMConcurrent fragmentsNetwork
-r RATELimit download rateNetwork
--proxy URLUse proxy serverNetwork
--download-sectionsDownload time rangePost-process
--split-chaptersSplit by chaptersPost-process
-sSimulate (no download)Info
-jPrint JSON metadataInfo
-UUpdate yt-dlpSystem
-vVerbose outputSystem
🩺

Troubleshooting

"ERROR: Unable to extract" or 403 Forbiddenβ–Ό

Usually means yt-dlp is outdated.

Fix
yt-dlp -U
# If still failing, try cookies:
yt-dlp --cookies-from-browser chrome "URL"
"Requested format not available"β–Ό

The specified format isn't available. Check formats first.

Fix
yt-dlp -F "URL"  # Check what's available
# Always add /best fallback:
yt-dlp -f "bestvideo[height<=1080]+bestaudio/best" "URL"
"ffmpeg not found" β€” video/audio won't mergeβ–Ό
Fix
brew install ffmpeg         # macOS
winget install ffmpeg       # Windows
sudo apt install ffmpeg     # Linux

# Or point to ffmpeg location:
yt-dlp --ffmpeg-location /path/to/ffmpeg "URL"
Slow download speedsβ–Ό
Fix
yt-dlp -N 4 "URL"  # Concurrent fragments
yt-dlp --cookies-from-browser chrome "URL"  # Avoid throttling
Age-restricted or members-only contentβ–Ό
Fix
# Must be logged in to the site in your browser
yt-dlp --cookies-from-browser chrome "URL"
Non-YouTube sites (Twitter, Instagram, Vimeo…)β–Ό

yt-dlp supports 1000+ sites. Same commands work everywhere.

Examples
yt-dlp "https://vimeo.com/12345678"
yt-dlp "https://x.com/user/status/123456"
yt-dlp --cookies-from-browser chrome "https://instagram.com/p/ABC123"
yt-dlp "https://reddit.com/r/sub/comments/xyz/title"
yt-dlp -x "https://soundcloud.com/artist/track"

# List all supported sites:
yt-dlp --list-extractors