2

I'm looking for a free Linux tool that can convert a rather large collection of FLV files into MP3 format. Most of the tools I've tried use ffmpeg under the hood, but they fail to convert many of the files, all passing up the error message from ffmpeg:

[flv @ 0xb7f32388]Unsupported video codec (7)

I've tried importing the FLV files into various other tools (iTunes, Audacity, Pitivi) but none of them work. The odd thing is that the Totem movie player plays them just fine... but it does not feature a way to extract the sound of a movie.

What tools can you recommend?

8
  • 1
    FLV is a video format. MP3 is an audio format. I assume you want to only use the audio from the FLV?
    – d-_-b
    Mar 25, 2011 at 3:02
  • 1
    I believe Totem uses the 'gstreamer' media framework. If so, you should be able to mangle a gstreamer pipeline to extract the audio, should you desire. I have never really been that up on gstreamer so I can't give details.
    – Bill Gribble
    Mar 25, 2011 at 14:01
  • @sims: Yes, the idea is to extract the audio. It works with ffmpeg on some flv files, but not on all.
    – user683
    Mar 25, 2011 at 18:40
  • 2
    Hi Koen, welcome to Audio.SE. Is this question coming from a production or recording context of any sort? The answers on this site will be coming from that perspective. If you're looking to build up a media library or something like that (and I suspect you might be, given that you have a large collection), you might have more luck on one of the other sites (maybe Superuser?).
    – Warrior Bob
    Mar 25, 2011 at 21:18
  • 2
    Have you tried VLC?
    – muntoo
    Mar 25, 2011 at 22:40

2 Answers 2

11

Although you've already mentioned it, ffmpeg is the canonical (Linux) tool for this. I would recommend invoking ffmpeg directly (from the command line) with something like:

ffmpeg -i [infile].flv -vn -acodec libmp3lame -ab 128k [outfile].mp3

... where

-vn                disable video
-acodec libmp3lame convert audio to mp3 using the lame codec
-ab 128k           set the audio bitrate to 128k

With an up-to-date install of ffmpeg, running:

ffmpeg -formats | grep "FLV"

... should yield a line similar to:

DE flv             FLV format

If you don't see that line, ffmpeg has not been compiled with flv support. If you are running Ubuntu (for example), the following tutorial may help enabling restricted encoders in ffmpeg.


An initial sanity check for problematic files could be to check the file is really a Flash file by running:

file thefile.flv
thefile.flv: Macromedia Flash Video
1
  • Thanks for the information. It's interesting though, to use the 'file' command as a quick sanity check, and to use the 'formats' option as you do. It does not solve the problem, but it's still interesting ;-)
    – Koen Van Damme
    Apr 7, 2012 at 16:16
4

The video may already contain audio in MP3 format. In this case it's better to copy the stream. This avoids re-encoding the audio, which takes time and involves quality loss.

ffmpeg -i [infile].flv -vn -acodec copy [outfile].mp3

... where

-vn                drop the video stream
-acodec copy       copy audio stream directly to output mp3 file
2
  • 2
    You could write a script that calls ffmpeg -i <your flv file> and parses the output to see what format the audio is in - then either copy (as above) or transcode as in the other answer.
    – Darren Greaves
    Nov 14, 2011 at 15:44
  • Tried this, did not work. Thanks for the tip though.
    – Koen Van Damme
    Apr 7, 2012 at 16:17