You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Need EncodedChunk to have video metadata to support WebRTC #245
@alvestrand@Djuffin@padenot Do we still believe that changes to EncodedChunk are needed to support WebRTC? Or is the required metadata being added to RTCEncoded{Audio, Video}Frame instead?
The metadata that matters is the stuff that is needed to create the RTCEncoded{Audio, Video}Frame metadata. Offhand, I'm thinking of the dependency maps that go into the dependency descriptor, but there are probably more. I don't know at the moment how to find these (and have mislaid the document I was working on for it). But I don't think the issue can be closed.
The RTCEencodedVideoFrameMetadata for an outgoing frame can be sourced as follows:
unsigned long long frameId;
sequence<unsigned long long> dependencies; - from encoding config
unsigned short width; - from encoding config
unsigned short height; - from encoding config
unsigned long spatialIndex; - from encoding config
unsigned long temporalIndex; - from encoding config
unsigned long synchronizationSource; - irrelevant, added by sending process
octet payloadType; - irrelevant, added by sending process
sequence<unsigned long> contributingSources; - must be configured if used
long long timestamp; // microseconds - copied from EncodedVideoChunk
unsigned long rtpTimestamp; - irrelevant, added by sending process
DOMString mimeType; - from encoding config
The frameId is the one that sticks out as "missing". I think it's used by the dependency descriptor (which is not exposed as RTCEncodedVideoFrameMetadata, it seems).
Yes, frame_number (a 16-bit relative version of frameId) is used by the Dependency Descriptor.
While in principle the dependency descriptor is derivable from the metadata cited plus the scalabilityMode, in practice this would be a lot of (duplicative) work to derive. So it may be worth adding to RTCEncodedVideoFrameMetadata.
On Oct 27, 2026 at TPAC 2026 joint meeting of WebRTC WG and Media WG:
The decision is not to add a metadata field to EncodedVideoChunk for the following reasons:
No non-WebRTC use cases or new encoder output: There are no use cases for carrying this metadata on EncodedVideoChunk outside of WebRTC, and VideoEncoder does not produce any metadata beyond what is already exposed.
Single source of truth with bitstream headers:EncodedVideoChunk can be constructed with arbitrary bytes via new EncodedVideoChunk(init). Allowing JS-supplied structural metadata (such as resolution, layer IDs, or dependencies) on the chunk itself creates a second source of truth that can conflict with the actual headers inside the encoded bitstream.
Any WebRTC-specific metadata should be added directly to WebRTC's own objects (e.g., RTCEncodedVideoFrame). Closing this issue on the WebCodecs side.
Activity
aboba commentedon May 18, 2021
@alvestrand MetaData Proposal: https://docs.google.com/document/d/1O6kxAQPLWhCRHkH-6zutcqEUOUWRS6NFM2CQAvi1VTg/
Do you need anything beyond that?
aboba commentedon Jun 11, 2021
@alvestrand Looks like we need to plan for metadata extensibility, so moving the SVC metadata into its own
svcdictionary probably makes sense.aboba commentedon May 8, 2024
@alvestrand @Djuffin @padenot Do we still believe that changes to EncodedChunk are needed to support WebRTC? Or is the required metadata being added to RTCEncoded{Audio, Video}Frame instead?
padenot commentedon May 13, 2024
For WebRTC folks to answer.
aboba commentedon Dec 5, 2024
@alvestrand Is this still an issue, or can we close this?
alvestrand commentedon Dec 5, 2024
The metadata that matters is the stuff that is needed to create the RTCEncoded{Audio, Video}Frame metadata. Offhand, I'm thinking of the dependency maps that go into the dependency descriptor, but there are probably more. I don't know at the moment how to find these (and have mislaid the document I was working on for it). But I don't think the issue can be closed.
alvestrand commentedon Dec 5, 2024
Here's the table from my half-baked doc:
The RTCEencodedVideoFrameMetadata for an outgoing frame can be sourced as follows:
The frameId is the one that sticks out as "missing". I think it's used by the dependency descriptor (which is not exposed as RTCEncodedVideoFrameMetadata, it seems).
aboba commentedon Dec 5, 2024
Yes,
frame_number(a 16-bit relative version offrameId) is used by the Dependency Descriptor.While in principle the dependency descriptor is derivable from the metadata cited plus the
scalabilityMode, in practice this would be a lot of (duplicative) work to derive. So it may be worth adding to RTCEncodedVideoFrameMetadata.But this issue is really about Encoded Transform's RTCEncodedVideoFrame, not WebCodecs EncodedVideoChunk, right?
Djuffin commentedon Dec 10, 2024
Media WG on Dec 10, 2024:
EncodedVideoChunkMetadata is only produced by VideoEncoder, it's not available for chunks coming from network and so on.
Let's just add constructors that allow developers to create
RTCEncodedVideoFrame and EncodedVideoChunk from each other.
Proposal from Harald for constructors is here.
Djuffin commentedon Oct 27, 2026
On Oct 27, 2026 at TPAC 2026 joint meeting of WebRTC WG and Media WG:
The decision is not to add a metadata field to
EncodedVideoChunkfor the following reasons:EncodedVideoChunkoutside of WebRTC, andVideoEncoderdoes not produce any metadata beyond what is already exposed.EncodedVideoChunkOutputCallback:VideoEncoderalready provides sideband metadata as a separate parameter (output(chunk, metadata)) viaEncodedVideoChunkMetadata. Putting metadata onEncodedVideoChunkitself would either duplicateEncodedVideoChunkMetadataor create a confusing split in where metadata lives.EncodedVideoChunkcan be constructed with arbitrary bytes vianew EncodedVideoChunk(init). Allowing JS-supplied structural metadata (such as resolution, layer IDs, or dependencies) on the chunk itself creates a second source of truth that can conflict with the actual headers inside the encoded bitstream.Any WebRTC-specific metadata should be added directly to WebRTC's own objects (e.g.,
RTCEncodedVideoFrame). Closing this issue on the WebCodecs side.