Skip to content

Extracting the MP3 stream from a Flash Video (flv) file

I wanted to convert an Flash Video (flv) file from YouTube to MP3. The first tip I found essentially streamed the original file into a different file:

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

This is a bit awkward, because not all flv files have the same quality (some are mono, for example). I don’t want to have to look up the number of channels (-ac 2 in the example) for each file that I need to convert.

Luckily, most flv files include an MP3 audio stream and ffmpeg can simply copy that stream to a new file:

ffmpeg -i filename.flv -acodec copy filename.mp3

This works perfectly and is much faster than the other method.


2 Comments ( Add comment / trackback )

  1. (permalink)
    Comment by Rowan Rodrik
    On December 6, 2009 at 23:18

    Today I was ripping the sound from a video that would only work with the following command:

    ffmpeg -i FlashDgEWC2 -acodec mp2 -ac 2 -ab 128000 -vn -y "Diggy Dex ft. Eva de Roovere - Slaap lekker (Fantastig toch).mp3"

  2. (permalink)
    Comment by Rowan Rodrik
    On March 19, 2010 at 00:43

    Actually, since Februari 2009, all YouTube videos use the AAC encoding for their audio. So in the above (-acodec copy) example I should have given the file with the extracted audio an extension such as .aac or .mp4.

Post a comment

(required)
(required)

Your email is never published nor shared.

(optional)
Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>