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

Timing accuracy and decode/presentation ordering #3

Open
chrisn opened this issue Jan 18, 2022 · 4 comments
Open

Timing accuracy and decode/presentation ordering #3

chrisn opened this issue Jan 18, 2022 · 4 comments

Comments

@chrisn
Copy link

chrisn commented Jan 18, 2022

In the W3C meeting on 2022-01-17 @ytakio asked whether SEI events should be triggered in the browser before or after decoding? The decode order of video frames may differ from presentation order.

We should also clarify the timing requirements for firing the event messages based on use cases. Is the intent to perform frame accurate rendering of overlay content (e.g., in the bullet chat use case). In such scenarios, I wonder if exposing SEI events through WebCodecs is more appropriate, because synchronization between DOM updates and media playback can be difficult.

@leonardoFu
Copy link
Owner

leonardoFu commented Feb 6, 2022

I think SEI event should be triggered before decoding, because browser only pre-decode several frames to reduce the memory usage. As to the accuracy, I think in most of our use cases, 100 millisecond is good enough. If you really need to synchronize SEI with video frame perfectly, you can use the WebCodecs and Video.requestVideoFrameCallback @ytakio @chrisn

@ytakio
Copy link

ytakio commented Feb 21, 2022

Sorry for my late reply...
Yes, I agree that it would be better to be triggered before decode (at parsing). On the other hands, @chrisn already mentioned above, I wonder if web developer and DOM rendering can be acceptable to handle the decoding order which may have some reversed timestamp.
So I think that it should be compared and considered for the case where events are fired after timing of output from decoded picture buffer (this buffer must be included in each decoder in general), too.

@nigelmegitt
Copy link

I wonder if web developer and DOM rendering can be acceptable to handle the decoding order which may have some reversed timestamp.

This was my concern as well - out of order timestamps are possibly much worse for the client to deal with than in-order-but-a-bit-late timestamps. I'm not sure what all the use cases are though, and if this could be a real world issue.

@chrisn
Copy link
Author

chrisn commented Feb 21, 2022

We discussed in the 2022-02-21 meeting that the WebCodecs spec requires VideoFrames to be emitted in presentation order. If we do need to expose SEI events in decode order, we should update w3c/webcodecs#198 to describe this.

Another consideration is how far ahead an application would need to see the SEI event to be able to render using information in the event. Could this be handled by application-level buffering of VideoFrames, or should the WebCodecs API somehow expose SEI events before the VideoFrame?

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

4 participants