How to Create a Negative Video Effect with FFmpeg
This article provides a quick, step-by-step guide on how to use the
FFmpeg negate video filter to invert the colors of a video,
creating a classic negative film effect. You will learn the basic
command to invert video colors, how to handle transparency during the
negation process, and how to combine the filter with other adjustments
for a more polished look.
The Basic Negate Command
To invert the colors of a video and create a negative film effect,
you use the video filter graph (-vf) with the
negate filter. The basic command structure is as
follows:
ffmpeg -i input.mp4 -vf "negate" output.mp4In this command:
-i input.mp4specifies your source video file.-vf "negate"applies the video filter that inverts all color channels (RGB).output.mp4is the name of the resulting video file.
Preserving the Alpha (Transparency) Channel
By default, the negate filter inverts all components of
the video, including the alpha (transparency) channel if one is present.
If you want to invert the colors of a transparent video (like a
ProRes4444 or WebM file) without making the transparent background
solid, you must disable alpha negation.
Use the negate_alpha parameter set to
0:
ffmpeg -i input.mov -vf "negate=negate_alpha=0" output.movSetting negate_alpha=0 ensures that only the visible RGB
colors are inverted, while your transparency masks remain intact.
Adjusting Contrast and Brightness for a Film Look
An actual negative film strip often has different contrast and
brightness levels than a simple digital inversion. To make the negative
effect look more realistic, you can chain the negate filter
with the eq (equation) filter to adjust brightness,
contrast, and saturation.
ffmpeg -i input.mp4 -vf "negate,eq=contrast=1.2:brightness=-0.05:saturation=0.8" output.mp4In this example:
negateinverts the colors first.eq=contrast=1.2increases the contrast to make the whites and blacks pop.brightness=-0.05slightly darkens the image to prevent blown-out highlights.saturation=0.8desaturates the colors slightly to mimic aged film stock.