--format "(bestvideo[vcodec^=av01][height>=4320][fps>30]/bestvideo[vcodec^=vp9.2][height>=4320][fps>30]/bestvideo[vcodec^=vp9][height>=4320][fps>30]/bestvideo[vcodec^=avc1][height>=4320][fps>30]/bestvideo[height>=4320][fps>30]/bestvideo[vcodec^=av01][height>=4320]/bestvideo[vcodec^=vp9.2][height>=4320]/bestvideo[vcodec^=vp9][height>=4320]/bestvideo[vcodec^=avc1][height>=4320]/bestvideo[height>=4320]/bestvideo[vcodec^=av01][height>=2880][fps>30]/bestvideo[vcodec^=vp9.2][height>=2880][fps>30]/bestvideo[vcodec^=vp9][height>=2880][fps>30]/bestvideo[vcodec^=avc1][height>=2880][fps>30]/bestvideo[height>=2880][fps>30]/bestvideo[vcodec^=av01][height>=2880]/bestvideo[vcodec^=vp9.2][height>=2880]/bestvideo[vcodec^=vp9][height>=2880]/bestvideo[vcodec^=avc1][height>=2880]/bestvideo[height>=2880]/bestvideo[vcodec^=av01][height>=2160][fps>30]/bestvideo[vcodec^=vp9.2][height>=2160][fps>30]/bestvideo[vcodec^=vp9][height>=2160][fps>30]/bestvideo[vcodec^=avc1][height>=2160][fps>30]/bestvideo[height>=2160][fps>30]/bestvideo[vcodec^=av01][height>=2160]/bestvideo[vcodec^=vp9.2][height>=2160]/bestvideo[vcodec^=vp9][height>=2160]/bestvideo[vcodec^=avc1][height>=2160]/bestvideo[height>=2160]/bestvideo[vcodec^=av01][height>=1440][fps>30]/bestvideo[vcodec^=vp9.2][height>=1440][fps>30]/bestvideo[vcodec^=vp9][height>=1440][fps>30]/bestvideo[vcodec^=avc1][height>=1440][fps>30]/bestvideo[height>=1440][fps>30]/bestvideo[vcodec^=av01][height>=1440]/bestvideo[vcodec^=vp9.2][height>=1440]/bestvideo[vcodec^=vp9][height>=1440]/bestvideo[vcodec^=avc1][height>=1440]/bestvideo[height>=1440]/bestvideo[vcodec^=av01][height>=1080][fps>30]/bestvideo[vcodec^=vp9.2][height>=1080][fps>30]/bestvideo[vcodec^=vp9][height>=1080][fps>30]/bestvideo[vcodec^=avc1][height>=1080][fps>30]/bestvideo[height>=1080][fps>30]/bestvideo[vcodec^=av01][height>=1080]/bestvideo[vcodec^=vp9.2][height>=1080]/bestvideo[vcodec^=vp9][height>=1080]/bestvideo[vcodec^=avc1][height>=1080]/bestvideo[height>=1080]/bestvideo[vcodec^=av01][height>=720][fps>30]/bestvideo[vcodec^=vp9.2][height>=720][fps>30]/bestvideo[vcodec^=vp9][height>=720][fps>30]/bestvideo[vcodec^=avc1][height>=720][fps>30]/bestvideo[height>=720][fps>30]/bestvideo[vcodec^=av01][height>=720]/bestvideo[vcodec^=vp9.2][height>=720]/bestvideo[vcodec^=vp9][height>=720]/bestvideo[vcodec^=avc1][height>=720]/bestvideo[height>=720]/bestvideo[vcodec^=av01][height>=480][fps>30]/bestvideo[vcodec^=vp9.2][height>=480][fps>30]/bestvideo[vcodec^=vp9][height>=480][fps>30]/bestvideo[vcodec^=avc1][height>=480][fps>30]/bestvideo[height>=480][fps>30]/bestvideo[vcodec^=av01][height>=480]/bestvideo[vcodec^=vp9.2][height>=480]/bestvideo[vcodec^=vp9][height>=480]/bestvideo[vcodec^=avc1][height>=480]/bestvideo[height>=480]/bestvideo[vcodec^=av01][height>=360][fps>30]/bestvideo[vcodec^=vp9.2][height>=360][fps>30]/bestvideo[vcodec^=vp9][height>=360][fps>30]/bestvideo[vcodec^=avc1][height>=360][fps>30]/bestvideo[height>=360][fps>30]/bestvideo[vcodec^=av01][height>=360]/bestvideo[vcodec^=vp9.2][height>=360]/bestvideo[vcodec^=vp9][height>=360]/bestvideo[vcodec^=avc1][height>=360]/bestvideo[height>=360]/bestvideo[vcodec^=avc1][height>=240][fps>30]/bestvideo[vcodec^=av01][height>=240][fps>30]/bestvideo[vcodec^=vp9.2][height>=240][fps>30]/bestvideo[vcodec^=vp9][height>=240][fps>30]/bestvideo[height>=240][fps>30]/bestvideo[vcodec^=avc1][height>=240]/bestvideo[vcodec^=av01][height>=240]/bestvideo[vcodec^=vp9.2][height>=240]/bestvideo[vcodec^=vp9][height>=240]/bestvideo[height>=240]/bestvideo[vcodec^=avc1][height>=144][fps>30]/bestvideo[vcodec^=av01][height>=144][fps>30]/bestvideo[vcodec^=vp9.2][height>=144][fps>30]/bestvideo[vcodec^=vp9][height>=144][fps>30]/bestvideo[height>=144][fps>30]/bestvideo[vcodec^=avc1][height>=144]/bestvideo[vcodec^=av01][height>=144]/bestvideo[vcodec^=vp9.2][height>=144]/bestvideo[vcodec^=vp9][height>=144]/bestvideo[height>=144]/bestvideo)+(bestaudio[acodec^=opus]/bestaudio)/best"
: Tell yt-dlp to download the best quality available prioritizing the most compressed/recent codecs, except for 240p and 144p where AVC is prioritized (Original idea by Veloldo)
(Watch on Mobile Script) --format "(bestvideo[vcodec^=avc1][height=1080][fps>30]/bestvideo[vcodec^=avc1][height=1080]/bestvideo[vcodec^=avc1][height=720][fps>30]/bestvideo[vcodec^=avc1][height=720]/bestvideo[vcodec^=avc1][height=480][fps>30]/bestvideo[vcodec^=avc1][height=480]/bestvideo[vcodec^=avc1][height=360][fps>30]/bestvideo[vcodec^=avc1][height=360]/bestvideo[vcodec^=avc1][height=240][fps>30]/bestvideo[vcodec^=avc1][height=240]/bestvideo[vcodec^=avc1][height=144][fps>30]/bestvideo[vcodec^=avc1][height=144]/bestvideo[vcodec^=avc1])+(bestaudio[acodec^=mp4a]/bestaudio)/best"
: Tell yt-dlp to download ancient video and audio format that are support by every mobile devices.
(Audio Only Scripts) --format "(bestaudio[acodec^=opus]/bestaudio)/best"
: Tell yt-dlp to download best audio quality available prioritizing the most compressed/recent codecs.
--verbose
: Tell yt-dlp to print various debugging information.
--force-ipv4
: Tell yt-dlp to use IPv4, needed because lots of hosting and VPNs providers don't support IPv6.
--sleep-interval 5 --max-sleep-interval 30
: Tell yt-dlp to pause between 5 and 30 seconds between 2 download to avoid getting "429 - Too Many Requests". (Original idea by BioSchokoMuffin).
--ignore-errors
: Tell yt-dlp to continue on download errors (for example to skip unavailable videos in a playlist).
--no-continue
: Tell yt-dlp not to resume partially downloaded files and to restart from the beginning (Mainly to avoid corruption).
--no-overwrites
: Tell yt-dlp not to overwrite existing files (Useful when metadata has already been downloaded).
--download-archive archive.log
: Tell yt-dlp to write every video that has been downloaded in archive.log
to automatically skip them next time the script is started.
--add-metadata
: Tell yt-dlp to write metadata to the video files.
--parse-metadata "%(title)s:%(meta_title)s"
: Tell yt-dlp to match the metadata title
to the title of the video (to avoid overwriting it with the title of the identified content).
--parse-metadata "%(uploader)s:%(meta_artist)s"
: Tell yt-dlp to match the metadata uploader
to the name of the uploader (to avoid overwriting it to the artist name of the identified content).
--write-description
: Tell yt-dlp to write video description to a .description
file.
--write-info-json
: Tell yt-dlp to write video metadata to a .info.json
file.
--write-annotations
: Tell yt-dlp to write video annotations to a .annotations.xml
file.
--write-thumbnail
: Tell yt-dlp to write thumbnail image to disk.
--embed-thumbnail
: Tell yt-dlp to embed thumbnail in the audio as cover art (only useful when downloading audio-only content like podcast).
--all-subs
: Tell yt-dlp to download all the available subtitles of the video.
--embed-subs
: Tell yt-dlp to embed subtitles in the video.
--get-comments
: Tell yt-dlp to download YouTube comments to info.json
(this is REALLY slow, around 10 comments per second).
--throttled-rate 100K
: For age-gated videos that are detected to be throttled, it will restart the download.
--check-formats
: Workaround for an edge case (see this issue).
--concurrent-fragments 5
: Set the number of dash/hlsnative fragments to 5 concurrent download to speed things up.
(Audio Only Scripts) --extract-audio
: Extract audio if it's included in a video file, otherwise don't do anything.
--match-filter "!is_live & !live"
: Tell yt-dlp to skip videos that are currently live on YouTube.
(Channels Scripts) --output "%(uploader)s/%(uploader)s - %(upload_date)s - %(title)s/%(uploader)s - %(upload_date)s - %(title)s [%(id)s].%(ext)s"
: Tell yt-dlp to download the videos in folders and subfolders, using the naming scheme Uploader/Uploader - 20191231 - Title/Uploader - 20191231 - Title [VIDEOID].ext
.
(Playlists Scripts) --output "%(playlist)s (%(uploader)s)/%(upload_date)s - %(title)s/%(upload_date)s - %(title)s [%(id)s].%(ext)s"
: Tell yt-dlp to download the videos in folders and subfolders, using the naming scheme PlaylistName - Uploader/20191231 - Title/20191231 - Title [VIDEOID].ext
.
(Unique Scripts) --output "%(title)s - %(uploader)s - %(upload_date)s/%(title)s - %(uploader)s - %(upload_date)s [%(id)s].%(ext)s"
: Tell yt-dlp to download the videos in folders and subfolders, using the naming scheme Title - Uploader - 20191231/Title - Uploader - 20191231 [VIDEOID].ext
.
--merge-output-format "mkv"
: Tell yt-dlp to merge the video and audio that were downloaded separately in a .mkv
file.
(Archivist Scripts) --datebefore "$(date --date="30 days ago" +%Y%m%d)"
: Tell yt-dlp to download everything that was created before the current date, minus 30 days.
(Recent Scripts) --dateafter "$(date --date="30 days ago" +%Y%m%d)"
: Tell yt-dlp to download everything that was created after the current date, minus 30 days.
--batch-file "Source - XXXXXX.txt"
: Tell yt-dlp to look for links in Source - XXXXXX.txt
.
2>&1 | tee output.log
: Tell the shell to output stdout and stderr to output.log
.