If you’re using Linux or a Mac, then there are two neat commandline tools which you can use to download and convert Youtube videos into mp3 files. They are Youtube-dl and FFmpeg. Installation

Installing youtube-dl

The download and install instructions for youtube-dl are here.

As a quick note, on Mac you can run:

brew install youtube-dl

And on GNU/Linux:

sudo curl <https://yt-dl.org/downloads/2015.11.27.1/youtube-dl> -o
/usr/local/bin/youtube-dl sudo chmod a+rx /usr/local/bin/youtube-dl

For NixOS fans, it’s available via nix-env.

Installing FFmpeg

Many Linux distros come with FFmpeg installed I believe.

If not, you can use your distros package manager. For example, on Ubuntu:

sudo apt-get install ffmpeg




Note: In some older versions of Ubuntu (and probably other distros), you should use avconv instead of ffmpeg. AVConv was simply a fork of FFmpeg and the two projects have subsequently been merged back into FFmpeg again.

On Mac you can use homebrew:

brew install ffmpeg

Downloading the video

To download a Youtube video, you simply run the following line (making sure to replace the URL with the one of the video you want to download):

youtube-dl <https://www.youtube.com/watch?v=DLzxrzFCyOs>

Converting video to mp3

To now convert the mp4 video to mp3, you can use FFmpeg (comes standard with most Linux distros I believe).

ffmpeg -i RickAstley-NeverGonnaGiveYouUp\[HQ\]-DLzxrzFCyOs.mp4
RickAstley-NeverGonnaGiveYouUp.mp3





Hello, I'm JC Brand, software developer and consultant.
I created and maintain Converse, a popular web-based XMPP chat client,
I can help you integrate chat and instant messaging features into your website or intranet.

You can follow me on the Fediverse or on Twitter.