akamhy / videohash

Near Duplicate Video Detection (Perceptual Video Hashing) - Get a 64-bit comparable hash-value for any video.
https://pypi.org/project/videohash
MIT License
264 stars 41 forks source link

Change Frame Interval #68

Closed specky532 closed 2 years ago

specky532 commented 2 years ago

Would be great to expose access to the frame interval. I quite often work with very long or very short videos and would be great to specifiy the frame interval to check. Alternatively, be able to select a total number of frames and have it randomly select that number of frames from across the video.

akamhy commented 2 years ago

@specky532 what do you mean by frame interval? Is it "The number of interval frames between two I-frames"? or do you want support to specify the timeframe(duration)? All the frames are available to you via the collage_dir attribute.

Alternatively, be able to select a total number of frames and have it randomly select that number of frames from across the video.

I don't understand why randomly selecting will help. Random frames selection will instead make it harder to match other copies.

I also think it is a great idea to support specifying time interval(s) for video hash generation. But I don't understand how random frame selection will improve the project.

Also, you said you work on very long videos, how long are your videos and how much time does it take to generate the hash for these long videos?

specky532 commented 2 years ago

Sorry for the lack of clarity had a big week.

My understanding is that the video hash takes a frame every 1 second by default. framesextractor.py in the init can take a frame interval paramter. but there is nowhere to change this in the video hash, when video hash calls the frames extractor it just passes 1, instead of a variable that the user can specify. It would be useful to be able to specify this.

IE take a frame every 5 seconds or even every 0.1 seconds etc. I've had a look through the code and looks like this should be very easy to implement as the framesextractor.py init already takes the frame interval as a paramater.

The random idea was a brain fart on friday afternoon haha.

akamhy commented 2 years ago

IE take a frame every 5 seconds or even every 0.1 seconds etc. I've had a look through the code and looks like this should be very easy to implement as the framesextractor.py init already takes the frame interval as a parameter.

Yes, it should be trivial to implement this but I will also have to take care of the tests and coverage.

I will release the updated code by next Sunday(28 Nov).