[FFmpeg-user] Finding matching frames in a single video
Sean Grider
sean.grider at protonmail.com
Fri May 31 19:48:15 EEST 2024
I'm trying to use ffmpeg to find timestamps of a video where a given screenshot can be found.
Let's say of 30m video, there's a title card at 00:07:00, so I extract that frame as an image with:
ffmpeg -i INPUT -qmin 1 -qscale:v 1 -vframes 00:07:00 -f image2 match.png
Now I want to find any frames in a video stream that roughly match that captured frame. I'm using this ffmpeg command:
ffmpeg -i INPUT.mkv -loop 1 -i match.png -an -filter_complex "blend=difference:shortest=1,blackframe=90:20" -f null -
Now I think it's sort of working, but I have a few questions:
- Can anyone offer any better commands for what I'm trying to accomplish. All of these commands were found via search and trial and error
- The output of the second command shows all of the frames that match, so I think I can parse that output to determine how many contiguous matches there are, but the output is given in frames, pts and t. I assume t means time, but the t value does not correspond at all to the actual timestamp format (00:00:00) of the video. How can I convert the t value into the actual timestamp format?
- Can anyone offer any help or documentation on how the blend/difference filter works? I'm not really clear on what my 90:20 value actually means.
Thanks
Sent with [Proton Mail](https://proton.me/) secure email.
More information about the ffmpeg-user
mailing list