{"id":1306,"date":"2022-03-06T02:23:43","date_gmt":"2022-03-06T10:23:43","guid":{"rendered":"https:\/\/gmr.dev\/blog\/?p=1306"},"modified":"2022-07-25T02:54:07","modified_gmt":"2022-07-25T09:54:07","slug":"easiest-way-to-download-youtube-videos-and-convert-them-to-any-format-including-mp3-in-2022","status":"publish","type":"post","link":"https:\/\/rose.dev\/blog\/2022\/03\/06\/easiest-way-to-download-youtube-videos-and-convert-them-to-any-format-including-mp3-in-2022\/","title":{"rendered":"Easiest way to download YouTube videos and convert them to any format including .mp3 in 2022"},"content":{"rendered":"\n<p>Methods of downloading YouTube videos have changed over the years. Here are two of my preferred methods for doing so in 2022.<\/p>\n\n\n\n<p><strong>tl;dr: easy<\/strong>:<\/p>\n\n\n\n<p>Use a Youtube-Mp3 converter site, if you know how to Google then you&#8217;ve probably found one of these already.<\/p>\n\n\n\n<p><strong>tl;dr: is asked to fix printers<\/strong>:<\/p>\n\n\n\n<p>Get the latest &#8216;youtube-dl&#8217; fork like <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/github.com\/yt-dlp\/yt-dlp\" target=\"_blank\" rel=\"noreferrer noopener\">yt-dlp<\/a>. Use <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/www.ffmpeg.org\/download.html\" target=\"_blank\" rel=\"noreferrer noopener\">ffmpeg<\/a> to convert.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Easy<\/h2>\n\n\n\n<p>Yeah there&#8217;s really nothing else you need here<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The Other Method<\/h2>\n\n\n\n<ol class=\"wp-block-list\"><li><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/github.com\/yt-dlp\/yt-dlp\/releases\/latest\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Get yt-dlp<\/a>. Put it in a folder somewhere in <code>C:\\<\/code> like &#8216;youtubedownload&#8217;. Rename the .exe file to <code>yt.exe<\/code>. <\/li><li><a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/www.ffmpeg.org\/download.html\" target=\"_blank\" rel=\"noreferrer noopener nofollow\">Get ffmpeg<\/a>. Put it in the same folder. You could rename this .exe file if you want as well, the names will be the commands used in the future.<\/li><li>Press the WINDOWS key, and type &#8216;path&#8217;. <br>(INCOMING WALL OF PICTURES)<br><img loading=\"lazy\" decoding=\"async\" width=\"987\" height=\"682\" class=\"wp-image-1347\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/firefox_3pcv6n9VyA.png\" alt=\"\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/firefox_3pcv6n9VyA.png 987w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/firefox_3pcv6n9VyA-300x207.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/firefox_3pcv6n9VyA-768x531.png 768w\" sizes=\"auto, (max-width: 987px) 100vw, 987px\" \/><\/li><li>Choose &#8216;Enviroment Variables&#8217;<br><img loading=\"lazy\" decoding=\"async\" width=\"544\" height=\"571\" class=\"wp-image-1350\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_fq72PyYp7e.png\" alt=\"enviroment variables pointer\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_fq72PyYp7e.png 544w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_fq72PyYp7e-286x300.png 286w\" sizes=\"auto, (max-width: 544px) 100vw, 544px\" \/> <\/li><li>Then,<br><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"776\" class=\"wp-image-1351\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_qIzTAKIzK9.png\" alt=\"edit path detailed pointer\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_qIzTAKIzK9.png 704w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_qIzTAKIzK9-272x300.png 272w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><br><\/li><li>You can then add a new entry for the &#8216;path&#8217; environment variable. The system uses this to allow the executing directory to be in any directory listed in the path. Meaning, when you run a command in CMD, the system will always check any directories in the &#8216;path&#8217;.<br><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"663\" class=\"wp-image-1352\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_aFRhkTe7tj.png\" alt=\"add new path entry\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_aFRhkTe7tj.png 600w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/SystemPropertiesAdvanced_aFRhkTe7tj-271x300.png 271w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/li><li>Click OK on all open windows after adding the directory the exes are in to the &#8216;path&#8217;.<\/li><\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Example Usage<\/strong><\/h2>\n\n\n\n<p>We will be using this song from YouTube: <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/www.youtube.com\/watch?v=dIMdcJWOEFM\" target=\"_blank\" rel=\"noreferrer noopener\">Moving Romance &#8211; Yoann Garel<\/a>. It&#8217;s also <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/soundcloud.com\/dreamhopp\/yoann-garel-moving-romance\" target=\"_blank\" rel=\"noreferrer noopener\">available on Soundcloud here<\/a>.<\/p>\n\n\n\n<p>Right click on your Desktop &gt; &#8216;Open Command Window Here&#8217;. If you don&#8217;t have this option in the context menu, you <a aria-label=\"undefined (opens in a new tab)\" href=\"https:\/\/gmr.dev\/blog\/2022\/03\/06\/adding-open-command-window-here-context-menu-in-windows-10-to-the-right-click-menu-restoring-cmd\/\" target=\"_blank\" rel=\"noreferrer noopener\">can download these registry edits<\/a> to add it.<\/p>\n\n\n\n<p>Next type the name of the yt-dlp .exe followed by a space and the url. So if you renamed it &#8216;yt&#8217; like stated previously, it would look like so:<br><code>yt https:\/\/www.youtube.com\/watch?v=dIMdcJWOEFM<\/code><br>Hitting enter will start downloading that video to the desktop directory you just launched the CMD window in. (Hint! If you want to use a Soundcloud URL like we have below, that will work too! Isn&#8217;t technology great?)<br><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"600\" class=\"wp-image-1371\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_7fXG6Mb2Ya.png\" alt=\"yt-dl download example\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_7fXG6Mb2Ya.png 1200w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_7fXG6Mb2Ya-300x150.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_7fXG6Mb2Ya-1024x512.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_7fXG6Mb2Ya-768x384.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n\n\n\n<p>If you want to convert the resulting video to a proper audio file like .mp3, you have two options. You can use the quick solution right from yt-dl:<\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#162b32\"><code>yt -x --audio-format mp3 [video_url]<\/code><\/p>\n\n\n\n<p><em>Or to download a playlist:<\/em><\/p>\n\n\n\n<p class=\"has-background\" style=\"background-color:#162b32\"><code>youtube-dl --extract-audio --audio-format mp3 -o \"%(title)s.%(ext)s\"<\/code><\/p>\n\n\n\n<p>You can ignore missing (&#8220;unavailable in your country&#8221;, or removed) videos with an <code>-i<\/code> flag. If your playlist isn&#8217;t working and the URL contains <code>v=&lt;ID><\/code>, remove it so just the <code>?list=<\/code> item is in the query string.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Or, since ffmpeg is useful for other tasks (and you should have it anyway), you can use it directly. A simple syntax of an ffmpeg command that would convert to an mp3 would look like <code>ffmpeg -i [input file name] [output file name].[output file extension]<\/code>. But wait, we don&#8217;t want to type that long, ugly file name in that yt-dlp just spit out onto our desktop&#8230; luckily we have a trick for that.<\/p>\n\n\n\n<p>Run &#8216;<code>dir \/x<\/code>&#8216; in the open CMD window.<img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"600\" class=\"wp-image-1376\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_pTweu0P9mI.png\" alt=\"dir \/x example yt\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_pTweu0P9mI.png 1200w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_pTweu0P9mI-300x150.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_pTweu0P9mI-1024x512.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_pTweu0P9mI-768x384.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><br>This is an extremely helpful <a aria-label=\"undefined (opens in a new tab)\" rel=\"noreferrer noopener\" href=\"https:\/\/docs.microsoft.com\/en-us\/windows-server\/administration\/windows-commands\/dir\" target=\"_blank\">windows command<\/a> that will show &#8216;short&#8217; filenames for files, making working with longer file names a breeze. Windows is telling us in the screenshot above that we can refer to the video we just downloaded as &#8216;moving~3.web&#8217;. Now assuming no renaming of the ffmpeg .exe took place in the setup step, our command simply becomes:<\/p>\n\n\n\n<p><code>ffmpeg -i moving~3.web output.mp3<\/code><br><img loading=\"lazy\" decoding=\"async\" width=\"1200\" height=\"600\" class=\"wp-image-1377\" style=\"\" src=\"https:\/\/gmr.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_LdzPkRSman.png\" alt=\"ffmpeg -i output.mp3 example\" srcset=\"https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_LdzPkRSman.png 1200w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_LdzPkRSman-300x150.png 300w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_LdzPkRSman-1024x512.png 1024w, https:\/\/rose.dev\/blog\/wp-content\/uploads\/2022\/03\/cmd_LdzPkRSman-768x384.png 768w\" sizes=\"auto, (max-width: 1200px) 100vw, 1200px\" \/><\/p>\n\n\n\n<p>And you&#8217;re done! You now have &#8216;output.mp3&#8217; on your desktop saved as the song we were just playing on YouTube. I&#8217;ve combined this process with scripted metadata adding\/titling for an offline library. And, with the right yt-dlp commands it can even become an efficient way to export entire playlists of music.<\/p>\n<hr>\r\nIt helps me if you share this post\r\n<br\/>\r\n<br\/>\r\nPublished 2022-03-06 02:23:43 ","protected":false},"excerpt":{"rendered":"<p>Hitting enter will start downloading that video to the desktop directory you just launched the window in. (Hint! If you want to use a Soundcloud URL like we have below, that will work too! Isn&#8217;t technology great?)<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"footnotes":""},"categories":[835,921,922,832,833],"tags":[984,982,1083,1084,1085,1086,1087,936],"class_list":["post-1306","post","type-post","status-publish","format-standard","hentry","category-misc","category-random","category-release","category-software","category-technology","tag-convert","tag-download","tag-format","tag-mp3","tag-mp3-conversion","tag-song-downloading","tag-soundcloud","tag-youtube"],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/1306","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/comments?post=1306"}],"version-history":[{"count":31,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/1306\/revisions"}],"predecessor-version":[{"id":2107,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/posts\/1306\/revisions\/2107"}],"wp:attachment":[{"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/media?parent=1306"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/categories?post=1306"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rose.dev\/blog\/wp-json\/wp\/v2\/tags?post=1306"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}