Beta 42

Research and Development


Download mp3 from YouTube

To download a video as mp3 file, you can use one of the following commands.

youtube-dl -x --audio-format mp3

If you want to have a cover art for the mp3 file, you can add the --embed-thumbnail option:

youtube-dl -x --embed-thumbnail --audio-format mp3

If you wish to download more than one track from a playlist, youtube-dl provides an option to download a whole playlist or just a range of songs within it:

Where NUMBER is the starting and ending point of the playlist. The command below will download the first 5 songs from the given playlist:

youtube-dl -x --audio-format mp3 --playlist-start 1 --playlist-end 5 \

If you prefer to download the whole playlist, do not use the playlist-start and playlist-end parameters. Instead, simply pass the playlist URL.

For batch download, write the URLs in a file called videos.txt and make sure to keep one URL at a line. Then you can use the following for loop to download the songs:

for i in $(<videos.txt); do youtube-dl -x --audio-format mp3 $i; done