Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to extract an MP3 audio track from an MP4 video with ffmpeg. I can do this for .flv -> mp3, but I don't know the command line parameters for mp4->mp3. For example, flv -> mp3:

ffmpeg -i video.flv -acodec copy audio.mp3

What parameters should I use for mp4 -> mp3?

share|improve this question

migrated from stackoverflow.com Sep 6 '11 at 6:06

This question came from our site for professional and enthusiast programmers.

If you don't really need an MP3, I would not convert the audio: MP4->MP3 is a lossy transformation, you will lose extra source information. –  Thom Wiggers Dec 8 '13 at 0:33

3 Answers 3

The basic command is:

ffmpeg -i filename.mp4 filename.mp3


ffmpeg -i video.mp4 -b:a 192K -vn music.mp3

Check this URL: MP4 Video to MP3 File Using ffmpeg (Ubuntu 9.10 Karmic Koala)

Note: Ubuntu does not supply FFmpeg, but the fork named Libav. The syntax is the same – just use avconv instead of ffmpeg for the above examples.

share|improve this answer
Thank you! This quality is best, or I can do better? –  user916350 Sep 6 '11 at 5:32
try with 320kbs en.wikipedia.org/wiki/MP3#Bit_rate –  Naga Harish Movva Sep 6 '11 at 5:36

The better way to encode MP3 is to use -q:a for variable bit rate.

ffmpeg -i k.mp4 -q:a 0 -map a k.mp3

The q option can only be used with libmp3lame and corresponds to the LAME -V option. See:

share|improve this answer
@slhck ...that's a good point, but I've just tested on a video file, and leaving out -vn just copies the audio stream. I suppose ffmpeg must have some way of detecting the difference (I just checked a file with ffprobe, and the video was stream 1 rather than the usual 0, and had some metadata: comment : Cover (front)) –  evilsoup Feb 17 '13 at 21:31

In my experience, ffmpeg sometimes works, but GNOME SoundConverter has worked when ffmpeg failed.

share|improve this answer
There's no reason FFmpeg should fail on such a task, especially if the file can be converted with another tool. The only possible cause could be an outdated FFmpeg version (e.g. the distribution default). –  slhck Nov 2 '13 at 15:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.