It will take the vectors of motion for two videos
(coming from a variant of shotdetect code allowing to store
detailed motion vectors in JSON format, for instance) and it
will look for comparing taking out the common chunk.
Then, provided you have some image's hashes it will compare
their signature in order to make up the decision about
chunk similarity of two video files.
ShotDetect is a free software which detects shots and scenes
from a video (http://johmathe.name/shotdetect.html).