MP4 Is a Container, Not a Codec: Why Some MP4 Files Will Not Play
Explain track codecs, profiles, levels, pixel formats and inspection before transcoding.
Why the MP4 Extension Guarantees Nothing About Playback
A file ending in .mp4 tells you the wrapper format, not what is inside. The container follows the ISO Base Media File Format specification, identified by the ftyp box and the video/mp4 MIME type. The Library of Congress notes that MP4 can hold "a wide variety of compressed video and audio streams, including but not limited to MPEG-4 Part 2, MPEG-4 Part 10 (AVC/H.264), MPEG-H Part 2 (HEVC/H.265), and MPEG-4 AAC audio" (LOC FDD000155). A player that handles the container can still fail on the contents. The file is not corrupted; the decoder simply cannot process the stream it found.
Track Codecs: What the Container Actually Holds
Each MP4 file contains one or more tracks, and each track declares a codec identifier. Common video codecs found in MP4 files include:
- AVC (H.264) — Baseline support across browsers, mobile devices, and set-top boxes.
- HEVC (H.265) — Higher compression efficiency, but absent from many older hardware decoders and some software players.
- AV1 — Royalty-free with strong compression, though hardware decode support remains limited to recent chipsets.
- MPEG-4 Part 2 — Older format sometimes muxed into MP4; many current players reject it despite a valid container.
- ProRes and DNxHD — Professional intermediate codecs that require specific decoders not bundled with consumer players.
Audio tracks add another variable. An MP4 file may contain AAC, MP3, AC-3, Opus, or uncompressed PCM. A file that plays video silently often carries an audio codec the player cannot decode, even though the container structure is correct.
Profiles and Levels: Constraints Within a Supported Codec
A player that supports H.264 does not support every H.264 stream. The profile defines the coding tools used, and the level caps resolution, bitrate, and reference frames.
H.264 profiles range from Baseline (constrained for low-power devices) to High (full toolset) and High 10 (10-bit color depth). Many hardware players stop at High Profile, level 4.0 or 4.1. Level 4.0 limits 1080p to roughly 30 frames per second; level 5.1 handles 4K at 60 fps. A stream encoded at level 5.2 will fail on a decoder built for level 5.1, even though the codec name matches.
Observable check: Run ffprobe -v error -show_entries stream=codec_name,profile,level -of default=noprint_wrappers=1 input.mp4. If the profile reads High 10 or the level exceeds your device specification, the decoder will reject the stream.
Pixel Formats: When the Decoder Produces Garbage or Nothing
Most consumer video uses 8-bit YUV 4:2:0, reported as yuv420p. MP4 files can also contain:
- 10-bit video (
yuv420p10le,yuv422p,yuv444p) — Common in HEVC and some H.264 encodes. Many hardware decoders and older software players only handle 8-bit. - RGB video — Rare in MP4; most playback pipelines expect YUV.
- Alpha channel data — Not supported by standard MP4 playback paths.
A 10-bit stream on an 8-bit-only decoder may produce corrupted output or no output at all. The container passes validation; the pixel format does not.
Observable check: ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt,color_space -of default=noprint_wrappers=1 input.mp4. A value other than yuv420p signals a compatibility risk.
Hard Limits That Remuxing Cannot Fix
Some incompatibilities require re-encoding. Others are irrecoverable regardless of the toolchain.
| Limit | Example | Resolution |
|---|---|---|
| Unsupported codec | HEVC on a 2014 smart TV | Re-encode to H.264 |
| Profile too high | H.264 High 10 on a set-top box | Re-encode to High, level 4.0 or lower |
| Level exceeded | 4K 60 fps at level 5.2 on a 1080p TV | Re-encode with a capped level |
| Pixel format mismatch | 10-bit video on an 8-bit decoder | Re-encode to 8-bit YUV 4:2:0 |
| Audio codec absent | Opus in MP4 on a PlayStation 4 | Re-encode audio to AAC |
What re-encoding cannot recover: If the source was encoded with a lossy codec at a low bitrate, transcoding to a compatible format introduces generation loss. Detail discarded during the original compression cannot be restored by changing codecs or containers. A 1 Mbps H.264 file re-encoded to HEVC will not gain quality; it will lose a small additional amount.
Inspection Before Transcoding: A Three-Step Sequence
Systematic inspection prevents re-encoding a file that only needs a container repair, or worse, re-encoding into a format that still fails.
Step 1: Verify the container format
ffprobe -v error -show_entries format=format_name -of default=noprint_wrappers=1 input.mp4
Expected output: mp4. Output such as mov,mp4,m4a,3gp,3g2,mj2 indicates an MP4-family file with non-standard box ordering. This rarely blocks playback but can confuse older parsers.
Step 2: List all tracks and their codecs
ffprobe -v error -show_entries stream=index,codec_name,codec_type -of default=noprint_wrappers=1 input.mp4
A codec_type=video entry with codec_name=hevc on a device that only decodes H.264 identifies the failure point directly.
Step 3: Inspect profile, level, and pixel format for the video track
ffprobe -v error -select_streams v:0 -show_entries stream=profile,level,pix_fmt -of default=noprint_wrappers=1 input.mp4
Compare the output against the target device specification. Consumer hardware documentation typically states limits such as "H.264 High Profile up to Level 4.1" or "HEVC Main Profile up to Level 5.0." Any value exceeding those limits requires a re-encode.
Remux or Re-Encode: Choosing the Correct Operation
When the codec, profile, level, and pixel format all fall within the device limits but playback still fails, the container may be malformed or missing metadata boxes. A remux copies the streams into a fresh container without touching the compressed data:
ffmpeg -i input.mp4 -c copy -map 0 output.mp4
This operation is lossless and fast. It resolves box ordering problems and some header corruption without degrading quality.
When any stream parameter exceeds device capabilities, re-encoding is necessary. The following command produces a broadly compatible H.264 file:
ffmpeg -i input.mp4 -c:v libx264 -profile:v high -level 4.1 -pix_fmt yuv420p -c:a aac output.mp4
This forces High Profile at level 4.1 with 8-bit YUV 4:2:0 and AAC audio. The cost is processing time and the quality loss inherent in any lossy-to-lossy transcode.