JohannesBuchner / imagehash

A Python Perceptual Image Hashing Module
BSD 2-Clause "Simplified" License
3.17k stars 328 forks source link

(Perceptual) hashing algorithm for videos/movies #129

Closed Arsalan66 closed 3 years ago

Arsalan66 commented 3 years ago

Respected authors it is a pleasure to work and apply image hashing however I want to do this for videos as well, can you kindly guide the way to do this.

Thanks

JohannesBuchner commented 3 years ago

Presumably you need to read videos frame-by-frame and apply the functions? I think https://github.com/thorn-oss/perception/ has code based on imagehash that does this.

SpangleLabs commented 3 years ago

If it helps at all to have another example, I've got one here: https://github.com/joshcoales/gif_pipeline/blob/master/helpers/duplicate_helper.py#L52

But again, not pulled out into it's own library (yet), sorry. It's just running ffmpeg -i video.mp4 -vf fps=5 -vsync 0 decompose/out%d.png to break the video into frames, then looping through them and hashing them

Arsalan66 commented 3 years ago

Thanks for sharing sir, I will implement and let you know

Arsalan66 commented 3 years ago

If it helps at all to have another example, I've got one here: https://github.com/joshcoales/gif_pipeline/blob/master/helpers/duplicate_helper.py#L52

But again, not pulled out into it's own library (yet), sorry. It's just running ffmpeg -i video.mp4 -vf fps=5 -vsync 0 decompose/out%d.png to break the video into frames, then looping through them and hashing them

so basically each frame is hashed according to theory right sir?

JohannesBuchner commented 3 years ago

Yes, there is nothing fancy going on there.