[FFmpeg-user] Finding matching frames in a single video

Paul B Mahol onemda at gmail.com
Fri May 31 20:31:02 EEST 2024

On Fri, May 31, 2024 at 6:48 PM Sean Grider via ffmpeg-user <
ffmpeg-user at ffmpeg.org> wrote:

> 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?

t is in seconds.

> - 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.
There is documentation of filters.

> Thanks
> Sent with [Proton Mail](https://proton.me/) secure email.
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list