How to fix a sideways or upside-down video
A video that plays sideways or upside down is not corrupted. Phones and many cameras record the sensor image as is and store a rotation flag (a display matrix) telling players to turn it by 90, 180 or 270 degrees. Players that ignore the flag show the raw orientation. You can fix it in two ways: change the flag without re-encoding (instant, lossless), or rotate the pixels permanently (re-encode, works in every player and site).
Check the current rotation
`` ffprobe -v error -select_streams v:0 -show_entries stream_side_data=rotation -of default=nw=1 video.mp4 ``
A result like rotation=-90 means the file carries a rotation flag. No output means no flag: the video was filmed with the camera turned, and the pixels themselves are sideways.
Lossless: set or remove the rotation flag
With a recent FFmpeg (6.0 or later), set the display rotation while copying the streams:
`` ffmpeg -display_rotation 90 -i video.mp4 -c copy rotated.mp4 ``
Use 90, 180, 270 (or -90) as needed; -display_rotation 0 clears the flag. Players that respect the flag (most phones, VLC, QuickTime, browsers, modern Windows apps) show the new orientation, and no quality is lost. Older FFmpeg versions used -metadata:s:v:0 rotate=90 for the same purpose.
Permanent: rotate the pixels
When a player, editor or upload site ignores the flag, rotate the actual image. FFmpeg applies an existing rotation flag automatically when re-encoding; to rotate further, use transpose:
`` ffmpeg -i video.mp4 -vf "transpose=1" -c:v libx264 -crf 18 -c:a copy rotated.mp4 ``
transpose=1: 90° clockwisetranspose=2: 90° counter-clockwisetranspose=1,transpose=1orhflip,vflip: 180°
Without the command line
- Windows Photos / Clipchamp: open the video in Clipchamp (Windows 11), rotate, export. Re-encodes.
- macOS QuickTime Player: Edit > Rotate Left/Right, then File > Save or Export As. Re-encodes on export.
- iPhone and iPad Photos: Edit > crop tool > rotate button. Saves the change non-destructively; when shared, the rotated version is exported.
- Android Google Photos: Edit > Crop > Rotate > Save copy.
- HandBrake: Dimensions tab > Orientation & Cropping > Rotation/Flip. Re-encodes.
- VLC: Tools > Effects and Filters > Video Effects > Geometry > Transform rotates playback only. To save, Media > Convert/Save with the Rotate filter enabled in the profile's video codec > Filters.
Why rotation goes wrong
- Editors and older players that ignore display matrices show the raw sensor orientation.
- Some converters and messaging apps drop the flag when recompressing, but keep the original pixels.
- Orientation lock or a flat phone during filming: the phone could not tell which way was up, so it stored the wrong flag. Fix by setting the correct flag losslessly.
- Repairs and rebuilds: an index rebuilt from a reference can take over the reference file's rotation. If the reference was filmed in a different orientation from the broken clip, the repaired video plays rotated; set the flag losslessly as above, or repair again with a reference filmed the same way.
Mirrored video
Front cameras on some phones save mirrored video. Flip horizontally:
`` ffmpeg -i selfie.mp4 -vf hflip -c:v libx264 -crf 18 -c:a copy flipped.mp4 ``
Vertical video for landscape screens
Rotation does not solve vertical (portrait) video looking narrow on a TV; that is the shape of the recording. You can add blurred side bars for a 16:9 frame:
`` ffmpeg -i vertical.mp4 -filter_complex "[0:v]scale=1920:1080,boxblur=20[bg];[0:v]scale=-2:1080[fg];[bg][fg]overlay=(W-w)/2" -c:v libx264 -crf 20 -c:a copy landscape.mp4 ``
Rotation in editors and upload sites
Most modern editors (Premiere Pro, DaVinci Resolve, Final Cut Pro, CapCut) read the rotation flag correctly. If a clip appears sideways in the timeline, check the clip's attributes or transform settings: Resolve has a rotation field in the Inspector, Premiere has Effect Controls > Motion > Rotation. Rotate there rather than re-exporting the source first, so you only encode once.
Upload sites have mostly caught up too. YouTube, Vimeo, Facebook and Instagram respect the rotation flag. Some older content management systems, video players embedded in websites and email previews do not; for those, a copy with the pixels rotated is the safe choice.
Batch-fixing many clips
If all clips from one device are wrong, fix them in one go. On macOS or Linux:
`` for f in *.mp4; do ffmpeg -display_rotation 0 -i "$f" -c copy "fixed-$f"; done ``
On Windows:
`` for %f in (*.mp4) do ffmpeg -display_rotation 0 -i "%f" -c copy "fixed-%f" ``
Change the number to the rotation you need. Because the streams are copied, this takes seconds per file even for long clips, and you can run it again with a different value if the first guess was wrong. Check one output file before deleting any originals.
Square and cropped results
If a rotated video comes out with black bars or squashed, the player applied the rotation but kept the old width and height. Re-encode with transpose (which swaps width and height) instead of only setting the flag.
Rotation that changes halfway through
A phone records the orientation only once, at the start of the clip. Turning the phone during recording does not change the flag, so part of the clip looks sideways. Fix that by cutting the clip into parts and rotating each part separately.
FixMP4 compared with other options
| Feature | FixMP4 | Desktop repair suites | untrunc (CLI) | VLC |
|---|---|---|---|---|
| Runs where | Browser, on your device | Desktop app | Command line | Desktop player |
| Keeps your file on your device | ✓ | ✓ | ✓ | ✓ |
| Nothing to install | ✓ | ✕ | ✕ | ✕ |
| Rebuilds a missing MP4/MOV index | ✓ | ✓ | ✓ | ✕ |
| Preview of your own repaired file before paying | ✓ | Trial (varies) | Free tool | n/a |
| Voice Memos / AAC without a reference | Usually | Varies | ✕ | ✕ |
| Formats beyond MP4/MOV/M4A | ✕ | ✓ | Many (FFmpeg) | Plays many |
Frequently asked questions
Why does my video play sideways on the computer but not on the phone?
Phones store a rotation flag instead of rotating the pixels. Some players and upload sites ignore the flag.
Can I rotate a video without losing quality?
Yes, by changing the rotation flag with FFmpeg and -c copy. Rotating the actual pixels requires re-encoding.
How do I rotate a video in VLC permanently?
VLC can rotate during playback (Tools > Effects and Filters). To save it, use Media > Convert/Save with a rotation filter, which re-encodes.
Is a sideways video corrupted?
No. Rotation is metadata or how it was filmed; the file is healthy.