How to Choose the Best Audio File Format and Codec

audio file formats

From .MP3, .M4A, .AAC and more, there are many audio file formats you can expect to come across as a developer handling audio/video content in your application. Like in our last article The Complete Image File Extension List for Developers, and The Complete List of Video File Formats and Codecs, in this article we’ll delve into the different types of audio file types, and when to use which type of audio or video format for your application.

First, let’s answer a couple of common questions:

What is the best audio format for sound quality?

A lossless audio file format is the best format for sound quality. These include FLAC, WAV, or AIFF. These types of files are considered “hi-res” because they are better or equal to CD-quality. The tradeoff is that these files will be very large.

What audio file format is best for use on the Web?

From a browser compatibility standpoint, .MP3 and .MP4 are the best audio file formats for use on the Web. All modern browsers support this format, including IE9. Other formats that are supported by most browsers include OGG, WebM, AAC, and WAV.

What is the most popular audio format?

MP3 files are the most popular audio format. In decades past, their ubiquity inspired an entire category of devices (MP3 Players), and their popularity continues to this day. MP3’s can be created in a variety of bit rates, which is used to balance the file’s quality and size. Their efficient size has made them the standard format to exchange audio on the Web.

How do I convert an audio file from one format to another?

For converting files manually, use a program like VLC Media Player to convert between popular audio file formats.

To programmatically convert files, Filestack offers an audio transcoding API that makes converting audio files a breeze. Learn more on how to convert audio using Filestack.

Audio File Formats

.MP3

.MP3 files are the most common audio file around. MP3s feature lossy compression, which means their quality will degrade over subsequent edits. MP3s are still relatively large in size when compared to other audio file formats on this list.

mp3 audio file format

Image From: Amazon Music Download Store

.MP3 files can be encoded at a constant bit rate or variable bit rate. A constant bit rate ensures the same quality throughout the audio file but results in higher file size. Variable bit rate detracts from quality during silent or near-silent moments of a file, resulting in smaller overall file size. Most smartphones and music players use the .MP3 format.

.M4A

.M4A is an Apple-based format that corresponds to .MPEG-4 video files. .M4A files feature lossless compression, allowing for multiple edits without a loss of quality. Compared to the other audio file formats on this list, .M4A files have a similar quality but are lower in file size. You will see .M4A files play audio on Apple products such as iPhones and iPods.

.AAC

Like MP3s, Advanced Audio Coding (AAC) files are also lossy audio files. However, .AAC files, in their original state, are much higher in quality than any of the other audio file formats on the list. .AAC files are generally similar in size to MP3s, despite being a tad higher in quality.

They can also be created with a variable bit rate or constant bit rate. .AAC files are also open-source, which means you don’t need to pay royalties to create and distribute them (unlike .MP3 files).

.AAC files are most commonly associated with iTunes, though they can be used on other player devices and gaming consoles.

aac audio file format

Image From: iTunes

.OGA, .OGG

Similar to .AAC files, .OGA files are open-source and utilize lossy compression. They use variable bit rate to cut down on file size. However, this doesn’t detract from the overall sound quality. In fact, .OGA files tend to be higher in quality than MP3s. .OGA files aren’t supported by many programs – especially compared to the rather ubiquitous .MP3.

.FLAC

Like M4A, FLAC is a lossless audio format. Unlike M4A, FLAC is open source and features a more efficient compression algorithm, which can reduce the file by 50-70% over its original size. This format is popular among audiophiles as a way to store collections of music in their highest quality form. Because it is open source, it is compatible with many devices and programs.

.PCM, .WAV, .AIFF

PCM, or Pulse-Code Modulation is an uncompressed audio format that is commonly used in CDs and DVDs. This format uses a “sampling rate” which defines how often the original audio was sampled, and a “bit depth” which defines how many bits are used to define each sample.

WAV, or Waveform Audio File Format is commonly used as a wrapper format to store PCM format audio, making it more suitable for Windows computers.

AIFF, or Audio Interchange File Format, like WAV, is commonly used as a wrapper format to store PCM format audio, except for Mac computers.

How to Choose the Right Audio File Format

Choosing the right audio format depends entirely on what you plan on using the audio for. You should choose a format that achieves the quality of audio you require, but nothing more. Unnecessarily high-quality audio files can be unwieldy to move, share, convert, and manage. Consider a couple of scenarios:

  • If you are a professional that is planning to edit the audio (for a podcast for example), then use an uncompressed format. This way, you will maintain the audio’s quality each time you edit and save the file. When you are finished, you can export to an easier-to-distribute compressed format. Uncompressed formats include PCM, WAV, and AIFF.
  • If you are an audiophile wanting to listen to your music collection in hi-fidelity, choose a format that uses lossless audio compression. You will use less storage than an uncompressed format, but still retain the full quality of the original recording. These formats include FLAC, WMA, M4A.
  • If you are not concerned with perfect audio quality, plan on sharing the file on the Web, or need to conserve disk space, choose a format that uses lossy audio compression. Luckily, lossy compression has become so good in recent years that most people can’t tell the difference between lossy and lossless compression. These formats include MP3, OGA, AAC

Conclusion

In summary, the most popular audio file types are:

  • .MP3
  • .M4A
  • .AAC
  • .OGA
  • .FLAC
  • .WAV
  • .PCM
  • .AIFF

There are certain times when it is best to use one file format over another, and often, you have to convert between file formats. To programmatically convert between audio or video file types, you can use Filestack’s audio transcoding API or video transcoding API.  Filestack’s API also supports extracting audio files from video files, cropping or resizing video files, extracting thumbnails from videos, and more. Get started for free with Filestack today.

Read More →

Ready to get started?

Create an account now!