Skip to main content

YT-DLP Command Line Flags Reference

Overview​

This document provides a comprehensive reference of all yt-dlp command-line flags and options. This is essential for building the web UI to properly pass parameters to yt-dlp.

yt-dlp Version: Feature-rich command-line audio/video downloader
Full Documentation: https://github.com/yt-dlp/yt-dlp#readme


📋 Table of Contents​

  1. General Options
  2. Video Selection
  3. Download Options
  4. Filesystem Options
  5. Format Selection
  6. Post-Processing Options
  7. Thumbnail Options
  8. Subtitle Options
  9. Authentication Options
  10. Verbosity & Simulation
  11. Workarounds
  12. Extractor Options
  13. SponsorBlock Options

🎛️ General Options​

FlagDescription
-h, --helpPrint this help text and exit
--versionPrint program version and exit
-U, --updateUpdate this program to the latest version
--no-updateDo not check for updates (default)
--update-to [CHANNEL]@[TAG]Upgrade/downgrade to a specific version. Supported channels: stable, nightly, master
-i, --ignore-errorsIgnore download and postprocessing errors. Consider successful even if postprocessing fails
--no-abort-on-errorContinue with next video on download errors (default)
--abort-on-errorAbort downloading if an error occurs
--list-extractorsList all supported extractors and exit
--extractor-descriptionsPrint descriptions for all extractors
--simulateDo not download the video and do not write anything to disk
--no-simulateDownload the video even if printing/listing options are used

🎬 Video Selection​

FlagDescription
-I, --playlist-items ITEM_SPECComma-separated playlist indices to download. Supports ranges [START]:[STOP][:STEP]. Example: -I 1:3,7,-5::2
--min-filesize SIZEAbort download if filesize is smaller than SIZE (e.g., 50k, 44.6M)
--max-filesize SIZEAbort download if filesize is larger than SIZE
--date DATEDownload only videos uploaded on this date. Format: YYYYMMDD or `now
--datebefore DATEDownload only videos uploaded on or before this date
--dateafter DATEDownload only videos uploaded on or after this date
--match-filters FILTERGeneric video filter. Compare OUTPUT TEMPLATE fields with operators
--no-match-filtersDo not use any --match-filters (default)
--break-match-filters FILTERSame as --match-filters but stops download when video is rejected
--no-playlistDownload only the video, if URL refers to video and playlist
--yes-playlistDownload the playlist, if URL refers to video and playlist
--age-limit YEARSDownload only videos suitable for the given age
--download-archive FILEDownload only videos not listed in archive file. Record IDs of all downloaded videos
--no-download-archiveDo not use archive file (default)
--max-downloads NUMBERAbort after downloading NUMBER files
--break-on-existingStop download process when encountering file in archive
--no-break-on-existingDo not stop when encountering existing file (default)
--skip-playlist-after-errors NNumber of allowed failures until rest of playlist is skipped

📥 Download Options​

FlagDescription
-N, --concurrent-fragments NNumber of fragments of DASH/HLS video downloaded concurrently (default: 1)
-r, --limit-rate RATEMaximum download rate in bytes per second (e.g., 50K, 4.2M)
--throttled-rate RATEMinimum download rate below which throttling is assumed
-R, --retries RETRIESNumber of retries (default: 10), or "infinite"
--file-access-retries RETRIESNumber of times to retry on file access error (default: 3)
--fragment-retries RETRIESNumber of retries for a fragment (default: 10)
--retry-sleep [TYPE:]EXPRTime to sleep between retries in seconds
--skip-unavailable-fragmentsSkip unavailable fragments for DASH, hlsnative, ISM (default)
--abort-on-unavailable-fragmentsAbort download if fragment unavailable
--keep-fragmentsKeep downloaded fragments on disk after download
--no-keep-fragmentsDelete fragments after download (default)
--buffer-size SIZESize of download buffer (default: 1024)
--resize-bufferAutomatically resize buffer from initial value
--playlist-randomDownload playlist videos in random order
--lazy-playlistProcess playlist entries as they are received
--no-lazy-playlistProcess videos after entire playlist is parsed (default)
--hls-use-mpegtsUse mpegts container for HLS videos (default for live streams)
--no-hls-use-mpegtsDo not use mpegts container
--download-sections REGEXDownload only chapters matching regular expression
--downloader [PROTO:]NAMEName of external downloader (native, aria2c, axel, curl, ffmpeg, httpie, wget)
--downloader-args NAME:ARGSGive arguments to external downloader

📁 Filesystem Options​

FlagDescription
-a, --batch-file FILEFile containing URLs to download (one per line). Use "-" for stdin
--no-batch-fileDo not read URLs from batch file (default)
-P, --paths [TYPES:]PATHPaths where files should be downloaded. Supports "home" and "temp" types
-o, --output [TYPES:]TEMPLATEOutput filename template. See OUTPUT TEMPLATE section
--output-na-placeholder TEXTPlaceholder for unavailable fields in --output (default: "NA")
--restrict-filenamesRestrict filenames to ASCII characters, avoid "&" and spaces
--no-restrict-filenamesAllow Unicode characters, "&" and spaces (default)
--windows-filenamesForce filenames to be Windows-compatible
--no-windows-filenamesSanitize filenames minimally (default)
--trim-filenames LENGTHLimit filename length (excluding extension)
-w, --no-overwritesDo not overwrite any files
--force-overwritesOverwrite all video and metadata files (includes --no-continue)
--no-force-overwritesDo not overwrite video, but overwrite related files (default)
-c, --continueResume partially downloaded files/fragments (default)
--no-continueDo not resume partially downloaded fragments
--partUse .part files instead of writing directly into output file (default)
--no-partDo not use .part files - write directly into output file
--mtimeUse Last-modified header to set file modification time
--no-mtimeDo not use Last-modified header (default)
--write-descriptionWrite video description to .description file
--no-write-descriptionDo not write video description (default)
--write-info-jsonWrite video metadata to .info.json file
--no-write-info-jsonDo not write video metadata (default)
--write-playlist-metafilesWrite playlist metadata with --write-info-json (default)
--no-write-playlist-metafilesDo not write playlist metadata
--clean-info-jsonRemove internal metadata from infojson (default)
--no-clean-info-jsonWrite all fields to infojson
--write-commentsRetrieve video comments for infojson
--no-write-commentsDo not retrieve comments
--load-info-json FILEJSON file containing video information (created with --write-info-json)
--cookies FILENetscape formatted file to read cookies from
--no-cookiesDo not read/dump cookies from/to file (default)
--cookies-from-browser BROWSERLoad cookies from browser (brave, chrome, chromium, edge, firefox, opera, safari, vivaldi, whale)
--no-cookies-from-browserDo not load cookies from browser (default)
--cache-dir DIRLocation for yt-dlp cache files (default: ${XDG_CACHE_HOME}/yt-dlp)
--no-cache-dirDisable filesystem caching
--rm-cache-dirDelete all filesystem cache files

🎨 Format Selection​

FlagDescription
-f, --format FORMATVideo format code. See FORMAT SELECTION for details
-S, --format-sort SORTORDERSort formats by given fields
--format-sort-resetDisregard previous user specified sort order
--format-sort-forceForce user specified sort order to have precedence
--no-format-sort-forceSome fields have precedence over user sort (default)
--video-multistreamsAllow multiple video streams to be merged
--no-video-multistreamsOnly one video stream per output file (default)
--audio-multistreamsAllow multiple audio streams to be merged
--no-audio-multistreamsOnly one audio stream per output file (default)
--prefer-free-formatsPrefer video formats with free containers
--no-prefer-free-formatsDon't give preference to free containers (default)
--check-formatsMake sure formats are selected from downloadable ones
--check-all-formatsCheck all formats for downloadability
--no-check-formatsDon't check formats (default)
-F, --list-formatsList available formats of each video
--merge-output-format FORMATContainers for merging formats (avi, flv, mkv, mov, mp4, webm)

Common Format Codes​

CodeDescription
bestBest video available
bestaudioBest audio available
w*WebM format
mp4*MP4 format
10801080p resolution
720720p resolution
540540p resolution
baBest audio
bv*Best video
b*Any video
a*Any audio
bestvideo+bestaudioBest video + best audio merged
bestvideo/bestBest video or best available

🎵 Post-Processing Options​

FlagDescription
-x, --extract-audioConvert video files to audio-only files (requires ffmpeg)
--audio-format FORMATFormat to convert audio to when -x is used (best, aac, alac, flac, m4a, mp3, opus, vorbis, wav)
--audio-quality QUALITYSpecify ffmpeg audio quality (0=best to 10=worst for VBR, or bitrate like 128K). Default: 5
--remux-video FORMATRemux video into another container (avi, flv, gif, mkv, mov, mp4, webm, aac, flac, m4a, mka, mp3, ogg, opus, vorbis, wav)
--recode-video FORMATRe-encode video into another format if necessary
--postprocessor-args NAME:ARGSGive arguments to postprocessors. Supported: Merger, ModifyChapters, SplitChapters, ExtractAudio, VideoRemuxer, VideoConvertor, Metadata, EmbedSubtitle, EmbedThumbnail, SubtitlesConvertor, ThumbnailsConvertor, FixupStretched, FixupM4a, FixupM3u8, FixupTimestamp, FixupDuration
-k, --keep-videoKeep intermediate video file on disk after post-processing
--no-keep-videoDelete intermediate video file (default)
--post-overwritesOverwrite post-processed files (default)
--no-post-overwritesDo not overwrite post-processed files
--embed-subsEmbed subtitles in video (only for mp4, webm, mkv)
--no-embed-subsDo not embed subtitles (default)
--embed-thumbnailEmbed thumbnail in video as cover art
--no-embed-thumbnailDo not embed thumbnail (default)
--embed-metadataEmbed metadata to video file (Alias: --add-metadata)
--no-embed-metadataDo not add metadata (default)
--embed-chaptersAdd chapter markers to video file (Alias: --add-chapters)
--no-embed-chaptersDo not add chapter markers (default)
--embed-info-jsonEmbed infojson as attachment to mkv/mka files
--no-embed-info-jsonDo not embed infojson
--parse-metadata [WHEN:]FROM:TOParse additional metadata like title/artist from other fields
--replace-in-metadata [WHEN:]FIELDS REGEX REPLACEReplace text in metadata field using regex
--xattrsWrite metadata to video file's xattrs
--concat-playlist POLICYConcatenate videos in playlist (never, always, multi_video). Default: multi_video
--fixup POLICYAutomatically correct known faults (never, warn, detect_or_warn, force). Default: detect_or_warn
--ffmpeg-location PATHLocation of ffmpeg binary
--exec [WHEN:]CMDExecute a command after download
--no-execRemove any previously defined --exec
--convert-subs FORMATConvert subtitles to another format (ass, lrc, srt, vtt). Use "none" to disable
--convert-thumbnails FORMATConvert thumbnails (jpg, png, webp). Use "none" to disable
--split-chaptersSplit video into multiple files based on chapters
--no-split-chaptersDo not split based on chapters (default)
--remove-chapters REGEXRemove chapters whose title matches regex
--no-remove-chaptersDo not remove chapters (default)
--force-keyframes-at-cutsForce keyframes at cuts (slow, requires re-encode)
--no-force-keyframes-at-cutsDo not force keyframes (default)
--use-postprocessor NAME[:ARGS]Enable plugin postprocessors with optional arguments

MP3 Conversion Examples​

# Basic MP3 conversion
yt-dlp -x --audio-format mp3 URL

# High quality MP3 (320kbps)
yt-dlp -x --audio-format mp3 --audio-quality 0 URL

# Standard quality MP3 (128kbps)
yt-dlp -x --audio-format mp3 --audio-quality 4 --postprocessor-args ExtractAudio:ffmpeg:-b:a 128k URL

🖼️ Thumbnail Options​

FlagDescription
--write-thumbnailWrite thumbnail image to disk
--no-write-thumbnailDo not write thumbnail image (default)
--write-all-thumbnailsWrite all thumbnail image formats to disk
--list-thumbnailsList available thumbnails of each video

📝 Subtitle Options​

FlagDescription
--write-subsWrite subtitle file
--no-write-subsDo not write subtitle file (default)
--write-auto-subsWrite automatically generated subtitle file (Alias: --write-automatic-subs)
--no-write-auto-subsDo not write auto-generated subtitles (default)
--list-subsList available subtitles of each video
--sub-format FORMATSubtitle format preference separated by "/", e.g., "srt" or "ass/srt/best"
--sub-langs LANGSLanguages of subtitles to download (can be regex or "all"). Use "-" to exclude. Example: --sub-langs "en.*,ja"

🔐 Authentication Options​

FlagDescription
-u, --username USERNAMELogin with this account ID
-p, --password PASSWORDAccount password. If omitted, yt-dlp will ask interactively
-2, --twofactor TWOFACTORTwo-factor authentication code
-n, --netrcUse .netrc authentication data
--netrc-location PATHLocation of .netrc authentication data
--netrc-cmd NETRC_CMDCommand to execute to get credentials
--video-password PASSWORDVideo-specific password
--ap-mso MSOAdobe Pass multiple-system operator (TV provider) identifier
--ap-username USERNAMEMultiple-system operator account login
--ap-password PASSWORDMultiple-system operator account password
--ap-list-msoList all supported multiple-system operators
--client-certificate CERTFILEPath to client certificate file in PEM format
--client-certificate-key KEYFILEPath to private key file
--client-certificate-password PASSWORDPassword for client certificate private key

🔊 Verbosity & Simulation​

FlagDescription
-q, --quietActivate quiet mode
--no-quietDeactivate quiet mode (Default)
--no-warningsIgnore warnings
-s, --simulateDo not download, do not write to disk
--no-simulateDownload even if printing/listing (default)
--ignore-no-formats-errorIgnore "No video formats" error
--no-ignore-no-formats-errorThrow error when no formats found (default)
--skip-downloadDo not download but write all related files (Alias: --no-download)
-O, --print [WHEN:]TEMPLATEPrint field name or output template to screen
-j, --dump-jsonQuiet, print JSON information for each video
-J, --dump-single-jsonQuiet, print JSON for each URL or infojson
--newlineOutput progress bar as new lines
--no-progressDo not print progress bar
--progressShow progress bar, even if in quiet mode
--console-titleDisplay progress in console titlebar
--progress-template [TYPES:]TEMPLATETemplate for progress outputs
--progress-delta SECONDSTime between progress output (default: 0)
-v, --verbosePrint various debugging information
--dump-pagesPrint downloaded pages encoded using base64
--write-pagesWrite downloaded pages to files
--print-trafficDisplay sent and read HTTP traffic

🛠️ Workarounds​

FlagDescription
--encoding ENCODINGForce the specified encoding (experimental)
--legacy-server-connectAllow HTTPS connection to servers without RFC 5746 support
--no-check-certificatesSuppress HTTPS certificate validation
--prefer-insecureUse unencrypted connection
--add-headers FIELD:VALUESpecify custom HTTP header
--bidi-workaroundWork around terminals lacking bidirectional text support
--sleep-requests SECONDSSeconds to sleep between requests during extraction
--sleep-interval SECONDSSeconds to sleep before each download (Alias: --min-sleep-interval)
--max-sleep-interval SECONDSMaximum seconds to sleep. Use with --min-sleep-interval
--sleep-subtitles SECONDSSeconds to sleep before each subtitle download

📺 Extractor Options​

FlagDescription
--extractor-retries RETRIESRetries for known extractor errors (default: 3)
--allow-dynamic-mpdProcess dynamic DASH manifests (default)
--ignore-dynamic-mpdDo not process dynamic DASH manifests
--hls-split-discontinuitySplit HLS playlists at discontinuities (ad breaks)
--no-hls-split-discontinuityDo not split HLS playlists (default)
--extractor-args IE_KEY:ARGSPass arguments to specific extractor

🎁 SponsorBlock Options​

FlagDescription
--sponsorblock-mark CATSCreate chapters for SponsorBlock categories (sponsor, intro, outro, selfpromo, preview, filler, interaction, music_offtopic, hook, poi_highlight, chapter, all, default). Separate by commas
--sponsorblock-remove CATSRemove SponsorBlock categories from video file
--sponsorblock-chapter-title TEMPLATETemplate for SponsorBlock chapter titles. Fields: start_time, end_time, category, categories, name, category_names
--no-sponsorblockDisable both mark and remove
--sponsorblock-api URLSponsorBlock API location (default: https://sponsor.ajay.app)

📚 Output Template​

The -o or --output option uses templates to define output filenames. Available fields:

Video Fields​

  • %(title)s - Video title
  • %(uploader)s - Channel name
  • %(upload_date)s - Upload date (YYYYMMDD)
  • %(id)s - Video ID
  • %(duration)s - Duration in seconds
  • %(ext)s - File extension
  • %(format_id)s - Format ID
  • %(resolution)s - Resolution (e.g., 1080p)
  • %(fps)s - Frames per second
  • %(filesize)s - File size in bytes
  • %(timestamp)s - Video timestamp

Example Output Templates​

# Default template
-o "%(uploader)s/%(title)s.%(ext)s"

# With date and ID
-o "%(upload_date)s/%(id)s - %(title)s.%(ext)s"

# For MP3 conversion
-o "%(uploader)s/%(title)s.%(audio_ext)s"

# Playlist with counter
-o "%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s"

# Restricted filenames (ASCII only)
-o "%(uploader)s/%(title)s.%(ext)s" --restrict-filenames

🎯 Preset Aliases​

yt-dlp provides preset aliases for convenience:

AliasDescription
-t mp3Download as MP3 (best quality)
-t aacDownload as AAC audio
-t mp4Download as MP4 with best video quality
-t mkvDownload as MKV container
-t sleepAdd sleep intervals between downloads

Example: MP3 Preset​

yt-dlp -t mp3 -o "%(title)s.%(ext)s" URL
# Equivalent to:
yt-dlp -f 'ba[acodec^=mp3]/ba/b' -x --audio-format mp3 -o "%(title)s.%(ext)s" URL

💡 Quick Reference for Web UI​

For Single Video Download (Best Quality)​

yt-dlp -f best -o "downloads/%(title)s.%(ext)s" URL

For Playlist Download​

yt-dlp --yes-playlist -f best -o "downloads/%(playlist)s/%(title)s.%(ext)s" URL

For MP3 Conversion​

yt-dlp -x --audio-format mp3 --audio-quality 5 -o "downloads/%(title)s.%(ext)s" URL

For High Quality MP3 (320kbps)​

yt-dlp -x --audio-format mp3 --audio-quality 0 -o "downloads/%(title)s.%(ext)s" URL

For Video + Audio (Merge)​

yt-dlp -f "bestvideo+bestaudio/best" --merge-output-format mp4 -o "downloads/%(title)s.%(ext)s" URL

🔧 Environment Variables​

yt-dlp also respects these environment variables:

VariableDescription
YTDLP_VERBOSESet to "1" for verbose output
YTDLP_QUIETSet to "1" for quiet mode
YTDLP_NO_CACHE_DIRDisable caching

📖 Additional Resources​


Last Updated: 2024
Document Version: 1.0