Advertisement
WebDeveloper

Youtube-DLP Downloader Commands

Jan 30th, 2023 (edited)
2,590
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 6.71 KB | None | 0 0
  1. Youtube-DLG
  2.  
  3.  
  4. Download FFmpeg first & place the 3 .exe files in the same folder as yt-DLP.exe
  5.  
  6.  
  7. FFmpeg Download:  https://github.com/GyanD/codexffmpeg/releases/tag/5.1.2
  8.  
  9.  
  10. Downlod:
  11. https://github.com/yt-dlp/yt-dlp#release-files
  12.  
  13. Open command prompt in .exe location and run
  14.  
  15. #This will show available file types for video and audio to merge and you select them both with "+" in the next command
  16. ./yt-DLP.exe -F https://www.youtube.com/playlist?list=PLhQjrBD2T3817j24-GogXmWqO5Q5vYy0V
  17.  
  18.  
  19.  
  20. #This will merge the audio & video types selected from the "-F" option
  21. # Note 140+137 are the ones I wanted to download so choose your preferred combination.
  22.  
  23. ./yt-DLP.exe -f 140+137 https://www.youtube.com/playlist?list=PLhQjrBD2T3817j24-GogXmWqO5Q5vYy0V
  24.  
  25.  
  26.  
  27. # Download the best **stand-alone video file** and the best **stand-alone audio
  28. # file** and then **combine** them into one file
  29.  
  30. youtube-dl -f 'bestvideo+bestaudio' 'https://www.youtube.com/watch?v=-FzqOdRpCGw'
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. FORMAT OPTIONS
  39.  
  40.  
  41. Note that on Windows you need to use double quotes instead of single.
  42.  
  43. $ yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc
  44. youtube-dl test video ''_รคโ†ญ๐•.mp4    # All kinds of weird characters
  45.  
  46. $ yt-dlp --get-filename -o '%(title)s.%(ext)s' BaW_jenozKc --restrict-filenames
  47. youtube-dl_test_video_.mp4          # A simple file name
  48.  
  49. # Download YouTube playlist videos in separate directory indexed by video order in a playlist
  50. $ yt-dlp -o '%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
  51.  
  52. # Download YouTube playlist videos in seperate directories according to their uploaded year
  53. $ yt-dlp -o '%(upload_date>%Y)s/%(title)s.%(ext)s' https://www.youtube.com/playlist?list=PLwiyx1dc3P2JR9N8gQaQN_BCvlSlap7re
  54.  
  55. # Download all playlists of YouTube channel/user keeping each playlist in separate directory:
  56. $ yt-dlp -o '%(uploader)s/%(playlist)s/%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/user/TheLinuxFoundation/playlists
  57.  
  58. # Download Udemy course keeping each chapter in separate directory under MyVideos directory in your home
  59. $ 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/
  60.  
  61. # Download entire series season keeping each series and each season in separate directory under C:/MyVideos
  62. $ 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
  63.  
  64. # Stream the video being downloaded to stdout
  65. $ yt-dlp -o - BaW_jenozKc
  66.  
  67.  
  68.  
  69. # Download and merge the best best video-only format and the best audio-only format,
  70. # or download the best combined format if video-only format is not available
  71. $ yt-dlp -f 'bv+ba/b'
  72.  
  73. # Download best format that contains video,
  74. # and if it doesn't already have an audio stream, merge it with best audio-only format
  75. $ yt-dlp -f 'bv*+ba/b'
  76.  
  77. # Same as above
  78. $ yt-dlp
  79.  
  80. # Download the best video-only format and the best audio-only format without merging them
  81. # For this case, an output template should be used since
  82. # by default, bestvideo and bestaudio will have the same file name.
  83. $ yt-dlp -f 'bv,ba' -o '%(title)s.f%(format_id)s.%(ext)s'
  84.  
  85.  
  86.  
  87. # The following examples show the old method (without -S) of format selection
  88. # and how to use -S to achieve a similar but better result
  89.  
  90. # Download the worst video available (old method)
  91. $ yt-dlp -f 'wv*+wa/w'
  92.  
  93. # Download the best video available but with the smallest resolution
  94. $ yt-dlp -S '+res'
  95.  
  96. # Download the smallest video available
  97. $ yt-dlp -S '+size,+br'
  98.  
  99.  
  100.  
  101. # Download the best mp4 video available, or the best video if no mp4 available
  102. $ yt-dlp -f 'bv*[ext=mp4]+ba[ext=m4a]/b[ext=mp4] / bv*+ba/b'
  103.  
  104. # Download the best video with the best extension
  105. # (For video, mp4 > webm > flv. For audio, m4a > aac > mp3 ...)
  106. $ yt-dlp -S 'ext'
  107.  
  108.  
  109.  
  110. # Download the best video available but no better than 480p,
  111. # or the worst video if there is no video under 480p
  112. $ yt-dlp -f 'bv*[height<=480]+ba/b[height<=480] / wv*+ba/w'
  113.  
  114. # Download the best video available with the largest height but no better than 480p,
  115. # or the best video with the smallest resolution if there is no video under 480p
  116. $ yt-dlp -S 'height:480'
  117.  
  118. # Download the best video available with the largest resolution but no better than 480p,
  119. # or the best video with the smallest resolution if there is no video under 480p
  120. # Resolution is determined by using the smallest dimension.
  121. # So this works correctly for vertical videos as well
  122. $ yt-dlp -S 'res:480'
  123.  
  124.  
  125.  
  126. # Download the best video (that also has audio) but no bigger than 50 MB,
  127. # or the worst video (that also has audio) if there is no video under 50 MB
  128. $ yt-dlp -f 'b[filesize<50M] / w'
  129.  
  130. # Download largest video (that also has audio) but no bigger than 50 MB,
  131. # or the smallest video (that also has audio) if there is no video under 50 MB
  132. $ yt-dlp -f 'b' -S 'filesize:50M'
  133.  
  134. # Download best video (that also has audio) that is closest in size to 50 MB
  135. $ yt-dlp -f 'b' -S 'filesize~50M'
  136.  
  137.  
  138.  
  139. # Download best video available via direct link over HTTP/HTTPS protocol,
  140. # or the best video available via any protocol if there is no such video
  141. $ yt-dlp -f '(bv*+ba/b)[protocol^=http][protocol!*=dash] / (bv*+ba/b)'
  142.  
  143. # Download best video available via the best protocol
  144. # (https/ftps > http/ftp > m3u8_native > m3u8 > http_dash_segments ...)
  145. $ yt-dlp -S 'proto'
  146.  
  147.  
  148.  
  149. # Download the best video with h264 codec, or the best video if there is no such video
  150. $ yt-dlp -f '(bv*+ba/b)[vcodec^=avc1] / (bv*+ba/b)'
  151.  
  152. # Download the best video with best codec no better than h264,
  153. # or the best video with worst codec if there is no such video
  154. $ yt-dlp -S 'codec:h264'
  155.  
  156. # Download the best video with worst codec no worse than h264,
  157. # or the best video with best codec if there is no such video
  158. $ yt-dlp -S '+codec:h264'
  159.  
  160.  
  161.  
  162. # More complex examples
  163.  
  164. # Download the best video no better than 720p prefering framerate greater than 30,
  165. # or the worst video (still prefering framerate greater than 30) if there is no such video
  166. $ yt-dlp -f '((bv*[fps>30]/bv*)[height<=720]/(wv*[fps>30]/wv*)) + ba / (b[fps>30]/b)[height<=720]/(w[fps>30]/w)'
  167.  
  168. # Download the video with the largest resolution no better than 720p,
  169. # or the video with the smallest resolution available  if there is no such video,
  170. # prefering larger framerate for formats with the same resolution
  171. $ yt-dlp -S 'res:720,fps'
  172.  
  173.  
  174.  
  175. # Download the video with smallest resolution no worse than 480p,
  176. # or the video with the largest resolution available if there is no such video,
  177. # prefering better codec and then larger total bitrate for the same resolution
  178. $ yt-dlp -S '+res:480,codec,br'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement