I'm not sure if PHP is the proper spot for this...
Say I have a video that is 5 minutes long. I have an image that is hidden somewhere in this video. I have a picture of the image available to me, but I don't know where in the video it is. I would like my program to search the video for the image, and return the time in the video where the image appears, example: 3:15.
Is this possible? Can this be done with ffmpeg/ffmpeg-php? Where would I start?
I'd start with figuring out how to capture thumbnails of a video using ffmpeg (it is possible, a quick google search will bring it up). Then generate a thumbnail for each frame, then compare the images to the one you already have.
I can't really help beyond that, I have written scripts to generate thumbnails from video, but I have not written anything to compare images.
I have found a way to look at each frame with ffmpeg-php. "$frame->toGDImage()".
Now I understand that bit, but like you said, comparing that image to another is difficult. If they were exact matches, then I can think of ways to do it easily, but obviously since it is a compressed video, the images are not going to be 100% the same.
Also, I want to find an image which is not the same size as the full frame. For example, if I were looking for the Facebook logo (http://www.apse.org/images/fb.png), the video might include this logo in the corner of the video as a small icon - so it needs to be able to search for any match within a frame, even if the full frame doesn't match.
From a video frame, we convert it to an image, and then we could cut it up into a number of pieces by cropping it. At this point, we could have a piece that matches our image, but still it will not be a 100% match. How would I compensate for compression artifacts, color-loss, size difference, etc?
Unfortunately, that is beyond my realm (probably the same reason I don't work for google ). I'd search online for tools that perform image searches, and see if you can't find an existing service that you can send two images to, and get a result determining if the first image was found in the second image.
Bookmarks