Skip to content

Converting a M4A File to MP3 With ffmpeg

ffmpeg, audio conversion, M4A, MP32 min read

In this article, we will explore the process of converting M4A (MPEG-4 Audio) files to the widely supported MP3 format using ffmpeg. The ability to convert audio files between different formats can be useful in various scenarios, such as compatibility with different devices or reducing file sizes without significant loss in audio quality.

Before we proceed, make sure you have ffmpeg installed on your system. You can download it from the official website ( or install it through package managers like Homebrew (macOS) or apt (Linux).

Converting M4A to MP3

Once ffmpeg is set up, open your command-line interface and navigate to the directory containing the M4A file you wish to convert. To convert the M4A file to MP3, use the following command:

1ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 output.mp3

Let's break down what this command does:

  • -i input.m4a specifies the input file, where input.m4a should be replaced with the actual filename of your M4A file.
  • -codec:a libmp3lame sets the audio codec to libmp3lame, which is used for MP3 encoding.
  • -qscale:a 2 determines the audio quality of the output file. The value 2 represents a good balance between file size and audio quality. You can experiment with higher or lower values based on your requirements.
  • output.mp3 specifies the name of the output file. Feel free to choose a different name or path for your converted MP3 file.

After executing the command, ffmpeg will start the conversion process, displaying progress information in the terminal. Once completed, you will find the converted MP3 file in the same directory as the input file.

Additional Options

ffmpeg provides various additional options that you can use during the conversion process to further customize the output. Here are a few examples:

Specifying Bitrate

You can control the bitrate of the output MP3 file using the -b:a option followed by the desired bitrate value in bits per second (bps). For example, to set a bitrate of 192 kbps, modify the command as follows:

1ffmpeg -i input.m4a -codec:a libmp3lame -b:a 192k output.mp3

Preserving Metadata

By default, ffmpeg copies only basic metadata from the input file to the output file. If you want to preserve all available metadata, including album art, artist information, and other details, use the -map_metadata 0 option before the output file parameter:

1ffmpeg -i input.m4a -codec:a libmp3lame -qscale:a 2 -map_metadata 0 output.mp3

Converting Multiple Files

To convert multiple M4A files to MP3 in one go, you can use wildcards (*) to specify a pattern for the input filenames. For example, to convert all M4A files within a directory, use the following command:

1ffmpeg -i '*.m4a' -codec:a libmp3lame -qscale:a 2 output-%03d.mp3

This command converts all M4A files in the current directory and saves each MP3 file with a sequential three-digit number appended to the filename.

Converting M4A files to MP3 format is made easy with ffmpeg's powerful capabilities. Whether you need to ensure compatibility or optimize file sizes, ffmpeg provides a versatile solution for audio conversion tasks. Try out the examples provided in this article to get started, and don't hesitate to explore ffmpeg's extensive documentation for further options and possibilities.