Flip a video horizontally (mirror image) with the hflip filter
The hflip filter mirrors each frame left-to-right. The most common uses are correcting a horizontally flipped selfie camera, creating a mirror effect, and preparing video for a telepresence or video-conference application that needs a flipped preview.
The command
ffmpeg -i input.mp4 -vf "hflip" output.mp4What it does
FFmpeg applies a horizontal flip to every frame using a fast SIMD-accelerated routine. The output has the same dimensions as the input but every pixel is mirrored. The encode is fast — hflip is one of the cheapest video filters.
When to use it
For selfie footage that came out with text or logos mirrored (some front-facing cameras do this), for video-conference pipelines that need a flipped local preview, and for creative mirror effects. hflip is also useful when combining two sources side-by-side and one is oriented incorrectly.
Video and audio requirements
Any decodable video. Audio is unaffected. The filter is a simple per-pixel operation and works on any pixel format; the output has the same pixel format as the input. Frame rate and time base are unchanged.
Things to avoid
- Using
hflipto correct a vertically-flipped image. That isvflip, nothflip; they are separate filters and easy to confuse. - Flipping a video that has burned-in text or logos. The text will read backward. For text correction, mask the region and re-render the text, or accept the mirror effect as intentional.
- Combining with a filter that assumes a specific orientation. The order matters:
hflip, scalescales the mirrored frame;scale, hflipscales the source and then mirrors. - Forgetting that the result is a true mirror. If the source has a person's face on the left, the output has the face on the right. This is what some video-conference apps need; for other uses, it can be disorienting.