-
Notifications
You must be signed in to change notification settings - Fork 145
Video encoders may drop frames #240
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
Comments
The assumption in the current spec is that no frames are dropped.
Can you elaborate on which encoders? Is it a default behavior? Can it be disabled? |
Triage note: tentatively marking 'editorial', as the current wording intends that this not be allowed, so perhaps the change is just to clarify that intent. Discussion still unfolding, so label may change. In my basic understanding, encoders that offer the ability to drop as described can be configured not to do so, meeting the expectations of the spec. |
This probably falls under rate control settings: |
VTB API exposes kVTEncodeInfo_FrameDropped for that reason, rate control is indeed one potential reason. Similarly, on decoder side, some decoding results might be considered errors or not. |
I'd tend to agree with #240 (comment), but if this is added, it would be breaking (there is simply no way to express this), so let's discuss first. |
I don't think this is breaking, you can return an error in the failure cases, and there are some use cases where dropping frames must not be allowed (transcoding, etc) -- so user agents must support a non-dropping mode. As such, a setting for allowing dropping later is an extension. |
+1. @padenot, please mark as 'extension' if we're all aligned.
I think this may be covered by #220? If not, separate issue sg. |
I do not think we are aligned yet, sorry ;-)
Does it mean VTB cannot be used to implement WebCodecs? That would be sad. Or that, whenever VTB drops a frame, UA will error the encoder/decoder, which is currently a terminal state? The current API defines a terminal error state. This makes sense in cases like configuration is now unsupported and it is unrecoverable (say external eGPU is removed or device enters low power mode and now refuses to use SW encoders). On the other end, there are a lot of cases where errors are not really terminal. Given WebCodecs is thought as a general purpose codec API, it seems better to design a good error model, with both terminal codec-wide errors and frame-specific errors.
Do you know of existing popular encoder/decoder APIs that defines such setting? |
I think this is covered by #121?
AFAIK, VideoToolbox supports this when kVTCompressionPropertyKey_RealTime is set to false. Real-time modes are fairly common and function under some set of specified constraints (frame rate, bit rate, cpu usage, etc). As such, we do think there's room for specifying a configurable real time mode. We haven't come to consensus on any shape there though. We'd welcome any proposals you have. |
Please see #242 (comment) for reasoning about why errors are made fatal. I think this is a separate discussion from dropping (we are not proposing new error paths here). Please file a separate issue if more to discuss on errors generally. |
How is it covered?
I might be missing something but I understood low-latency MSE or VC-like applications were amongst the main use cases. |
When changes are made to support realtime use cases, please do not force these changes to always be active. There are use cases where it is desirable to encode slowly, or transcode media. (For example, generating frame data programmatically, waiting for it to complete, and then saving the compressed result.) |
@bradisbell, agreed. |
Sorry, I don't understand the point you're trying to make here. Can you elaborate?
I agree we should add a |
So far my thoughts are
|
I think this issue is now broken up into other issues.
Closing this one, as I don't see any other work tracked in this issue. Please reopen if needed. |
Some encoders, to preserve bitrate, might decide to drop encoding of some frames.
They might also do the same if too much frames are in the pipe.
It is somehow unclear whether either case is an error or not.
From my understanding of the spec, it seems that this case would not trigger an error but would not surface to the web page either. It is then up to the web page to identify which frame was dropped and the web page might not know why it was dropped.
I wonder whether this is something that should be surfaced (more precise error codes?) though the potential impact on fingerprinting should be studied.
The text was updated successfully, but these errors were encountered: