Convert to mp3 Using FFMPEG

In this example we will convert m4a audio files to mp3. But you can convert virtually any audio format.

$ mkdir converted
$ for f in *.m4a; do ffmpeg -i "$f" -codec:v copy -codec:a libmp3lame -q:a 2 converted/"${f%.m4a}.mp3"; done;
  • -q:a 2 means LAME’s option -V 2, which gives us a VBR MP3 audio stream with an average stereo bitrate of 170-210 kBit/s. See https://trac.ffmpeg.org/wiki/Encode/MP3 for more options.
  • make sure you convert to equal or lower quality (it would not make much sense to convert to better quality than the source)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.