Rotate a video 90 degrees clockwise with the transpose filter
Videos shot in portrait on a phone often come out as 1920x1080 with a rotation flag, which plays correctly on phones but sideways on TVs and desktops. The transpose=1 filter physically rotates the frames and lets you re-encode at the rotated dimensions.
The command
ffmpeg -i input.mp4 -vf "transpose=1" output.mp4What it does
The transpose filter rotates each frame. The argument selects the direction and method: 0 is 90° counter-clockwise with vertical flip, 1 is 90° clockwise, 2 is 90° counter-clockwise, 3 is 90° clockwise with vertical flip. The output dimensions swap: a 1920x1080 input becomes 1080x1920.
When to use it
For videos that have a rotation flag but display sideways in your target player. Modern players honor the rotation flag, but some embedded players, older TVs, and many social media processors do not. Re-encoding with transpose produces a file that displays correctly everywhere.
Video and audio requirements
Any decodable video. The output codec can be the same as the input (H.264 stays H.264). Note that transpose rotates by 90° increments only; for arbitrary angles, use the rotate filter, which is slower and re-encodes every frame at the new angle.
Things to avoid
- Using
transpose=1for "just rotate 90" without checking the orientation. The 0 and 3 variants include a vertical flip; if the source is upside-down, you want one of those, not 1. - Forgetting to swap the display aspect ratio. After a 90° rotation, the new display aspect is the inverse of the source. Some players need an explicit
setdarhint. - Combining with crop in the wrong order.
transpose, cropproduces a different result thancrop, transpose. Crop before rotating if the crop is in source coordinates; rotate first if the crop should be in display coordinates. - Using transpose to fix a source with a rotation flag. The source plays correctly in modern players already; transpose bakes the rotation into the pixels, which loses the original orientation metadata. Use it when the target player does not honor the flag.