Ubuntu – Converting mp4 to mp3

ffmpeglame

I have a video I need to convert to mp3 (from the command line – not GUI): video.mp4

I tried:

ffmpeg -i -b 192 video.mp4 video.mp3

with no success. I get the following error:

WARNING: library configuration mismatch
Seems stream 0 codec frame rate differs from container frame rate: 59.83 (29917/500) -> 59.75 (239/4)
WARNING: The bitrate parameter is set too low. It takes bits/s as argument, not kbits/s 
Encoder (codec id 86017) not found for output stream #0.0

so I tried lame:

lame -h -b 192 video.mp4 video.mp3

I get:

Warning: unsupported audio format

Am I missing something?

Best Answer

For FFmpeg with Constant Bitrate Encoding (CBR):

ffmpeg -i video.mp4 -vn \
       -acodec libmp3lame -ac 2 -ab 160k -ar 48000 \
        audio.mp3

or if you want to use Variable Bitrate Encoding (VBR):

ffmpeg -i video.mp4 -vn \
       -acodec libmp3lame -ac 2 -qscale:a 4 -ar 48000 \
        audio.mp3

The VBR example has a target bitrate of 165 Kbit/s with a bitrate range of 140...185.