MpegFlowBlogBack to home
← Recipes·Rotate / flip·video operations

Rotate and flip video with FFmpeg: phone footage, EXIF metadata, and the right approach

Rotate phone-shot video to correct orientation, flip horizontally for mirror effect, or strip EXIF rotation metadata that confuses some players.

ByMpegFlow Engineering Team·FFmpeg recipe
·4 variants·May 9, 2026

When to use this

You rotate or flip video for phone-shot content recorded sideways (orientation metadata works in some players, fails in others — re-encoding with the correct rotation is universal), creating mirror effects (selfie-mode where on-screen text needs to read correctly), or generating multiple aspect-ratio variants from one source. The orientation problem is more common than most teams realize: iOS records EXIF rotation tags that desktop players ignore.

Command variants

Rotate 90° clockwise
ffmpeg -i input.mp4 \
  -vf "transpose=1" \
  -c:v libx264 -preset medium -crf 21 \
  -c:a copy \
  output.mp4

transpose=1 rotates 90° clockwise. transpose=2 rotates 90° counter-clockwise.

Rotate 180°
ffmpeg -i input.mp4 \
  -vf "transpose=1,transpose=1" \
  -c:v libx264 -preset medium -crf 21 \
  -c:a copy \
  output.mp4

Chain two transposes for 180°. Or use -vf "hflip,vflip" which is equivalent.

Horizontal flip (mirror)
ffmpeg -i input.mp4 \
  -vf "hflip" \
  -c:v libx264 -preset medium -crf 21 \
  -c:a copy \
  output.mp4

Mirrors left-right. Useful for selfie-mode video where on-screen text needs to read correctly.

Strip EXIF rotation metadata (no re-encode)
ffmpeg -i input.mp4 \
  -metadata:s:v rotate=0 \
  -c copy \
  output.mp4

Removes the rotation metadata without re-encoding. Useful when player support is uneven.

What each parameter does

  • transpose=N

    0=90° counter-clockwise + vertical flip, 1=90° clockwise, 2=90° counter-clockwise, 3=90° clockwise + vertical flip. Most common: 1 (clockwise) and 2 (counter-clockwise).

  • hflip

    Horizontal flip (left-right mirror).

  • vflip

    Vertical flip (top-bottom flip).

  • -metadata:s:v rotate=0

    Set the video stream's rotation metadata to 0 without re-encoding. Stream-copy with this flag strips the rotation tag.

What this outputs

A re-encoded (or stream-copied) video file with the rotation/flip applied. Re-encoding is required for transpose/hflip/vflip; stream-copy works only for metadata stripping.

Pitfalls

  1. EXIF rotation metadata is interpreted differently across players. Web/Chrome usually respects it; QuickTime sometimes doesn't; FFmpeg-based tooling sometimes mishandles it. For universal playback, re-encode with the correct rotation rather than relying on metadata.
  2. Stripping metadata without re-encoding doesn't change pixel data — players that ignored the tag will still play correctly; players that respected the tag will now show the original (uncorrected) orientation.
  3. Rotating/flipping resets aspect ratio. Players display the new orientation natively but downstream tooling may need explicit aspect-ratio updates.
  4. Phones often record at high resolution (4K/60fps) — rotating these is expensive. For social-media output where lower resolution is acceptable, scale before rotating to save compute.
  5. Transpose chains (transpose=1,transpose=1 for 180°) are equivalent to hflip+vflip but slightly slower. Use hflip+vflip for 180° rotations.

At production scale

Rotation requires re-encoding (libx264-bound), so it's not free at scale. For UGC pipelines processing phone-shot content, the rotation step roughly doubles the encoding cost. NVENC GPU encoding handles rotation natively at GPU speeds.

How MpegFlow handles this

MpegFlow detects orientation metadata at ingest and routes phone-shot content to a rotation stage automatically. The audit log records both the original and corrected orientation.

Topics
  • FFmpeg
  • rotate
  • flip
  • video-operations
See also
  • Recipe
    Crop Video
  • Recipe
    Resize Scale Video
Running this at scale?

Get the orchestration layer for free.

The rotate / flip command above is the easy part. The queue, retries, audit trail, encoder-version pinning, and multi-tenant security around it are what every video team rebuilds from scratch. We did the rebuild — design partners run it free during beta.

Apply More recipes
© 2026 MpegFlow, Inc. · Trust & complianceAll systems nominal·StatusPrivacy