Smokes your problems, coughs fresh air.

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

  1. Rowan Rodrik

    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. Rowan Rodrik

    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.

© 2024 BigSmoke

Theme by Anders NorenUp ↑