SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Addict
    Join Date
    Apr 2005
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Search a video for an image

    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?

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    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.

  3. #3
    SitePoint Addict
    Join Date
    Apr 2005
    Posts
    236
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply.

    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.

    Somehow, Google does this here:
    http://www.google.com/insidesearch/f...chbyimage.html
    Click for search results

    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?

  4. #4
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,071
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •