File Formats and Data Compression
File Format
A file format is a way information is stored in a file. One video file may have a different file format from another video file, depending on how each file was recorded or rendered.
Usually files will have a suffix, known as a file extension, at the end of the file's name. This helps you know what kind of a file format the file is. This extension will usually be three characters, and come after a full stop or period. For example, a file named "vacation.avi" would let you know that the file is an .avi file and that this file is a particular kind of video file.
You could rename the "vacation" part of "vacation.avi" and it would not affect the audio or visual content of the file. However, you should not rename the .avi part of the file because it may prevent a program that would otherwise be able to open the file from doing so. If you want to change a file to another file format, you cannot simply rename the file's extension. For example, renaming "vacation.avi" to "vacation.mov" would not convert the video file to the other file format.
Data Compression - Uncompressed, Lossless, and Lossy
Compression in this section means “data compression”. This means how data is compressed, or coded, in a file format. The more compressed a file is, the smaller its file size is. It depends on the file format (some file formats are more efficient at compressing data), but often a highly compressed file will have low audio quality. (How much quality is lost also depends on the file format.)
As an example of how data compression affects quality, we will look at image data compression, which functions in a similar way to audio data compression (sound waves are squared off, and information is lost when audio files are compressed too much).
Image
Highest image quality |
Image
Lowest image quality |
Both of these images are the same file format, .jpg, which is a lossy file format. |
As you can see, the higher quality image is a larger file size, and the lower quality image is a smaller file size. However, much quality has been lost in the highly compressed image.
Data compression of audio files is similar in this way; a lossy format of audio compression can make audio files a much smaller file size, but at the cost of audio quality.
Some file formats are effective at compressing the data of an audio file, and reducing file size, while maintaining audio quality; file formats that can do this are called "lossless". Other file formats compress data highly, but at the expense of audio quality; these file formats are called "lossy".
Some terms:
- Uncompressed data means there is no data compression. The audio of an uncompressed file is the highest quality, but the file size may be very large.
- Data compression encodes file data so a file is a smaller size than if uncompressed.
- Lossless data compression is a way of compressing data that allows the original uncompressed data to be perfectly reconstructed from the compressed data -- that is, files with lossless compression will be smaller than uncompressed files, but the sound quality will be unaffected (or not very affected) so audio is still of the highest quality.
- Lossy data compression approximates information, and although this allows for much smaller files, it does mean a loss of quality. If a file is saved and re-saved in a lossy format, the audio fidelity/quality will be lost each time the file is re-saved.
Common audio file formats: Lossless versus lossy
Audio compression format: | Filename extension(s): | Lossless / lossy / uncompressed |
Advanced Audio Coding (AAC) | .m4a, .m4b, .m4p, .m4v, .m4r, .3gp, .mp4, .aac | lossy |
Audio Interchange File Format (AIFF) | .aiff, .aif, .aifc | uncompressed |
Apple Lossless Audio Codec (ALAC), or Apple Lossless Encoder (ALE) | .m4a | lossless |
Free Lossless Audio Codec (FLAC) | .flac | lossless |
MPEG-1 Audio Layer I | .mp1 | lossy (and largely outdated) |
MPEG-1 Audio Layer II or MPEG-2 Audio Layer II | .mp2 | lossy |
MPEG-1 Audio Layer III or MPEG-2 Audio Layer III | .mp3 | lossy |
Vorbis (Ogg Vorbis) | .ogg, .oga | lossy |
Waveform Audio File Format (WAV) | .wav, .wave | uncompressed (usually) |
WavPack | .wv | lossless |
WAV (uncompressed) and FLAC (lossless) encode data differently, and so these formats produce different sized files even when these files are of the same length and quality. For example, a 5 minute WAV file (at 192KHz/24 bits) would come to a size of 329 Mb, while the same 5 minute audio clip saved as a FLAC file (also at 192KHz/24 bits) would be 195Mb, or about 60% of the size of the WAVE file. (Information source.) Please note, though, that this is just an example and sizes of all types of compressed files can vary greatly depending on music dynamics, conversion tool used, and what format the file was converted from.
Unless space is of a concern, it is best to archive audio as uncompressed or lossless because once the audio fidelity is lost, it cannot be regained. It is also better to start a project with lossless files -- you can make a lossy file from a project using lossless audio, but you will not regain audio quality by rendering a project with lossy files as a lossless format.
Comparison of Some Common File Formats
- If you need high quality audio files which may be used in a variety of programs, .WAV is usually the best choice of file format (especially if you plan to save and resave the audio files a number of times).
- If you want to e-mail audio or upload audio to a music sharing website, .MP3 is a widely compatible file format that highly compresses a file's size (although some quality is always lost when saving a file as an .MP3).
- If some compression is needed to maximize use of storage space, but audio quality is still important, .FLAC is often a good choice. Although .FLAC is not compatible with some common media players, .FLAC files can later be converted to another lossless file format that more programs can open without losing audio quality. .FLAC can be used by both REAPER and Audacity, the two audio editing programs available at VPL's Inspiration Lab.
If storage space allows, it is also possible to make different copies of the final project with different file formats. That is, a larger uncompressed or lossless file, as well as a smaller lossy file, can be created (most commonly, a .WAV and an .MP3). The smaller file may be e-mailed, or uploaded to a file sharing website, so others can see the final work, while a higher quality master can remain archived for later use.
.WAV (Waveform Audio File Format, sometimes also .wave) is an extremely common uncompressed format which can be opened in many programs. In fact, it is often the best choice for file format when wanting to edit or play back high quality files in various programs because it is so widely supported. However, .WAV files can be very large as the data of the files is not compressed.
(Note, .WAV is not to be confused with the WavPack lossless format, which has .wv as an extension. WavPack is a different format, and not nearly as widely supported as .WAV.)
.MP3 (MPEG-1 or MPEG-2 Audio Layer III) is lossy, and a very commonly used file format. Many devices and computer programs can open .MP3s, and many bands will release songs for download in the .MP3 format. Most home stereos and car stereos can play CDs of .MP3s (some can even play USB sticks with .MP3 files).
However, as .MP3 is a lossy format, some audio fidelity is always lost when converting a file to .MP3. If saving and re-saving a file as an .MP3, with each “generation” (each time the file is resaved) the audio quality will steadily deteriorate.
.FLAC (Free Lossless Audio Codec) is open source, and a lossless format, and is smaller compared to .WAV (i.e. a .FLAC of the same audio and the same quality as a .WAV file will be smaller than the .WAV file).
Although fewer programs support .FLAC playback (than WAV), both Audacity and REAPER can open and create .FLAC files. Also, .FLAC can be converted to another lossless or uncompressed format without deterioration of audio fidelity.
.AIFF (Audio Interchange File Format) is an uncompressed file format developed by Apple. Audacity and REAPER can both import and render AIFF files. However, many programs cannot play AIFF files. (iPhones and other Apple devices can, but many other tablets cannot. Programs that come with Windows computers/PCs do not play .AIFF files, but you can download programs that can play them.
Similar to .WAV files, .AIFF files can be very large because the data is uncompressed.
.ALAC (Apple Lossless Audio Codec) and .ALE (Apple Lossless Encoder) are lossless formats developed by Apple.
.ALAC and .ALE are also more compressed than .WAV or .AIFF (i.e. an ALAC clip of the same audio and the same quality as a .WAV file will be smaller than the .WAV file), but REAPER cannot import .ALAC or .ALE files. Audacity also cannot open .ALAC or .ALE files (unless it has additional components installed).
.ALAC and .ALE are only really practical for someone who plans to primarily work with Apple devices and applications.
Comparison of Common Media Players
Here is a brief comparison of the compatibility of a number of file formats with REAPER, Audacity, and three common audio file playing programs. If someone wants to know if they can listen to rendered audio with a program they use, this table may help.
Format | Extension(s) | REAPER | Audacity | iTunes Media Player | Windows Media Player |
VLC Media Player |
Advanced Audio Coding (AAC) | .m4a, .m4b, .m4p, .m4v, .m4r, .3gp, .mp4, .aac | no | no | yes (yes if iTunes 4 and later, otherwise no) | yes (yes if WMP12 or later, otherwise no) | yes |
Audio Interchange File Format (AIFF) | .aiff, .aif, .aifc | import, render | import, export | yes | yes | yes |
Apple Lossless Audio Codec (ALAC), or Apple Lossless Encoder (ALE) | .m4a | no | no | yes (yes if iTunes 4.5 and later, otherwise no) | yes (yes if WMP12 or later, otherwise no) | no (but plugins allow) |
Free Lossless Audio Codec (FLAC) | .flac | import, render | import, export | no | no | yes |
Musical Instrument Digital Interface (MIDI) | .mid, .midi | import, export project MIDI* | no | no (iTunes 10.3 and earlier, yes, iTunes 10.5 and later, no) | yes (although a computer may not have MIDI supported) | yes |
MPEG-1 Audio Layer I | .mp1 | no | no | no | no | yes |
MPEG-1 Audio Layer II or MPEG-2 Audio Layer II | .mp2 | import only | import, export** | no | yes | yes |
MPEG-1 Audio Layer III or MPEG-2 Audio Layer III | .mp3 | import, render | import, export** | yes | yes | yes |
Quicktime | .m4v, .mov, .mp4, .qt | import only | no | yes (audio only movies) | yes (yes if WMP12 or later, otherwise no) | yes |
Vorbis (Ogg Vorbis) | .ogg, .oga | import, render | import, export | no | no | yes |
Waveform Audio File Format (WAVE, or WAV) | .wav, .wave | import, render | import, export | yes | yes | yes |
Windows Media Video | .wmv | import only | no | no | yes | yes |
WavPack | .wv | import, render | no | no | no | yes |
Note: For Audacity to encode MP3s, it must have the LAME encoder installed. Audacity on computers at VPL's Inspiration Lab has this installed, so MP3s can be encoded with Audacity at VPL's Inspiration Lab.
Also, what REAPER calls "render" is the same as what Audacity calls "export". What REAPER calls "export" is not the same as what Audacity calls "export".