Table of Contents

Ubuntu - Sound - Convert MP4 to MP3

ffmpeg -i x.mp4 -vn -acodec copy x.mp3

ffmpeg -i "x.mp4" -b:a 320k -vn x.mp3
 
ffmpeg -i "x.mp4" -b:a 192k -vn x.mp3

ffmpeg -i in.mp4 -q:a 0 -map a out.mp3

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

See Encoding VBR (Variable Bit Rate) mp3 audio.


Converts every MP4 in the current directory to an MP3.

Preserves the original name of the file.

for f in *.mp4; do ffmpeg -i "$f" -vn -c:a libmp3lame -ar 44100 -ac 2 -ab 192k "${f/%mp4/mp3}"; done

NOTE: To use it for an flv or avi or whatever, simply change both instances of mp4.


References

https://trac.ffmpeg.org/wiki/Encode/MP3