Convert YouTube Videos Into MP3s

Author: Stephan Jau
Revision: v1.0
Last Change: October 8 2008


I do have a few songs that are broken and that I can't get somewhere else and can't buy however they are on YouTube.

I know, quality is not the best on YouTube but for some stuff you have it might be better. Question is, how could I put those flash videos onto my music player?

It's actually very simple but the legality of it depends on where you live. Better check out first if you are allowed to convert YouTube videos into mp3s.


Step 1: Download the video

At first, we have to get the video. The normal flash version is a reduced quality of the actual uploaded one. So we get the mp4 version instead. In order to do that, go to the YouTube video that you want to download.

Then copy the URL of that video (for example this here: ) and paste it into the URL box of this the KeepVid website:

Then click on download and you will be presented two download links. One as flash and one as mp4. Use the mp4 version for better quality.


Step 2: Convert the video to mp3

Make sure you have ffmpeg and libmp3lame installed. Depending on your distro you have to find out yourself which libs you need.

I assume now that you downloaded the video as gratitude.mp4 and want to rip it to gratitude.mp3. In order to do so, run this command:

ffmpeg -i gratitude.mp4 -ab 128000 -ar 44100 nodame_gratitude.mp3

That's it. I know, audiophiles will say the quality is really bad but I'm no audiophile and for me it works fine.

Share this page:

Suggested articles

18 Comment(s)

Add comment


By: nomasteryoda

Why not create a bash script to simplify the process?

put the following into a file, copy it to your /usr/local/bin/ then chmod 755 to the file.



# Convert the flv files to mpg and mp3 files
for i in *.flv

# convert them to mpg if you like by removing the # on the 2 lines below this section
#  ffmpeg -i $i $i.mpg
    # ffmpeg -i $i -ab 128 -ar 44100 $i.mp3
      mplayer -dumpaudio $i -dumpfile $i.mp3

# use this line below to remove the flv files you downloaded.

# rm $i



By: Mohan R

dumpaudio is what I do to convert into mp3. But not from youtube, from imeem.

By: Ragnar


 Nice Script to but your script produces files called "dummy.flv.mp3" use this one to get files called "dummy.mp3".

for i in *.flv; do ffmpeg -i $i -ab 128000 -ar 44100 `basename $i .flv`.mp3; done


By: Kelly

Stephan, That is a good way of doing it. You can also use the clive utility to both download and invoke ffmpeg in one step. Here is a line from a small php script I wrote to parse an youtube rss feed and then download the videos in mp3 format.

exec('clive --ffmpeg="/usr/bin/ffmpeg -y -i %i %o" -o --output-fmt=%t.%i.%e --prefix=' . $filePath . ' ' . $url);

By: Valente Espinosa

Why mp3? would'nt be wise to support more and more open formats?


changing it to .ogg is not a big problem. It's basically the same HOWEVER as you don't get any real quality sound and because mp3 is just the most-spread/most popular format I wonder if it's worth making .oggs out of it... IMHO it's not :)

By: mhymn

"mplayer -ao pcm youtube.flv; lame aud* -o your-file.mp3"


"mplayer -ao pcm youtube.flv; oggenc -q 6 aud* -o your-file.ogg"

you can use the same trick for .mp4

By: Anonymous

You can always use PyTube which already has this capability

By: Manpreet Kaur


The procedural downloading information did a lot of help but still want to enquire that can anything else work in place of ffmpeg and libmp3lame?

Manpreet Kaur
Financial Researcher
News Desk

By: popo


But the online converter is not good. The output files is bad.

Mac users can use safari to download the youtube videos.

And here is a tutorial for Mac users to convert youtube videos to MP3.

By: Lynn LU

Yes ,a nice guide

But if you have a Mac,I think another sool guide will help you convert YouTube Videos to MP3s on Mac easily.

How to convert FLV videos to MP3,MP4, AVI, MPEG, MOV, 3GP,etc on Mac OS X?


I'd like to recommend this youtube downloader, it can extract audio from youtube video to mp3 audio, it works pretty well for me.


By: shenuna

You also can Free Download YouTube videos, then Burn YouTube video to DVD to play on your home DVD Player ~

By: Rahul

Hi, I was lloking for an laternative but after trying three options the easiest Youtube video downloader ever would be "Easy YouTube Video Downloader" offering single click non-intrusive direct download buttons for FLV, 3GP, MP3, MP4, 720p HD and 1080p Full-HD qualities right from the Youtube page on Mozilla Firefox browser :

By: Timbers

You can also use Real's media player and their convert video option. Another free choice.


If you want to convert youtube video to mp3 with high quality, I suggest you to use some youtube converter to help you. The one I used can not only help me download mp3 from youtube, but also can rip mp3 from downloaded FLV videos.


Yeah, most of the time, we can find some YouTube converters to convert YouTube video URL to mp3 files. Not only than this, you could also try to use other methods to rip mp3 from video on directly.

By: Simon

Keepvid has shut down its service since March this year. Now Im using vidpaw instead.