About AAC audio files
A bare AAC stream in ADTS framing, as used by internet radio and HLS audio segments. For files people download and keep, the same audio in an M4A container is better, because it carries metadata and allows accurate seeking.
Other types seen for these files:
audio/x-aac
. Accept them when reading uploads, but send audio/aac yourself.
File signature
AAC files start with FF F1 or FF F9 (ADTS frame sync). The extension and the type a browser reports for an upload both
come from the file name, so check these bytes on the server before trusting a file.
Serve .aac with the right Content-Type
Content-Type: audio/aac
audio/aac aac;
AddType audio/aac .aac
@aac path *.aac
header @aac Content-Type "audio/aac"
curl -sI https://example.com/file.aac | grep -i '^content-type'
# Content-Type: audio/aac
Set the type in code
res.set('Content-Type', 'audio/aac');
// Or make the browser download it:
res.attachment('file.aac');
import mimetypes
mimetypes.add_type('audio/aac', '.aac') # if your system doesn't know it
mimetypes.guess_type('file.aac')[0] # 'audio/aac'
mime.AddExtensionType(".aac", "audio/aac")
w.Header().Set("Content-Type", "audio/aac")
Accept .aac uploads
<input type="file" accept=".aac,audio/aac">
The accept attribute only filters the file picker; users can still choose another file. Listing the
extension as well as the type matters, because operating systems don’t always report the type you expect.
Related types
-
.m4a (
audio/mp4): M4A audio -
.mp3 (
audio/mpeg): MP3 audio -
.m3u8 (
application/vnd.apple.mpegurl): HLS playlist
More audio
.wav , .ogg , .flac . Look up any extension or type with the MIME type lookup.
Sources
Spotted a mistake? Email hello@devtoolsmith.com and we’ll fix it.
Frequently asked questions
What is the MIME type for .aac files?
audio/aac. You may also see audio/x-aac, which is older or unofficial; send audio/aac. The full header is "Content-Type: audio/aac".
Why does my server send the wrong Content-Type for .aac?
Web servers pick the type from the file extension using a table (mime.types in nginx and Apache). If .aac is missing from that table, they send a default such as application/octet-stream or text/plain. Add the mapping as shown on this page, then check the response with "curl -sI".
How can I check that a file really is AAC?
Look at the first bytes rather than the extension or the type the browser reports, which both come from the file name. AAC files start with FF F1 or FF F9 (ADTS frame sync). The MIME type lookup on this site reads them for you when you drop a file on it.