- Install the miro player
- Launch miro (from Applications->Sound & Video->Miro. You should now be able to search, play and download the flash video from Youtube. The file will be saved in ~/.miro/Movies/YouTube/ and will have extension .flv
- Now the important bit - you need to install the packages ffmpeg, lame and id3ed. You can install them on Ubuntu by invoking the command (in a terminal window)
sudo apt-get install ffmpeg lame id3ed
- Descend into the miro Movies directory
cd ~/.miro/Movies/YouTube
- Now using ffmpeg command, convert myfile.flv downloaded in step 2 above to a wav file (all one line - do not break the following into multiple lines)
ffmpeg -title 'My File' -i myfile.flv -acodec pcm_s16le -ac 2 -ab 128 -vn -y myfile.wave
- Now create an mp3 file from myfile.wav (created in the last step) using lame
lame --preset cd myfile.wav myfile.mp3
- Edit the id3 tags of your newly created mp3 file using the id3ed command
id3ed myfile.mp3
- Enjoy :)
April 17, 2008
Convert Flash Video (FLV) to mp3 in Linux
This post tells you how to convert FLV from Youtube or similar websites to MP3 format. This was requested by my friend Dimple who wanted the MP3 version of a Bhangra track from Youtube. This is just my notes from what I did to get the final MP3 file. I am running Ubuntu Gutsy on a Intel box.
Subscribe to:
Post Comments (Atom)
12 comments:
The sound quality of my mp3 is way better. I am not sure if converting it to a .wav file did it; nevertheless, I will continue to use these instructions. I absolutely recommend these instructions!!
Thanks Anand!
I used your instructions to automate the process with the following script. I placed the script in: /usr/bin/flv-to-mp3 and then made it executable with:
chmod a+x /usr/bin/flv-to-mp3
#!/bin/sh
# this script should convert files from FLV to WAV and then to MP3
echo " "
echo " Welcome to FLV to MP3 converter! version 0.1"
echo " "
echo " "
echo "Here is a list of the FLV files in the current directory:"
echo " "
ls *.flv
echo " "
echo -n "Which FLV file would you like me to convert?: "
read infile_name
# exit if the user did not enter anything:
if [ -z "$infile_name" ]; then
echo " "
echo "You did not tell me the file name, so I will exit now."
echo " "
exit
fi
echo " "
echo "OK. Starting the conversion!"
echo " "
ffmpeg -i "$infile_name" -acodec pcm_s16le -ac 2 -ab 128k -vn -y "${infile_name%.flv}.wav"
lame --preset cd "${infile_name%.flv}.wav" "${infile_name%.flv}.mp3"
rm "${infile_name%.flv}.wav"
echo " "
echo "OK. I'm done! Have fun!"
echo " "
exit
Here's a better script (based on the previous). It gets rid of the prompted question (i.e. "Which FLV file would you like me to convert?"):
#!/bin/sh
# this script should convert files from FLV to WAV and then to MP3
echo " "
echo " Welcome to FLV to MP3 converter! version 0.1"
echo " "
infile_name="$@"
# exit if the user did not enter anything:
if [ -z "$infile_name" ]; then
echo " "
echo "You did not tell me the file name, so I will exit now."
echo " "
exit
fi
echo " "
ffmpeg -i "$infile_name" -acodec pcm_s16le -ac 2 -ab 128k -vn -y "${infile_name%.flv}.wav"
lame --preset cd "${infile_name%.flv}.wav" "${infile_name%.flv}.mp3"
rm "${infile_name%.flv}.wav"
echo " "
echo "OK. I'm done! Have fun!"
echo " "
exit
Thanks - the script will make it easier for people to follow the instructions. Great ! Have you tested the script ?
- Anand.
You bad, bad boy you ;-)
I use the DownloadHelper add-on and LAME with the new vbr setting. Obviously, it's all dependent on the quality of the audio in the first place :-)
Comical that you came up in search results when I was quickly looking for it though for a friend.
gerald, ahem.
Thank you!!
Works great on Ubuntu.
hey thanks man
sound quality is nice
ubuntu rocksssssssss
how would you modify the script to this.
it be started in a directory and convert the whole directory.
read and covert one then move it to the Done folder and then go to the next until there are no more flv files in that directory.
ffmpeg -title 'My File' -i myfile.flv -acodec pcm_s16le -ac 2 -ab 128 -vn -y myfile.wave
I had a problem with this command. Substitute myfile.wave for myfile.wav
thanks man, it was very useful, just what i was looking for.
works like a charm. Thanks for posting this.
Thanks Alex and Senthil .... very glad to see it being useful for you.
Post a Comment