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

Allow receiving an external frame index #466

Open
scotts opened this issue Jan 22, 2025 · 2 comments
Open

Allow receiving an external frame index #466

scotts opened this issue Jan 22, 2025 · 2 comments
Labels
enhancement New feature or request

Comments

@scotts
Copy link
Contributor

scotts commented Jan 22, 2025

🚀 The feature

We have had several request for the ability for VideoDecoder to accept an external frame index upon startup. That is, in exact mode, we build up a frame index which tells us the mapping between frame indices and pts. If users could provide that index to us, we could be in exact mode but not have to scan the entire file at startup. (We would, however, be the the mercy of the accuracy of the external index.)

Motivation, pitch

The main motivation is performance. There is potentially less need for this feature now that we have approximate mode (#427), which also avoids scanning the entire file. But the combination of receiving an external index and exact mode could perhaps yield the best of both worlds: exact seeks and fast startup.

The reason this comes up is that in many environments, videos are pre-processed before being used for training and inference. Creating and storing the external index for a particular video would be relatively low-cost, and it would be paid once.

@scotts scotts added the enhancement New feature or request label Jan 22, 2025
@NicolasHug
Copy link
Member

NicolasHug commented Jan 23, 2025

From a UX perspective, but also in terms of implementation, we may want to think of the user-provided index as a third seek_mode? The reason I say this is because when the index is provided by the user, we end up in a hybrid mode that doesn't really fit neither approximate nor exact. It's more of a combination of both:

  • approximate: we don't scan, we don't rely on an index
  • exact: we scan and rely on the index we built ourselves
  • user-provided index: we don't scan (like in approx), but still use an index (like in exact).

@scotts
Copy link
Contributor Author

scotts commented Jan 30, 2025

That's a good point. I was thinking of the two concepts as being orthogonal, but you're right, they're related. That is, it doesn't make much sense to provide an external index if you're also using approximate mode - why provide us with something that you then ask us to not use? Ideally, our API would prevent such logical inconsistencies.

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

No branches or pull requests

2 participants