I would like to find all frames in a clip that are likely to contain an image at a known position.
My idea is to grab a still from the video, cut the image and create a mask, feed the video and mask into ffmpeg, use a filter to apply the mask over the video, calculate the difference between the current frame and mask and try to detect if the entire image is black which would indicate that the image is present in the frame.
For example, suppose I have a video where the logo on the right appears at exactly the same spot with the same dimensions several times throughout the video:
My idea is to create a mask that looks like this:
And apply it to the video such that when the image is not present the resulting frame "looks" like this:
But when it does match the blended difference should result in a black screen which I can detect using blackframe.
I've gotten as far as blacking out the actual image, but I'm not sure how to black out the surrounding part of the frame.
Is this possible using ffmpeg, or is there perhaps a different way of doing the same thing?