Many times we download a song we like from YouTube, or other sites, as a FLV video. But how to convert it to a regulare audio-only MP3 file? Here is a nice solution I found on the net, using FFMPEG.

The syntax of the command is:

ffmpeg [[infile options][-i infile]]... {[outfile options] outfile}

So, to convert a flv video to mp3, we could use something like:

$ ffmpeg -i filename.flv -acodec mp3 -ac 2 -ab 128 -vn -y filename.mp3

Explanation of options

-i filename
Specifies the input file name
-ac 2
Specifies the number of audio channels to use
-ab 128
Specifies the audio bitrate (in k). For youtube videos, 64 is enough.
-vn
Disables video recording.
-y
Overwrites output file.
-f fmt
Force format.
-metadata key=value
Set a metadata key/value pair.

To see informations on the input file, before converting it:

$ ffmpeg -i filename.flv

To see all available codecs/filters:

$ ffmpeg -filters

Comments