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

Expose in VideoFrameMetadata some fields from VideoFrameCallbackMetadata #601

Closed
youennf opened this issue Oct 27, 2022 · 18 comments
Closed
Labels
agenda Add to Media WG call agenda CR Blocking Needs to resolved for Candidate Recommendation PR exists A PR has been submitted that addresses this issue

Comments

@youennf
Copy link
Contributor

youennf commented Oct 27, 2022

It seems useful to expose some fields in VideoFrameMetadata like:

This could be added as an entry in VideoFrameMetadata registry.

@dalecurtis
Copy link
Contributor

These sound fine to me, but @aboba points out that https://wicg.github.io/video-rvfc/ may not meet the registry requirements yet.

I know at TPAC there was some talk of moving rVFC into the HTML spec. Do we still want to do that?

@chrisn @tguilbert-google

@youennf
Copy link
Contributor Author

youennf commented Oct 27, 2022

I think the idea would be to write a registry entry that would define these values without referencing rvfc. Instead, it would reference webrtc-pc and/or media capture-main.

@tguilbert-google
Copy link
Member

Yes, I was still planning on moving rVFC to the HTML spec. I haven't found the time to do so yet. Embedding the spec into the HTML spec is more work than just referencing it.

Previous (closed) PR tracking this work:
whatwg/html#5332 (comment)

@chrisn
Copy link
Member

chrisn commented Oct 28, 2022

I agree, adding this into HTML makes sense.

@aboba
Copy link
Collaborator

aboba commented Oct 28, 2022

The RVFC metadata items seem quite useful to me, but they also raise some questions for the behavior of other APIs:

  1. In the VideoFrame(s) produced by MediaStreamTrackProcessor, should we expect capturetime metadata to be present?
  2. Is there an expectation that the WebCodecs encoder will carry Videoframe metadata items through to encodedChunk metadata? (e.g. capturetime)
  3. Is there an expectation that the WebCodecs decoder will carry encodedChunk metadata items through to VideoFrame metadata? (e.g. receivetime)

Without an explicit change to the WebCodecs API, I'm assuming that the answer to questions 2 and 3 is "no". But what I'd really like to be able to do is to trace performance through each stage of the receive and send pipeline.

@youennf
Copy link
Contributor Author

youennf commented Nov 7, 2022

  1. In the VideoFrame(s) produced by MediaStreamTrackProcessor, should we expect capturetime metadata to be present?

It depends on MediaStreamTrack's source. If source is getUserMedia, yes.

2. Is there an expectation that the WebCodecs encoder will carry Videoframe metadata items through to encodedChunk metadata? (e.g. capturetime)

EncodedVideoChunk has no metadata so I would think that it would not be carried automatically.
webrtc encoded transform could decide to expose it in RTCEncodedVideoFrameMetadata but this is out of scope of web codecs.

3. Is there an expectation that the WebCodecs decoder will carry encodedChunk metadata items through to VideoFrame metadata? (e.g. receivetime)

My understanding is that the decoder will not have that data so will not set it.
The application wrapping the decoder will have this data (say the WebRTC pipeline) and can cheaply attach it to the video frame.

@aboba
Copy link
Collaborator

aboba commented Mar 2, 2023

We now have a proposal to add some timing information to the RTCEncodedVideoFrameMetadata: w3c/webrtc-encoded-transform#173

Would it make sense to define a metadata registry for encodedChunk and add similar info there?

@dalecurtis dalecurtis added the need-definition An issues where something needs to be specified normatively label Mar 16, 2023
@guidou
Copy link

guidou commented Mar 25, 2024

Is it possible to make progress with this?
Recently, we have received requests from developers asking for this, in particular capture time, to be exposed via MediaStreamTrackProcessor.

@Djuffin
Copy link
Contributor

Djuffin commented Mar 25, 2024

Why can't we use regular VideoFrame.timestamp for capture time when frames are coming from a capture device.

@tguilbert-google
Copy link
Member

@guidou reached out to me last Friday about surfacing capture timestamps, proposing VideoFrame.timestamp. My apologies, I didn't follow up after discussing with @Djuffin, and how VideoFrame.timestamp was a valid path forward.

The MediaStreamTrackProcessor spec could define how the timestamp is populated, and might not need a WebCodecs spec change?

@Djuffin Djuffin added the agenda Add to Media WG call agenda label Mar 28, 2024
@Djuffin
Copy link
Contributor

Djuffin commented Mar 28, 2024

We should probably discuss it in the next WG meeting.
Extra VideoFrame metadata isn't very useful unless we carry it with video chunks and handle it in encoders and decoders.

@aboba aboba added the CR Blocking Needs to resolved for Candidate Recommendation label Apr 17, 2024
@guidou
Copy link

guidou commented May 28, 2024

Why can't we use regular VideoFrame.timestamp for capture time when frames are coming from a capture device.

We can do that. However, when writing a VideoFrame to a VideoTrackGenerator it is useful to know that the timestamp is a capture timestamp (or alternatively, that the VideoFrame should be treated as a frame coming from a capturer) since the downstream sinks (e.g., a Peer Connection) may treat the frame differently from non-capturer frames. Currently it is not possible to make this distinction, even if the timestamp of capture VideoFrames is the capture timestamp.

@guidou
Copy link

guidou commented May 29, 2024

Extra VideoFrame metadata isn't very useful unless we carry it with video chunks and handle it in encoders and decoders.

We have use cases for VideoFrame that don't involve encoders or decoders (at least WebCodec ones) that would benefit from this metadata. These use mediacapture-transform.

@alvestrand
Copy link

Seems that when we have metadata on VideoFrame and metadata on RtcEncodedVideoFrame, and we're not looking at an option to make WebCodecs produce/consume RTCEncodedVideoFrame, there's an argument to make that we should be adding metadata to EncodedVideoChunk too, so that it can be carried throughout the ecosystem.

@padenot
Copy link
Collaborator

padenot commented May 29, 2024

Yes, this was requested in the past, but I don't remember by who or for what. But it would be useful for sure. I think it was someone working in the cinema industry, but I could be completely misremembering.

@aboba
Copy link
Collaborator

aboba commented May 29, 2024

@alvestrand @padenot Here are the Issues relating to Encoded*Chunk metadata:
#245
#189

@aboba aboba added PR exists A PR has been submitted that addresses this issue and removed need-definition An issues where something needs to be specified normatively labels Dec 4, 2024
@aboba
Copy link
Collaborator

aboba commented Dec 5, 2024

Related PR: #813

Once this PR is merged, can we close this issue?

@Djuffin @youennf @guidou @alvestrand What are your thoughts?

@Djuffin
Copy link
Contributor

Djuffin commented Dec 10, 2024

Yes, I think when we merge PR: #813 we can close this one.

@Djuffin Djuffin closed this as completed Dec 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agenda Add to Media WG call agenda CR Blocking Needs to resolved for Candidate Recommendation PR exists A PR has been submitted that addresses this issue
Projects
None yet
Development

No branches or pull requests

9 participants