Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Hash based on limited number of frames #107

Open
c22 opened this issue Jul 20, 2023 · 2 comments
Open

[Feature Request] Hash based on limited number of frames #107

c22 opened this issue Jul 20, 2023 · 2 comments

Comments

@c22
Copy link

c22 commented Jul 20, 2023

My use case for this software would only be in needing to compare the hash of the first few seconds of video for hundreds of files of varying lengths. The reason for this is part of a classification task ie. I have a lot of files and want to classify them based on the contents of the first few seconds.

I could create a script which trims the videos all to 2-3 seconds long then use videohash on those clips, then relate those results back to their original clip but it would be great if videohash could handle all of this for me.

What I imagine would be something like having an max_frames parameter added to the VideoHash function.

eg. videohash.VideoHash(..., frame_interval=0.2, max_frames=10) would provide me a hash based on 10 frames from the first ~2 seconds of video.

I could also see perhaps setting a time range being handy instead, eg. start_time: '2:00', end_time: '2:30' would hash only that 30 second clip from the video. This would solve my use case but also be a more general solution for other use cases, though I think it may be a little more nuanced to implement vs. the first proposal.

Interested to hear the maintainers thoughts on this as I might be able to tackle a solution if there's interest.

@c22
Copy link
Author

c22 commented Jul 20, 2023

I can also see this potentially being sold as a kind of "performance" trick for users who would be happy to say conclude that two videos are a match based only on comparing the first few minutes of each video.

@shashi-netra
Copy link

wouldn't it be easy enough to split your video using ffmpeg and then videohash the video clips?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants