How to Combine hflip and vflip in FFmpeg

Flipping a video both horizontally and vertically in FFmpeg is a common task when correcting video orientation or creating mirror effects. This article provides the exact command-line syntax required to combine the hflip and vflip video filters into a single command, ensuring a fast and efficient execution without the need for multiple rendering passes.

To combine horizontal and vertical flips in a single FFmpeg command, you must chain the two filters together using a comma (,) within the video filter (-vf) argument.

The Standard Command

Use the following command structure to apply both filters:

ffmpeg -i input.mp4 -vf "hflip,vflip" output.mp4

How It Works

Performance Optimization (Copying Audio)

By default, FFmpeg will re-encode the audio stream. To speed up the process and preserve the original audio quality without re-encoding, add the -c:a copy flag:

ffmpeg -i input.mp4 -vf "hflip,vflip" -c:a copy output.mp4

This command applies the visual flip effects to the video stream while copying the audio stream directly, saving processing time and system resources.