FFmpeg has a filter called colorhold with documentation that states:
Remove all color information for all RGB colors except for [a] certain one.
This is incorrect, colorhold does not work this way… well not exactly. It removes colors but it’s completely unpredictable.
For example, in input.mp4 there are two blue bars on the train. If the exact blue is taken from the video and colorhold is applied, no color is removed. If a pure cyan color is kept with colorhold, the bottom blue bar & red is removed yet the top blue bar is kept and the interior wall colors remain the same.
Figure 63.0 shows this inconsistency:
$ ffmpeg -i input.mp4 -vf "colorhold=color=00FFFF:similarity=1" -pix_fmt yuv420p output.mp4
Technically with enough effort and guess work, removing all colors except one is possible with colorhold.
colorhold Indicates the colorhold filter name color Indicates the color which isn’t replaced with the color gray similarity Indicates the similar color percentage based on color. The larger the number the larger the similarity (1.0 to 0.1 default 0) blend Indicates the blend percent of gray (1.0 to 0.0 default 0.0)
Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!
- @ May 13, 2020 2:16 pm