Before converting a clip from YouTube to mp3, you must install the yt-dlp program.
The command for converting YouTube clips to mp3 is a bit more complicated.
yt-dlp requires additional parameters to run from the command line.
But that shouldn’t scare you.
I’ll show you step-by-step how to create your own youtube to mp3 downloader.
Let’s build the entire command.
We start with yt-dlp
yt-dlp
Then we add -x which tells it to extract audio.
yt-dlp -x
Then we specify the audio format as mp3
yt-dlp -x –audio-format mp3
Then add the audio quality
yt-dlp -x –audio-format mp3 –audio-quality 0
And finally add the link to the video to convert:
yt-dlp -x –audio-format mp3 –audio-quality 0 YOUTUBE_LINK
This is how it looks like from the command line:
Ihh, that looks complicated.
Convert YouTube To Mp3 Downloader Script
Let’s take the final command and put it into a file.
In Windows Explorer, navigate to your download folder.
In our case, it’s D:\GIT\SCRIPTS\GET_AUDIO
Right click to create a new text file in that folder.
Name it GET_AUDIO.BAT
Now tight click the new file and press Edit from the menu.
It opens up with Notepad. You can edit it in any other text editor.
Add this line to the beginning of the file:
@echo off
Next, paste the long, ugly command in there.
And finally, end the script with pause.
Like, actually write pause in the script.
This is how GET_AUDIO.BAT looks like in my Notepad++:
All you have to do now is double click GET_AUDIO.BAT from Windows Explorer.
It will start the download.
Here is what happens when you run the script and have successfully converted a YouTube clip to mp3 for free.