[FFmpeg-user] Remove everything but a single color (range)

Ted Park kumowoon1025 at gmail.com
Sun Mar 15 10:36:19 EET 2020


> Is it possible to "remove" everything in a video except a specific color (or maybe a range... ie close to a specific color)?
> By "remove" I mean covert every that is NOT the color(s) I want to black or transparent.
> I have a video that contains a yellowish box that moves about the screen. I want to isolate ONLY the yellowish box.  Everything else should become black or transparent.  
I think colorkey filter can still do this. Basically you want the converse of what color keying does right? It should work the same (that is the opposite) way, and you just have to invert the alpha value. 

> The specific color is "fbed54" according to the color picker in Gimp.
> FYI. My knowledge of "colors" in general is extremely limited... let's put it this way, I'm pretty sure RGB stands for Red Green Blue... that's about the extent of it.   So, a specific example would be very helpful.

RGB does stand for red, green and blue, and the color “#FBED54” would be a base-16 representation of how much of the three primary colors make up that specific color. The three colors are represented by two hexadecimal (base-16) digits each, with the hidden radix point on the left.
So in this case, it would mean Red has a value of (0.)FB, which is 15/16 + 11/256 = 98.5%, green would be 14/16+13/256=92.6% and so on.

The thing is video usually uses a different scheme of representing/storing color, so using rgb values to key the subject out might not be ideal. But still, try using colorkey or colorhold with higher similarity values first.

Ted Park

More information about the ffmpeg-user mailing list