Reputation: 311
Is it possible to compare pragmatically, two look alike videos of different codec, size and resolution. I went through the some tools like ffmpeg
opencv
.
Or in the another context, Lets an image should be compared with video and find out the exact time where the image visually present in the given video. The codecs, size and resolution of video and image may vary.
Upvotes: 1
Views: 3629
Reputation: 311
After a little research and going through the forums, I got OpenSIFT library(depends on opencv). In this, match algorithm satisfies with the task.In this algorithm any two images of different size,codec can be compared. For video comparison, convert the video into frames and compared each frame with reference image.
I hope this will be helpful if anybody searching for a image/frame in the video visually rather than raw frames comparison
Upvotes: 2
Reputation: 11184
Yes, but it involves work. So, I'm assuming here you'll use ffmpeg (libavformat, libavcodec) programmatically, you can probably do the same through intermediate layers such as opencv also.
First, open the videos (using libavformat), decode the frame(s) (using libavcodec), and rescale them (using libswscale) so they're of identical size and picture format (e.g. yuv420p). Which of the two videos/images you rescale shouldn't matter, but if you're comparing an image to a video, I'd scale the image since that's a single instead of per-frame operation. Then, compare that image to each output frame (using the ssim of psnr filters in libavfilter), and check the metadata of the output frame for lavfi.ssim.dB or lavfi.psnr.psnr_avg. The frame that the image is most similar to is the frame with the highest PSNR or SSIM score, which is the answer to your question.
You will find tutorials and examples for each of these libraries if you choose to use them.
Upvotes: 3