Compare 2 videos at different frames with ffmpeg

there is this nice ffmpeg command:

ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v][1:v]blend=difference,blackframe=1:10" -f null -'

this command compares 2 videos but always at the same frame.
imagine i want to compare those 2 with 5 frames offset…like frame 0 of video1 with frame 5 of video2, is this possible with ffmpeg ?

i already tried:

'ffmpeg -i video1.mp4 -i video2.mp4 -filter_complex "[0:v]select=gte(n\,0)[video1]; [1:v]select=gte(n\,5)[video2]; [video1][video2]blend=difference,blackframe=1:10" -f null -'

but this command just starts the compare at frame 5 for both…

i had success with image compare of every frame (create image from frame – compare – go next frame) but that was taking forever if i have a longer clip due to creating and checking single images.
cutting and reencoding is also no option due to quality loss and time.

i really appreciate any help, didnt find more on google and ai was useless 🙁

Read more here: Source link