Download and Convert YouTube Videos to MP3 with Metadata

Khalid AlnajjarGeneral Leave a Comment

youtube-dl is a great tool for downloading YouTube playlists, videos or music. The tool runs on all platforms, Windows, Linux and Mac. The tool provides many options, for more details check the README file of youbube-dl.

Sometimes I like to listen to songs while being able to read their lyrics without googling them individually. In this post, I explain how to download YouTube videos, convert them into MP3 and set their metadata for accessing their lyrics automatically.

We will use youtube-dl solely. If you don’t have youtube-dl install, follow these instructions to download and install it. Some Linux distributions provide youtube-dl from the package manager, e.g. on Debian you can install it by using sudo apt-get install youtube-dl.

Now that everything is installed, we can start downloading YouTube music with lyrics using the following command:

youtube-dl --audio-quality 0 -i --extract-audio --audio-format mp3 -o './%(title)s.%(ext)s' --add-metadata --embed-thumbnail --metadata-from-title "%(artist)s - %(title)s" YOUTUBE_LINKS

In the above command, replace YOUTUBE_LINKS with the desired YouTube videos or playlists, separated by spaces. If you want to download only videos and ignore playlists, add –no-playlist to the command. Alternatively, you can create a text file, e.g. youtube-links.txt, with lines as YouTube links and replace YOUTUBE_LINKS with -a youtube-links.txt.

When you execute the command, youtube-dl will download YouTube videos using a better audio-quality, extracts the audio only from the video, convert it to MP3, set the meta-information based on the title and thumbnail, and then save it.

Now, you can listen to the songs while reading their lyrics using applications that automatically retrieving lyrics. I recommend Clementine Player as it is free, open source and has the functionality. When listening to music in Clementine, the player can automatically fetch lyrics from lyrics website (e.g. lyrics.wikia.com) and show them under Song Info.

* (This post contains affiliate links. Please read my disclosures for more details).

Share this Post

Please enable JavaScript to view the comments powered by Disqus.