Convert FLV audio to MP3 in Linux

From Stack Overflow
Jump to: navigation, search

This is a variant on the instructions found at http://symbolik.wordpress.com/2007/10/10/extracting-an-mp3-from-a-youtube-flash-flv-download/

Specifically, the ffmpeg I have installed on my version of Ubuntu does not support MP3 output, so I had to go through an intermediate WAV step. Of course, ffmpeg doesn't have an output keyword for wav, you have to define exactly what sort of wav file you want (in this case a PCM-encoded, signed, 16-bit, little-endian wav).

Prerequisites:

sudo apt-get install ffmpeg lame id3ed

First:

ffmpeg -title 'My File' -i myfile.flv -acodec pcm_s16le -ac 2 -ab 128 -vn -y myfile.wav

Then, it's as simple as using lame to encode the wav as an MP3:

lame --preset cd myfile.wav myfile.mp3

Finally, set the ID3 tags:

id3ed myfile.mp3
Personal tools