FFmpeg Transpose Filter: Rotate Clockwise and Flip
This guide explains how to use FFmpeg's built-in
transpose video filter to rotate a video clockwise and flip
it in a single operation. You will learn the exact command-line syntax
using predefined filter values, understand the difference between
vertical and horizontal flip combinations, and see how to execute the
command without re-encoding your audio stream.
The Direct Command: Clockwise and Vertical Flip
The FFmpeg transpose filter features a built-in
parameter designed specifically to rotate video 90 degrees clockwise and
flip it vertically.
To execute this, use the numeric value 3 or the named
alias clock_flp:
ffmpeg -i input.mp4 -vf "transpose=3" -c:a copy output.mp4Alternatively, using the named alias:
ffmpeg -i input.mp4 -vf "transpose=clock_flp" -c:a copy output.mp4Command Breakdown:
-i input.mp4: Specifies the source video file.-vf "transpose=3": Applies the video filter to rotate 90 degrees clockwise and flip vertically.-c:a copy: Copies the audio stream directly without re-encoding to preserve quality and save processing time.output.mp4: The resulting output file.
Rotating Clockwise with a Horizontal Flip
The native transpose=3 filter performs a
vertical flip alongside the clockwise rotation. If your
use case requires a 90-degree clockwise rotation paired with a
horizontal flip, chain the standard clockwise transpose
filter (transpose=1) with the hflip
filter:
ffmpeg -i input.mp4 -vf "transpose=1,hflip" -c:a copy output.mp4Reference: Built-in
transpose Values
The transpose filter accepts values from 0
to 3 to handle common rotation and flip combinations:
| Value | Name | Effect |
|---|---|---|
0 |
cclock_flp |
Rotate 90 degrees counter-clockwise and flip vertically |
1 |
clock |
Rotate 90 degrees clockwise |
2 |
cclock |
Rotate 90 degrees counter-clockwise |
3 |
clock_flp |
Rotate 90 degrees clockwise and flip vertically |
Rotating 270 Degrees Clockwise and Flipping
If you need to rotate clockwise by 270 degrees (equivalent to 90
degrees counter-clockwise) and flip vertically, use value
0:
ffmpeg -i input.mp4 -vf "transpose=0" -c:a copy output.mp4