11/3/2025
Rotate video with FFmpeg using transpose, 180-degree filter chains, and metadata-safe re-encoding commands for fixing incorrect orientation.
How to Rotate a Video with FFmpeg
Use FFmpeg's transpose filter when a video is sideways, upside down, or needs a fixed 90-degree rotation. Rotation changes the video frames, so the video must be re-encoded.
Rotate 90 Degrees Clockwise
ffmpeg -i input.mp4 -vf "transpose=1" -c:v libx264 -crf 23 -preset medium -c:a copy rotated.mp4
This is the most common command for fixing a sideways phone video.
Rotate 90 Degrees Counter-Clockwise
ffmpeg -i input.mp4 -vf "transpose=2" -c:v libx264 -crf 23 -preset medium -c:a copy rotated.mp4
Rotate 180 Degrees
Apply two 90-degree rotations:
ffmpeg -i input.mp4 -vf "transpose=1,transpose=1" -c:v libx264 -crf 23 -preset medium -c:a copy rotated-180.mp4
Transpose Values
| Value | Result |
|---|---|
transpose=1 |
Rotate 90 degrees clockwise |
transpose=2 |
Rotate 90 degrees counter-clockwise |
transpose=0 |
Rotate 90 degrees counter-clockwise and flip vertically |
transpose=3 |
Rotate 90 degrees clockwise and flip vertically |
Most users only need 1, 2, or two chained transpose=1 filters for 180 degrees.
Why Re-encoding Is Needed
The transpose filter modifies video frames. That means -c:v copy cannot be used for this kind of rotation. You can still copy audio with -c:a copy.
Common Problems
The video rotates but quality drops.
Use a lower CRF such as 18 or 20.
The output is larger than expected.
Use CRF 23-28, or compress the result with the Compress Video tool.
The video still opens sideways in some players.
Some source files use rotation metadata. Re-encoding with the transpose filter creates actual rotated frames, which is usually more reliable.
Related FFmpeg Pages
- See the recipe: Rotate Video with FFmpeg.
- Build conversion commands with the Convert Video tool.
- Learn how to crop a video with FFmpeg.
- Learn how to change video resolution with FFmpeg.