8

Is it possible to invert colors of a video using FFMPEG?

It seemed to me from this answer that it might be possible but I can't figure out the correct filter.

laggingreflex
  • 5,035
  • 17
  • 65
  • 96

3 Answers3

18

The lut filter family has a bespoke mode for doing this, when you don't know whether the input is YUV or RGB.

ffmpeg -i in -vf negate out
Gyan
  • 34,439
  • 6
  • 56
  • 98
2

You can use the lutrgb or lutyuv video filter:

ffmpeg -i input_file -vf lutrgb="r=negval:g=negval:b=negval" output_file

or:

ffmpeg -i input_file -vf lutyuv="y=negval:u=negval:v=negval" output_file

Source: FFmpeg Filters Documentation

Mike Fitzpatrick
  • 16,789
  • 4
  • 46
  • 48
0

This also work for inverting alpha channel in videos

ffmpeg -i input_file -vf lutrgb="a=negval" output_file