FFmpeg recipe
FFmpeg: Rotate a Video 90° (Lossless Metadata)
Two approaches: change container rotation metadata (lossless, instant, but some players ignore it), or re-encode with the transpose filter (slower, universal).
Command
# Lossless metadata rotation (instant, but some players ignore):
ffmpeg -i input.mp4 -metadata:s:v rotate=90 -c copy -y output_rotated.mp4
# Re-encode (universal):
ffmpeg -i input.mp4 -vf "transpose=1" -c:v libx264 -crf 23 -c:a copy -y output_rotated.mp4Prefer no terminal?
Use the Video Rotator in your browser
What each flag does
| -i | Input file. Can be a video, audio, or image. Repeat for multiple inputs. |
|---|---|
| -c copy | Stream-copy: no re-encoding. Output is bit-identical between cut points. Fastest possible. |
| -c:v | Video codec for output. e.g. libx264, libx265, libvpx-vp9. |
| -crf | Constant Rate Factor — quality target (lower = better, larger file). 23 is visually lossless for libx264. |
| -c:a | Audio codec for output. e.g. aac, libmp3lame, copy. |
| transpose=1 | 0 = 90° counterclockwise + flip, 1 = 90° clockwise, 2 = 90° counterclockwise, 3 = 90° clockwise + flip. |
Notes & gotchas
- For 180°, use -vf "transpose=1,transpose=1" or hflip,vflip.
- iPhone videos sometimes already have rotation metadata that flips them — check with ffprobe before assuming orientation.
Related recipes
Resize to 1080p · Any video
Resize any video to 1080p (1920×1080) with FFmpeg scale filter. Preserves aspect ratio with -1 trick.
Crop to 9:16 · Any video
Crop a 16:9 video to 9:16 vertical with FFmpeg crop filter. Centered crop for TikTok, Reels, Shorts.
Change frame rate · Any video
Change the frame rate of any video with FFmpeg fps filter. Simple drop / duplicate for safe FPS conversion.
Speed up 2x · Any video
Speed up a video 2× (or any factor) with FFmpeg. Uses setpts for video and atempo for audio without pitch shift.