Skip to content

Need EncodedChunk to have video metadata to support WebRTC #245

Closed

Description

@alvestrand

The WebRTC Encoded Transform spec's VideoFrame object (https://w3c.github.io/webrtc-encoded-transform/#rtcencodedvideoframe) has a getMetadata function that returns information about the frame that is produced by the encoder, and needs to be passed on to consumers (and vice versa for decoders).

If we're going to harmonize RTCEncodedVideoFrame with EncodedVideoChunk, we need some way to provide this functionality.

(This bug is created as part of bug triage on webrtc-encoded-transform; all bugs that are about buffer formats should move here, I think.)

Activity

  1. added
    extension
    on May 12, 2021
  2. aboba commented on May 18, 2021

    @aboba
    Collaborator
  3. aboba commented on Jun 11, 2021

    @aboba
    Collaborator

    @alvestrand Looks like we need to plan for metadata extensibility, so moving the SVC metadata into its own svc dictionary probably makes sense.

  4. added
    CR Blocking
    and removed
    extension
    on May 8, 2024
  5. aboba commented on May 8, 2024

    @aboba
    Collaborator

    @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?

  6. added
    TPAC2024
    on May 8, 2024
  7. padenot commented on May 13, 2024

    @padenot
    Collaborator

    For WebRTC folks to answer.

  8. added
    agenda
    on Dec 5, 2024
  9. aboba commented on Dec 5, 2024

    @aboba
    Collaborator

    @alvestrand Is this still an issue, or can we close this?

  10. alvestrand commented on Dec 5, 2024

    @alvestrand
    Author

    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.

  11. alvestrand commented on Dec 5, 2024

    @alvestrand
    Author

    Here's the table from my half-baked doc:

    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).

  12. aboba commented on Dec 5, 2024

    @aboba
    Collaborator

    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.

    But this issue is really about Encoded Transform's RTCEncodedVideoFrame, not WebCodecs EncodedVideoChunk, right?

  13. Djuffin commented on Dec 10, 2024

    @Djuffin
    Contributor

    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.

  14. removed
    agenda
    on Jan 9, 2025
  15. Djuffin commented on Oct 27, 2026

    @Djuffin
    Contributor

    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:

    1. 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.
    2. Duplication with EncodedVideoChunkOutputCallback: VideoEncoder already provides sideband metadata as a separate parameter (output(chunk, metadata)) via EncodedVideoChunkMetadata. Putting metadata on EncodedVideoChunk itself would either duplicate EncodedVideoChunkMetadata or create a confusing split in where metadata lives.
    3. 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    CR BlockingTPAC2024

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions