MP4 Rotation Metadata: Why Video Is Sideways in Some Players

November 08, 2026 · MP4.now Editorial · MP4 Troubleshooting

Explain display matrices versus baked pixels and safe normalization without unnecessary quality loss.

MP4 Rotation Metadata: Why Video Is Sideways in Some Players

The Two Ways a Video Can Be Rotated

A sideways MP4 is not a single problem with a single fix. The distinction between rotated pixels and a rotation instruction determines whether you can fix the file without quality loss.

Baked Pixels: The Video Stream Is Already Turned

When the image is physically rotated during encoding, every frame has its pixel rows and columns rearranged. A 1920×1080 landscape scene rotated 90° becomes a 1080×1920 portrait frame stored in the bitstream. The player decodes the pixels exactly as they are stored—it has no alternative. If you see a sideways image from this method, the encoder already committed the rotation. Fixing it requires a full re-encode, which introduces generation loss.

Rotation Metadata: An Instruction Applied at Render Time

MP4 files can carry metadata that tells a compliant player to rotate the decoded image before display. The video stream remains in its native orientation. No pixels are recalculated, and no quality is lost. This instruction is stored as a display matrix in the tkhd atom within the moov box, or as a rotate value in the moov/udta metadata structure.

The Library of Congress format description for MP4 (FDD 000155) documents that the tkhd atom contains a 3×3 affine transformation matrix specifying rotation, scaling, and translation for the track's visual presentation. The matrix is applied during playback, not during decoding.

The fingerprint of metadata-only rotation: the file plays correctly in some applications (VLC, QuickTime) but sideways in others (Windows Media Player, certain smart TVs). That inconsistency is the diagnostic signal.

Confirming Rotation Is Metadata Before You Act

Before modifying anything, verify that the rotation lives in metadata rather than in the encoded pixels.

Inspect the Display Matrix

Open the file in a tool that reads MP4 atom structure. Locate the tkhd atom and examine its transformation matrix.

A default matrix with no rotation:

1.0  0.0  0.0
0.0  1.0  0.0
0.0  0.0  1.0

90° clockwise rotation:

0.0  1.0  0.0
-1.0 0.0  0.0
0.0  0.0  1.0

180° rotation:

-1.0  0.0  0.0
0.0  -1.0  0.0
0.0   0.0  1.0

270° (or –90°) rotation:

0.0  -1.0  0.0
1.0   0.0  0.0
0.0   0.0  1.0

Some tools also expose a rotate metadata field in degrees. If a non-zero rotation value is present and the video stream dimensions match the original shooting orientation (for example, 1920×1080 for a landscape shot), the rotation is metadata-only.

The Pixel Test

Export a single frame as a still image (JPG or PNG). Open that still in any image viewer. If the image is sideways, the rotation is baked into the pixels. If the still is upright, the rotation is metadata—your video stream is correctly oriented, and the player is following or ignoring the instruction depending on its implementation.

Why Players Disagree on Rotation

MP4 is a container format, not a playback specification. Different players implement rotation metadata with varying levels of compliance.

Players That Honor the Display Matrix

  • VLC media player (version 3.0 and later) reads the tkhd matrix and applies it during rendering.
  • QuickTime Player and Apple's system-level decoder respect the matrix.
  • HandBrake reads rotation metadata when scanning source files to auto-rotate output.

Players That Ignore the Display Matrix

  • Windows Media Player and many built-in Windows codecs ignore the matrix and display raw decoded pixels.
  • Older smart TV decoders (pre-2018) frequently skip the matrix.
  • Some browser-based players in sandboxed environments strip metadata before rendering.

The result: a file that plays correctly on one device but sideways on another. Neither behavior is a bug—it is a mismatch between what the container stores and what the player expects.

Two Ways to Normalize Orientation

Strip or Reset the Rotation Metadata (No Re-encode)

If the pixel test confirms the video stream is upright, you can remove the rotation instruction without touching the encoded data. This operation is lossless.

Use a tool that modifies MP4 atoms without decoding the video stream:

  • MP4Box (part of GPAC): Extract the video track with MP4Box -raw 1 input.mp4, then rebuild with MP4Box -add extracted.h264 -new output.mp4. The new file has an identity matrix.
  • ffmpeg with stream copy: ffmpeg -i input.mp4 -map_metadata -1 -c copy output.mp4 strips all metadata and copies video and audio bitstreams unchanged. The output has no rotation instruction.

After this operation, the video displays in its native orientation in every player. If the original source was shot sideways, the output will be sideways everywhere—but the behavior will be consistent across players.

Re-encode to Bake the Rotation into Pixels

If the source was shot in portrait orientation and you need landscape output, you must re-encode. Use ffmpeg with a rotation filter:

ffmpeg -i input.mp4 -vf "transpose=1" -c:a copy output.mp4

The transpose=1 filter rotates 90° clockwise. Every frame is decoded, rotated, and re-encoded. This is a lossy operation even at high bitrate. The quality loss comes from the re-encode of the video stream, not from the rotation itself.

Hard Limit: What Cannot Be Recovered

If the original file has baked rotation (the pixel test confirmed it), stripping metadata will not fix the orientation. You must re-encode. If the source has already been re-encoded multiple times, each rotation adds cumulative generation loss. No tool can recover the original pixel arrangement from a rotated encode without access to the pre-rotation source.

When to Keep Metadata Rotation and When to Remove It

Keep metadata rotation if:

  • You control the playback environment and all viewers use VLC, QuickTime, or another player that honors the display matrix.
  • The file is a master copy and you want zero quality loss.
  • You are archiving the file and preservation of the original encode matters.

Remove metadata rotation if:

  • The file is shared with unknown recipients who may use players that ignore the matrix.
  • You are uploading to a platform that strips metadata during processing (YouTube, Vimeo, social media).
  • The file must play on smart TVs, game consoles, or embedded players with limited MP4 parsing.

Verifying the Result

After modifying the file, run the pixel test again. Export a still frame from the new file and confirm it matches the original. Then play the file in at least two players—one that honors metadata (VLC) and one that ignores it (Windows Media Player). If both show the same orientation, the normalization succeeded.

If the file still behaves differently between players, the rotation metadata was not fully removed. Inspect the tkhd matrix directly with a hex viewer or an atom inspector. The Library of Congress specification (FDD 000155) provides the byte layout for the transformation matrix if manual verification is necessary.

For batch processing of files with inconsistent rotation metadata, a metadata-stripping workflow using ffmpeg with - c copy is the fastest lossless approach. For individual files where you need to inspect atom structure before deciding, an MP4 atom inspector can display the exact rotation values.

Technical basis for MP4 Rotation Metadata

Structural claims in this guide are grounded in the primary MP4 technical reference.