[FFmpeg-user] absolute difference

Michael Koch astroelectronic at t-online.de
Fri Mar 18 01:24:35 EET 2022


Question 1:
I have two streams with RGB24 pixel formats.
Is it possible to do the following calculation pixel-wise and write the 
result to a grayscale stream?
output = abs(R1-R2) + abs(G1-G2) + abs(B1-B2)

Question 2:
Three streams are given:
[a] A static background image with no person in front of it.
[b] Exactly the same background with a person in front of it. The person 
does move, but the background doesn't move.
[c] A new background, for example an image.

I want to replace the background from stream [b] by background [c].
If the absolute difference between [a] and [b] is larger than a 
threshold, then pick [b], otherwise pick [c].

I did already play with maskedthreshold and threshold filters, but 
didn't yet find a good solution for this problem.

Michael



More information about the ffmpeg-user mailing list