Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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
no more ffmpeg for ubuntu 14.04 – Louis Oct 7 '14 at 18:03

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 – Naga Harish Movva Sep 6 '11 at 5:36
no more ffmpeg for ubuntu 14.04 – Louis Oct 7 '14 at 18:03
@Louis You can still download it from – slhck Nov 22 '14 at 7:39
@Louis - same for 14.10, but it is apparently returning in 15.04:… – Wilf Apr 4 '15 at 11:53

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
This one finally played also the Android Music player. Thanks – michalzuber Nov 10 '15 at 7:24

You must log in to answer this question.

protected by Community Aug 12 '14 at 11:12

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?