Skip to content

Instantly share code, notes, and snippets.

@ChristopherA
Last active April 6, 2024 05:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ChristopherA/3361e44d569452e9ead65543b1dfbfb6 to your computer and use it in GitHub Desktop.
Save ChristopherA/3361e44d569452e9ead65543b1dfbfb6 to your computer and use it in GitHub Desktop.
yt-dlp tips

yt-dlp

A youtube-dl fork with additional features and fixes. Download videos from YouTube and other websites. More information at https://github.com/yt-dlp/yt-dlp

  • Download a video or playlist (with the default options from command below):
yt-dlp "https://www.youtube.com/watch?v=oHg5SJYRHA0"
  • List the available downloadable formats for a video:
yt-dlp --list-formats "https://www.youtube.com/watch?v=oHg5SJYRHA0"
  • Download a video with the best video and best audio stream:
yt-dlp --format "bv*+ba/b" https://www.youtube.com/watch?v=r3eaGCk2Acs
  • Download a video with a defined format, in this case the best mp4 video available (default is "bv*+ba/b"):
yt-dlp --format "bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4]" "https://www.youtube.com/watch?v=oHg5SJYRHA0"
  • Extract audio from a video (requires ffmpeg or ffprobe):
yt-dlp --extract-audio "https://www.youtube.com/watch?v=oHg5SJYRHA0"
  • Specify audio format and audio quality of extracted audio (between 0 (best) and 10 (worst), default = 5):
yt-dlp --extract-audio --audio-format mp3 --audio-quality 0 "https://www.youtube.com/watch?v=oHg5SJYRHA0"
  • List subitles available
yt-dlp --list-subs https://www.youtube.com/watch?v=r3eaGCk2Acs
  • Download subtitles (if available) of a video (default subtitle file format is .vtt):
yt-dlp --write-subs en https://www.youtube.com/watch?v=r3eaGCk2Acs
  • Specify the format to download subtitle:
$ yt-dlp --write-subs en --sub-format json3 https://www.youtube.com/watch?v=r3eaGCk2Acs
  • Embed subtitles into the video (the option --embed-subs works only for mp4, webm and mkv videos):
yt-dlp --format "bv*+ba/b" --embed-subs --merge-output-format mp4 https://www.youtube.com/watch?v=r3eaGCk2Acs
  • Download all playlists of YouTube channel/user keeping each playlist in separate directory:
yt-dlp -o "%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s" "https://www.youtube.com/user/TheLinuxFoundation/playlists"
  • Download Udemy course keeping each chapter in separate directory under MyVideos directory in your home:
yt-dlp -u user -p password -P "~/MyVideos" -o "%(playlist)s/%(chapter_number)s - %(chapter)s/%(title)s.%(ext)s" "https://www.udemy.com/java-tutorial"
  • Download entire series season keeping each series and each season in separate directory under C:/MyVideos:
yt-dlp -P "C:/MyVideos" -o "%(series)s/%(season_number)s - %(season)s/%(episode_number)s - %(episode)s.%(ext)s" "https://videomore.ru/kino_v_detalayah/5_sezon/367617"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment