Software & AppsOperating SystemLinux

Converting AAC to MP3 via Command Line

Ubuntu 18

In today’s digital age, audio files come in various formats, each with its own set of advantages and disadvantages. Two common audio file formats are AAC (Advanced Audio Coding) and MP3 (MPEG Audio Layer-3). While AAC is known for its superior sound quality, MP3 is more universally accepted and played on virtually all devices. Therefore, converting AAC to MP3 can be beneficial for compatibility reasons.

In this article, we will guide you through the process of converting AAC to MP3 using the command line, specifically using the ffmpeg utility.

Quick Answer

Yes, it is possible to convert AAC to MP3 via the command line using the ffmpeg utility. Simply use the command ffmpeg -i inputfile.m4a -acodec libmp3lame -ac 2 -ab 160k outputfile.mp3 to convert your AAC file to MP3 format.


Before we dive into the conversion process, it’s important to ensure that the ffmpeg utility is installed on your system. If it’s not, you can install it via the software center or synaptic manager.

Converting AAC to MP3

Once you have ffmpeg installed, you can convert AAC files to MP3 with the following command:

ffmpeg -i inputfile.m4a -acodec libmp3lame -ac 2 -ab 160k outputfile.mp3

Let’s break down this command:

  • ffmpeg: This is the command-line tool that we use for converting multimedia files.
  • -i inputfile.m4a: This specifies the input file that you want to convert. Replace inputfile.m4a with the name of your AAC file.
  • -acodec libmp3lame: This tells ffmpeg to use the libmp3lame codec to encode the audio into MP3 format.
  • -ac 2: This specifies the number of audio channels. 2 stands for stereo.
  • -ab 160k: This sets the audio bitrate to 160 kilobits per second, which is a good standard for audio quality.
  • outputfile.mp3: This is the name of the output file. Replace outputfile.mp3 with what you want to name your converted MP3 file.

Handling Header Issues

In some cases, you might encounter issues with missing headers in the resulting MP3 file. If this happens, you can add the -write_xing 0 option to the command:

ffmpeg -i inputfile.m4a -acodec libmp3lame -ac 2 -ab 160k -write_xing 0 outputfile.mp3

The -write_xing 0 option ensures that the headers are included in the output file.

Ensuring Proper Bitrate

Remember that the -ab parameter takes bits per second, not kilobits per second. So, if you want a bitrate of 160 kilobits per second, you should use -ab 160k instead of just -ab 160.

Checking Codecs

If you encounter any issues with the encoding process, make sure you have the necessary codecs installed. You can use the libavcodec-extra-52 package or the ubuntu-restricted-extras package to ensure all relevant codecs are installed.


Converting AAC to MP3 via the command line using ffmpeg is a straightforward process once you understand the commands and parameters. For more information on MP3 encoding with FFmpeg, you can refer to the FFmpeg MP3 Encoding Guide.

Remember to always respect copyright laws when converting and distributing audio files. Happy converting!

How do I install `ffmpeg` on my system?

To install ffmpeg, you can use the software center or synaptic manager on your system. Alternatively, you can use the following command in the terminal:

sudo apt-get install ffmpeg
Can I convert multiple AAC files to MP3 at once?

Yes, you can convert multiple AAC files to MP3 at once by specifying multiple input files in the command. For example:

ffmpeg -i inputfile1.m4a -i inputfile2.m4a -acodec libmp3lame -ac 2 -ab 160k outputfile1.mp3 outputfile2.mp3

This command will convert both inputfile1.m4a and inputfile2.m4a to MP3 format, creating outputfile1.mp3 and outputfile2.mp3 respectively.

Can I choose a different audio bitrate for the MP3 output?

Yes, you can choose a different audio bitrate for the MP3 output by modifying the -ab parameter in the command. For example, if you want a bitrate of 256 kilobits per second, you can use -ab 256k instead of -ab 160k.

Can I convert MP3 files to AAC using the same command?

Yes, you can convert MP3 files to AAC using the same ffmpeg command. Simply change the input file extension to .mp3 and the output file extension to .m4a. For example:

ffmpeg -i inputfile.mp3 -acodec aac -strict experimental outputfile.m4a

This command will convert inputfile.mp3 to AAC format, creating outputfile.m4a.

Are there any other options or parameters I can use with `ffmpeg` for audio conversion?

Yes, ffmpeg offers a wide range of options and parameters for audio conversion. You can refer to the ffmpeg documentation or use the ffmpeg -h command to see a list of available options and their descriptions. Additionally, you can explore the FFmpeg Wiki for more detailed information and examples.

Leave a Comment

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