Utilo

M4A MIME Type – Free, Online, Private

audio/mp4 is the type for AAC or ALAC in an MP4 container. .m4a is the audio extension.

What .m4a is

An .m4a file is an MP4 container with an audio track and no video track. It starts with an ftyp box. Brands you will see include M4A , mp42, and isom. The sample description is usually mp4a for AAC. ALAC also shows up in this extension from Apple tools. RFC 4337 registers audio/mp4 for audio in this container. video/mp4 is the type when the file is a movie. Using the video type for a song makes some clients open a video player with a black frame. Using audio/aac is wrong because the bytes are not ADTS.

IANA registers audio/mp4 in RFC 4337. The container is ISOBMFF, the same family as video/mp4. The media type is audio/mp4. Extensions that use it on this page: .m4a. A client compares the type, not the filename, once the response has arrived. The filename still matters on disk and in Content-Disposition, which is why a wrong extension and a wrong header are two different bugs.

What sends audio/mp4

What sends audio/mp4: Send audio/mp4 for .m4a. You can add a codecs parameter such as audio/mp4; codecs="mp4a.40.2" for AAC-LC. That string is what a browser's canPlayType expects. Serve Accept-Ranges: bytes. The moov atom holds the index. If moov sits at the end of a large file, a player cannot start until it has fetched the tail, unless it can range-request. Move moov to the front when you encode, and keep the type the same. The atom order is not a different media type. The file on disk is still .m4a. Once the response exists, a client trusts audio/mp4, not the filename. If you also offer the same recording as MP3, use two URLs. A single URL that switches between audio/mp4 and audio/mpeg needs Vary and still confuses players that sniffed the first response. Two URLs are the simpler contract.

Content-Type for .m4a

Send audio/mp4 and do not add a charset parameter. The body is binary. A charset tells a text decoder to reinterpret bytes that are not text, which corrupts a download and does not help a browser sniff the format.

Content-TypeContent-Type: audio/mp4

nginx, Apache, and Express

These snippets map .m4a to audio/mp4. nginx reads the types block when it picks a type from the URL's extension. A location that sets default_type, or an application that sets the header itself, overrides that map. Apache AddType applies in the directory context where you put it. The Express static example writes the header for files ending in .m4a so a stale mime database in the framework cannot disagree with the type on this page.

nginx# /etc/nginx/mime.types, inside the types { } block
audio/mp4                   m4a;
ApacheAddType audio/mp4 .m4a
Expressimport express from "express";

const app = express();
app.use(express.static("public", {
  setHeaders(res, filePath) {
    if (filePath.endsWith(".m4a")) {
      res.setHeader("Content-Type", "audio/mp4");
    }
  },
}));

Pitfalls for audio/mp4

Pitfalls that show up for audio/mp4, and not for a neighboring type with a similar extension: A file whose moov is last and whose server rejects Range will not start in the browser until the download finishes. Fix the atom order or enable ranges. Do not 'fix' it by switching the type to audio/mpeg. Another trap is a DRM-wrapped M4P served as audio/mp4. The box type is different and a normal player will not decrypt it. A third is sending audio/mp4 for an MPEG-DASH initialization segment that is not a complete file. Init segments often use video/mp4 or audio/mp4 on purpose, and the client stack expects that. A bare audio element does not.

  • audio/m4a and audio/x-m4a are unofficial. Send audio/mp4.
  • The codecs parameter uses the MP4A object type. mp4a.40.2 is AAC-LC. Guessing the string makes canPlayType lie.
  • A video track smuggled into an .m4a should be video/mp4 or it should be removed. The extension is not the authority.
  • Do not add a charset. ftyp is binary.

Frequently asked questions

Is the type audio/m4a?

No. The registered type is audio/mp4. audio/m4a is an unofficial alias.

How is this different from .aac?

.aac is usually raw ADTS and uses audio/aac. .m4a is an MP4 container and uses audio/mp4.

Why does playback wait until the file ends?

The moov atom is probably at the end and the server is not honoring Range. Move moov forward or allow ranges.

What does the file start with?

An ISOBMFF size and the fourcc ftyp.