Skip to content

Instantly share code, notes, and snippets.

@lacafjh
Created July 12, 2022 06:09
Show Gist options
  • Save lacafjh/ab2e148c163efbeada698888dfe857bb to your computer and use it in GitHub Desktop.
Save lacafjh/ab2e148c163efbeada698888dfe857bb to your computer and use it in GitHub Desktop.
YT-DLP configuration
# Do not read configuration files. When given in the global configuration file /etc/youtube-dl.conf:
# Do not read the user configuration in ~/.config/youtube-dl/config (%APPDATA%/youtube-dl/config.txt on Windows)
# --ignore-config
#=========================================General Options==============================================
# Continue on download errors, for example to skip unavailable videos in a playlist
--ignore-errors
#=========================================Network Options==============================================
# Use the specified HTTP/HTTPS/SOCKS proxy. To enable SOCKS proxy, specify a proper scheme.
# For example socks5://127.0.0.1:1080/. Pass in an empty string (--proxy "") for direct connection
#--proxy socks5://IP:port
--proxy http://IP:port
# --socket-timeout SECONDS Time to wait before giving up, in seconds
--socket-timeout 10
#-4, --force-ipv4 Make all connections via IPv4
#-6, --force-ipv6 Make all connections via IPv6
#=========================================Video Selection==============================================
# !!All options in this section are only available in yt-dlc
# Use this proxy to verify the IP address for some geo-restricted sites. The default proxy specified
# by --proxy (or none, if the option is not present) is used for the actual downloading
# --geo-verification-proxy URL
# Bypass geographic restriction via faking X-Forwarded-For HTTP header
--geo-bypass
#=========================================Video Selection==============================================
# --download-archive FILE Download only videos not listed in the archive file. Record the IDs of all downloaded videos in it.
--download-archive '%APPDATA%/yt-dlp/archive.csv'
# --download-archive './archive.csv'
#=========================================Download Options==============================================
#-r, --limit-rate RATE Maximum download rate in bytes per second (e.g. 50K or 4.2M)
#--fragment-retries RETRIES Number of retries for a fragment (default is 10), or "infinite" (DASH, hlsnative and ISM)
# Number of retries (default is 10), or "infinite".
--retries infinite
#--buffer-size SIZE Size of download buffer (e.g. 1024 or 16K) (default is 1024)
#--hls-use-mpegts Use the mpegts container for HLS videos, allowing to play the video while downloading (some players may not be able to play it)
# Download playlist videos in reverse/default order. Behaves differently according to issue #302.
# --playlist-reverse Download playlist videos in reverse order
# --no-playlist-reverse Download playlist videos in default order (default)
# !!Options below in this section are only available in yt-dlc
# Number of fragments of a dash/hlsnative video that should be download concurrently (default is 1)
# --concurrent-fragments N
# Name or path of the external downloader to use (optionally) prefixed by the protocols (http, ftp,
# m3u8, dash, rstp, rtmp, mms) to use it for. Currently supports native, aria2c, avconv, axel, curl,
# ffmpeg, httpie, wget (Recommended: aria2c). You can use this option multiple times to set different
# downloaders for different protocols. For example, --downloader aria2c --downloader "dash,m3u8:native"
# will use aria2c for http/ftp downloads, and the native downloader for dash/m3u8 downloads
# (Alias in yt-dlp and substitute in youtube-dl: --external-downloader)
# --downloader [PROTO:]NAME
# --external-downloader aria2c
--downloader aria2c
# Give these arguments to the external downloader. Specify the downloader name and the arguments
# separated by a colon ":". For ffmpeg, arguments can be passed to different positions using the
# same syntax as --postprocessor-args. You can use this option multiple times to give different
# arguments to different downloaders
# (Alias in yt-dlp and substitute in youtube-dl: --external-downloader-args)
# --downloader-args [NAME:]ARGS
# --external-downloader-args "--all-proxy=http://IP:port --file-allocation=prealloc -s -j 16 -x 16 -k 1M"
# --downloader-args "aria2c:--console-log-level=notice --summary-interval=60 --all-proxy=http://IP:port"
--downloader-args "aria2c:--file-allocation=falloc --remote-time=true --max-tries=0 -c -x16 -j16 -s25 -k1M --all-proxy=http://IP:port"
# --downloader-args "aria2c:--conf-path='C:\YOUT\ARIA2\CONF\PATH\aria2_4_yt-dlp.conf'"
# !!Options below in this section are not recommended in yt-dlc
# since there are other alternatives to achieve the same
# --hls-prefer-native --downloader "m3u8:native"
# --hls-prefer-ffmpeg --downloader "m3u8:ffmpeg"
#=========================================Filesystem Options==============================================
#-a, --batch-file FILE File containing URLs to download ('-' for stdin), one URL per line. Lines starting with '#', ';' or ']' are considered as comments and ignored.
# The paths where the files should be downloaded. This option is ignored if --output is an absolute path
# -P, --paths [TYPES:]PATH
#-o, --output [TYPES:]TEMPLATE Output filename template, see the "OUTPUT TEMPLATE" for all the info
# -o '%(uploader)s (%(uploader_id)s)/%(upload_date)s - %(title)s - (%(duration)ss) [%(resolution)s] [%(id)s].%(ext)s'
-o '%(uploader)s (%(uploader_id)s)/(%(n_entries+1-playlist_index)d_%(n_entries)d) %(upload_date)s - %(title)s - (%(duration)ss) [%(resolution)s] [%(id)s].%(ext)s'
# Do not overwrite files
#-w, --no-overwrites
#-c, --continue Force resume of partially downloaded files. By default, youtube-dl will resume downloads if possible.
#--continue
# Write video description to a .description file
--write-description
# Write video metadata to a .info.json file (this may contain personal information)
--write-info-json
# Write video annotations to a .annotations.xml file
# YouTube removed all video annotations on January 15th, 2019
#--write-annotations
# JSON file containing the video information (created with the "--write-info-json" option)
# --load-info-json FILE
#--cookies FILE File to read cookies from and dump cookie jar in
#--cookies %APPDATA%/youtube-dl/cookie_U2B.txt
#--cache-dir DIR Location in the filesystem where youtube-dl can store some downloaded information permanently.
# By default $XDG_CACHE_HOME/youtube-dl or ~/.cache/youtube-dl . At the moment, only YouTube player files (for videos with obfuscated signatures) are cached, but that may change.
# !!Options below in this section are only available in yt-dlc
# Use the Last-modified header to set the file modification time (default)
--mtime
# Write playlist metadata in addition to the video metadata when using --write-info-json,
# --write-description etc. (default)
--write-playlist-metafiles
# Remove some private fields such as filenames from the infojson. Note that it could still contain
# some personal information (default)
--clean-infojson
# Retrieve video comments to be placed in the infojson. The comments are fetched even without this
# option if the extraction is known to be quick (Alias: --get-comments)
--write-comments
# Load cookies from a user profile of the given web browser. Currently supported browsers are:
# brave|chrome|chromium|edge|firefox|opera|safari|vivaldi. You can specify the user profile name
# or directory using "BROWSER:PROFILE_NAME" or "BROWSER:PROFILE_PATH". If no profile is given,
# the most recently accessed one is used
--cookies-from-browser chrome
#=========================================Thumbnail images==============================================
# Write thumbnail image to disk
--write-thumbnail
#--write-all-thumbnails Write all thumbnail image formats to disk
#--list-thumbnails Simulate and list all available thumbnail formats
#=========================================Verbosity / Simulation Options==============================================
#=========================================Workarounds==============================================
#=========================================Video Format Options==============================================
# download best 30hz mp4 file, h264+aac ,use http or https protocol, because we can use aria2c downloader to have a faster speed
#--format '(bestvideo[ext=mp4][fps<31]+bestaudio[ext=m4a]/best[ext=mp4]/bestvideo+bestaudio/best)[protocol^=http]'
# download best webm file, vp9+aac ,use http or https protocol
# source: https://www.reddit.com/r/youtubedl/comments/eoag5c/quality_difference_between_vp9_and_av1_for_1080p/
# --format '(bestvideo[vcodec^=avc1][vcodec^=vp9]+bestaudio[acodec^=opus]/bestvideo[vcodec=vp9]+bestaudio[acodec=opus]/bestvideo+bestaudio/best)[protocol^=http]'
# Download video with best quality and resolution sorted by the fields given via direct link over
# HTTP/HTTPS protocol, or the best video available via any protocol if there is no such video
--format '(bv[vcodec^=av01]+ba[acodec^=opus]/bv+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)'
# If a merge is required (e.g.bestvideo+bestaudio), output to givencontainer format, which is mkv here. Ignored if no merge is required
--merge-output-format mkv
# !!Options below in this section are only available in yt-dlc
# Sort the formats by the fields given, see "Sorting Formats" for more details
#--format-sort quality
--format-sort res,fps,vcodec,asr,acodec
# Check that the formats selected are actually downloadable
# --check-formats
# !!Options below in this section are not recommended in yt-dlc
# since there are other alternatives to achieve the same
#--youtube-skip-dash-manifest --extractor-args "youtube:skip=dash" (Alias: --no-youtube-include-dash-manifest)
#=========================================Subtitle Options==============================================
# Subtitle format, accepts formats preference, for example: "srt" or "ass/srt/best" --sub-lang LANGS Languages of the subtitles
# to download (optional) separated by commas, use --list-subs for available language tags
--sub-format ass/srt/best
# Download all subtitles include live chat (considered as a subtitle in yt-dlp)
# Use --sub-langs all,-live_chat to download all subtitles except live chat.
--sub-langs all
# --sub-langs all,-live_chat
#--list-subs List all available subtitles for the video
# !!Options below in this section are deprecated in yt-dlc
# --write-sub --write-subs
# --write-auto-sub --write-auto-subs
# Download all the available subtitles of the video
# --all-subs --sub-langs all --write-subs
#=========================================Authentication Options==============================================
#-u, --username USERNAME Login with this account ID
#-p, --password PASSWORD Account password. If this option is left out, youtube-dl will ask interactively.
#-2, --twofactor TWOFACTOR Two-factor authentication code
#-n, --netrc Use .netrc authentication data
#--video-password PASSWORD Video password (vimeo, smotri, youku)
#=========================================Adobe Pass Options==============================================
# !!All options in this section were moved to Authentication Options in yt-dlc
#=========================================Post-processing Options==============================================
# Embed subtitles in the video (only for mp4, webm and mkv videos)
--embed-subs
# Embed thumbnail in the audio as cover art
--embed-thumbnail
# Write metadata to the video file's xattrs (using dublin core and xdg standards)
--xattrs
# Convert the subtitles to ass
--convert-subs ass
# !!Options below in this section are only available in yt-dlc
# Embed metadata to the video file. Also adds chapters to file unless --no-add-chapters is used
# (Alias in yt-dlp and substitute in youtube-dl: --add-metadata)
--embed-metadata
# audio cover
# Add chapter markers to the video file (Alias: --add-chapters)
--embed-chapters
# Parse additional metadata like title/artist from other fields; see "MODIFYING METADATA" for details
#--parse-metadata FROM:TO
@lacafjh
Copy link
Author

lacafjh commented Jul 12, 2022

Put the config file in %APPDATA%\yt-dlp.

Dependencies

  • FFmpeg
  • aria2

Parameters to be modified

  • --proxy http://IP:port proxy used by yt-dlp
  • --all-proxy=http://IP:port proxy used by aria2

Parameters that you may want to modify

  • --download-archive '%APPDATA%/yt-dlp/archive.csv'
  • -o '%(uploader)s (%(uploader_id)s)/(%(n_entries+1-playlist_index)d_%(n_entries)d) %(upload_date)s - %(title)s - (%(duration)ss) [%(resolution)s] [%(id)s].%(ext)s'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment