-
-
Notifications
You must be signed in to change notification settings - Fork 203
Open
Description
I am creating a class that takes video url and has a method .seek(timeMs) which returns VideoFrame promise and wondered:
- is there something like this built in
- what's the best and most optimal method of doing it
The primary goal of this is performance and time you have to wait
The class needs to be stateful, examples:
- if I seek for 2s and then instantly after for 2.1s, we should not look for new keyframe, but instead keep consuming the stream we already have as it will be faster and it is likely the frame we need is just after the one we returned a moment ago (thus we should also keep our VideoDecoder instance)
- however, if we did seek for 2s and now seek for 10s, there is no point in consuming our current stream with existing decoder, we probably need the closest frame before 10s and start from there. However - in this case, eg if video is 60fps and last keyframe was at 9.1s, we will likely need to throw away around 50 frames before we get the one we need, which might be slow - is there a way to speed it up?
In general it should behave like a normal html Video that aims to show a new frame as quickly as possible after you seek it, in whatever way you seek it (looping, quick mouse drag over timeline in any direction, etc)
I am ok, trying to implement it myself, but some guidance about the most performant (and memory efficient) way of doing that would be useful
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels