Rotate a video
There are two honest ways to rotate video, and phones use the fast one: they record the sensor as-is and write a rotation flag into the file, trusting players to obey it. You can do the same in a second with no quality loss, or physically rotate every pixel for the players that do not read the flag.
Rotation
transpose=1. The usual fix for a phone held the wrong way.
Which way the picture should turn, as you look at the screen.
Method
The transpose filter physically rewrites every frame, so the result is rotated in every player ever made. Costs an encode.
The trade-off is the same one trimming has: instant-and-lossless with a compatibility catch, or slow-and-universal.
Quality (CRF)
CRF 20: high-quality delivery.
Rotating pixels means re-encoding them. x264’s 0–51 scale; 18–23 is the useful range.
Your command
updates live · ffmpeg 8.x
ffmpeg -i input.mp4 \
-vf transpose=1 -c:v libx264 \
-crf 20 -preset medium \
-c:a copy \
output.mp4Worth knowing
-display_rotation is an input option (it sits before -i) and counts degrees counter-clockwise, so rotating the picture 90° clockwise means writing 270.
If a video already looks rotated in some players but not others, it carries one of these flags now; the pixel method bakes the rotation in and clears the ambiguity.
The transpose filter also swaps the stored width and height; the metadata method leaves them as recorded.
Run this on your own file
no FFmpeg · runs in this tab
The command above needs FFmpeg on a machine. The settings it encodes do not: your browser can perform the same operation on a real file, right here, through WebCodecs.
Drop a video or audio file here, or
Files are processed in this tab and never uploaded.
The pixels are physically rotated during the re-encode, like transpose.
WebCodecs has no CRF, so -crf 20 becomes a bitrate target for the output resolution, using the rule that every 6 CRF steps halve or double the size.
Waiting on a file.