LemurPwned / video-sampler

Effective frame sampling for ML applications.
https://lemurpwned.github.io/video-sampler/
MIT License
16 stars 5 forks source link

FR: eliminate redundant frames given a list of frames (instead of video) #38

Open fcakyon opened 1 day ago

fcakyon commented 1 day ago

🚀 Feature Request

Optionally accept a list of frames as input instead of a video file when performing sample selection.

🔈 Motivation

In my use case, I have a list of frame samples from different videos or clips of the same video. I want to use video-sampler package to eliminate redundant samples in this list. To my knowledge, video-sampler only accepts video files as input.

🛰 Alternatives

Converting the list of frames into a video and processing it with video-sampler?

📎 Additional context

If this use case is possible with the current version of the video-sampler, please direct me to related docs/scripts.

LemurPwned commented 22 hours ago

@fcakyon You're right, it's not currently supported.

I guess that it'd be relatively easy to add support for accepting an ordered list of files (or a file of ordered list of files). But that's the crux -- we need to have a concept of some ordering, because the deduplication relies on a temporal buffer as opposed to a global buffer of all frames.

If you think this approach would be useful, I could maybe propose some sketch towards the end of the week.

fcakyon commented 2 hours ago

I guess that it'd be relatively easy to add support for accepting an ordered list of files (or a file of ordered list of files). But that's the crux -- we need to have a concept of some ordering, because the deduplication relies on a temporal buffer as opposed to a global buffer of all frames.

If you think this approach would be useful, I could maybe propose some sketch towards the end of the week.

@LemurPwned Yes, that sounds perfect! There can be a requirement for an input frame list being ordered.

I want to clarify one point, though. I have to perform this duplication as fast as possible in my use case. Thus, exporting the list of frames into a disk and providing the file paths to the video-sample would significantly increase the latency. Would it be possible to give an iterator/generator of frames as a numpy array or bytes to the video-sampler, or would a list of file paths be a hard requirement?