VionetoVioneto
Back to the magazine

VIONETO MAGAZINE Playback & technology

Why your phone video plays sideways

The pixel dimensions of a video don't fully determine its display orientation. A dedicated test highlights the difference between rotation metadata and the actual rotated image data.

Two video cards display the same plant once from the side and once upright. A curved arrow links the two perspectives.
A shooting instruction and newly captured image data can lead to the same view. The illustration is for reference only.Image: Vioneto · AI-generated illustration

If a video appears sideways, check both its stored image dimensions and any existing rotation metadata. For example, a file might have a resolution of 320 × 180 pixels and additionally specify that it should be rotated during display. Whether a particular playback or processing step respects this instruction must be verified at the actual output stage.

Two ways to get a rotated view

A rotation hint first modifies the display instruction. The encoded image data can remain unchanged in this case. In contrast, applying a picture rotation via a filter reassigns pixel positions and requires a new encoding for the standard compressed output file. FFmpeg distinguishes between these two approaches: display_rotation specifies a display rotation; during transcoding, autorotate can be applied at the filter stage.

FFmpeg: Display rotation and automatic rotation

A dedicated test with an asymmetric image

For this article, we generated a silent H.264 clip on November 13, 2026, using FFmpeg 8.0.1: one second long, 25 frames, 320 × 180 pixels. An orange field was positioned in the top-left corner, and a turquoise field in the bottom-right corner. The uneven markings make the alignment visible; a uniformly colored image would not serve this purpose.

A copied version received a rotation hint of 90 degrees. FFprobe still reported 320 × 180 pixels along with the additional rotation value. When decoding with automatic rotation explicitly disabled, all 25 frames matched the original exactly. Therefore, in this test, the rotation hint preserved the undistorted frame sequence.

The original test image in portrait format: orange area in the top left, turquoise area in the bottom right on a dark blue background.
Stored image resolution of the original and metadata version without automatic rotation: 320 × 180 pixels.Image: Vioneto · original synthetic test file

The second version was rotated left using the transpose=cclock filter and re-encoded. It then had a resolution of 180 × 320 pixels and no additional rotation metadata. For this small comparison, we used a lossless H.264 setting. This is a test decision and not a general recommendation for producing the smallest possible website files.

The left-rotated test pattern in landscape format: turquoise area in the top right and orange area in the bottom left.
After the actual image capture, the test file contains 180 × 320 pixels. In this test, the image sequence matches the automatically aligned metadata version.Image: Vioneto · original synthetic test file

FFmpeg: Directions and behavior of the transpose filter

Additionally, we compared the automatically aligned metadata decoding with the newly rotated version: the decoded images matched. This confirms the difference between this synthetic file and the decoder used. However, automatic correction during upload or identical behavior across all browsers and smartphones was not tested.

First, inspect the existing file

With FFprobe installed, you can for example view the video stream of a local file like this:

ffprobe -v error -select_streams v:0 -show_streams -of json eingabe.mp4

Check the width, height, and optionally the rotation values in the additional stream data. Then verify a clearly recognizable image. Simply swapping width and height or changing a display setting does not confirm correct orientation of the content. Existing mirrorings or other transformations require separate evaluation.

Verify the same image point before and after upload

  1. Select a location with clear orientation, such as readable text or a person whose upright position is clearly visible.
  2. Compare the original file, the new export, and the actual generated viewer player. Note at which stage the display differs.
  3. If the image data is already correctly oriented, check whether an additional rotation hint triggers further rotation. Do not modify the original file without justification.
  4. Keep a clear new export version and also check thumbnail, image crop, and subtitles within the intended playback sequence.

Separate containers, codecs, and file formats

Test the player on narrow screens

Topics

Sources and further reading

  1. https://ffmpeg.org/ffmpeg.html
  2. https://ffmpeg.org/ffmpeg-filters.html#transpose