A family recording can look upright in your photo library and sideways after import into an editor. An MP4 can store a landscape frame along with an instruction to turn that frame for display. If the instruction is wrong, correct it on a copy. If the instruction is right but the destination ignores it, make a viewing copy with upright pixels. Keep the original recording.
Find the stored frame and the intended top
Pick a landmark you recognize, such as a sign with readable lettering, a face or the horizon. Note where it should appear. Open the same moment in both the source library and the program where the problem occurs.
ffprobe -v error -select_streams v:0 -show_streams -of json original.mp4
Inspect the first video stream’s width, height and side_data_list. A Display Matrix can include a rotation value. A 320 × 180 frame with a 90° instruction is still stored 320 pixels wide. Absence of a rotation entry doesn’t tell you which way the camera was pointing. If the image is upright but faces look too wide or thin, check the storage and display aspect ratios. ffprobe stream inspection
If your viewers disagree, inspect a frame with automatic rotation disabled. Use the landmark to decide which way the stored picture needs to turn. This command writes the first video frame to a new PNG. If the first frame is black, add -ss 5 before -i to inspect a moment five seconds into a longer recording.
ffmpeg -n -noautorotate -i original.mp4 -map 0:v:0 -frames:v 1 stored.png
Choose which copy to make
| What you observe | What to do |
|---|---|
| The raw frame is sideways and a quarter-turn would put the landmark upright. The intended player honors rotation metadata. | Set the display rotation, then check the result in that player. |
| The file already displays correctly in a viewer that honors its matrix, but the intended editor imports it sideways. | Encode a viewing copy that applies the existing rotation to the pixels. |
| Every intended app already shows the recording upright. | Keep the current file. A landscape storage size alone is no reason to convert it. |
Correct the instruction. In this example the stored frame needs a 90° counterclockwise turn. FFmpeg’s input option sets the rotation relative to the stored frame. It replaces the existing transform. Use -90 for a clockwise quarter-turn, or 0 if the pixels are already upright and an erroneous turn needs clearing. These examples assume a simple rotation with no mirroring. Check that your installed FFmpeg supports -display_rotation. FFmpeg rotation and stream options
ffmpeg -n -display_rotation:v:0 90 -i original.mp4 -map 0:v:0 -map "0:a:0?" -c copy tagged.mp4
The MP4 output carries the display instruction. Stream copy keeps the selected encoded streams intact. These commands select the first video and, if present, the first audio. Check for additional languages, commentary or subtitles before using this as your only viewing copy. Audio and subtitle inventory
Make upright pixels. Start from the copy whose display instruction puts the landmark in the right place. FFmpeg applies that instruction by default when transcoding video. Adding another rotation filter here could turn an upright picture sideways again. The example copies an MP4-compatible audio stream and encodes the picture with H.264.
ffmpeg -n -i tagged.mp4 -map 0:v:0 -map "0:a:0?" -c:v libx264 -crf 18 -c:a copy upright.mp4
Check which part actually changed
Using FFmpeg 7.1 on Windows, we made a two-second H.264/AAC clip with a red block in the upper-left corner of a 320 × 180 black frame. With a +90° matrix, FFmpeg still found the block at the upper left when decoding without automatic rotation. With rotation applied, it appeared at the lower left of a 180 × 320 picture. The selected video and audio packet payloads matched the original in order.
The re-encoded copy stored 180 × 320 pixels, with the block at the lower left even when automatic rotation was disabled. ffprobe reported no rotation side data on that video stream. The audio packet payloads still matched. Those measurements describe this generated sample.
For your footage, inspect the output with the same ffprobe command and open it in the editor or player that originally showed it sideways. Compare the landmark, duration and sound. If you’re handing over more than one recording, check the intended top in each clip before joining camera clips.