Intent-to-Ship: MediaRecorder keyframe configurability

184 views
Skip to first unread message

Markus Handell

unread,
Apr 21, 2023, 12:48:17 PM4/21/23
to blin...@chromium.org, Harald Alvestrand, Henrik Boström

Contact emails:

hand...@google.com


Explainer:


TAG review:

N/A, small incremental change


Summary:

The `MediaRecorder` spec was recently updated to allow users to configure video keyframe generation parameters of the encoder. Previously there was no such support, and no spec requirements related to keyframe generation existed, leading to recorded streams that sometimes contain a single keyframe at the beginning of the stream. When played back those streams are inefficient to seek in, and it’s impossible to excise segments from them without resorting to transcoding. These problems present significant hurdles to use the MR API for some applications.


Link to “Intent to Prototype”

N/A, small incremental change and going directly for shipping.


Risks

Interoperability and Compatibility

This is now in the editors draft https://w3c.github.io/mediacapture-record/#mediarecorder-api

Gecko: No signal

WebKit: No signal

Web developers: No signals


The pull request adding this feature was reviewed and approved by the WebRTC WG containing representatives from Apple, Microsoft, and Mozilla. Feedback was addressed in the spec PR. But we have not reached out for comments on signals.


Will this feature be supported on all six Blink platforms (Windows, Mac, Linux, Chrome OS, Android, and Android WebView)?

Yes.


Is this feature fully tested by web-platform-tests?

Testability requires muxer parsers which MediaRecorder WPTs are currently lacking. https://github.com/web-platform-tests/wpt/issues/39642 has been filed to ensure WPTs are added when this is fixed.


Tracking bug

crbug.com/1371449


Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5117302963437568


Henrik Boström

unread,
Apr 24, 2023, 11:58:48 AM4/24/23
to blink-dev, Markus Handell, Harald Alvestrand, Henrik Boström
I was present when the WG discussed this pull request and can confirm that representatives of Apple, Microsoft, Firefox and Google were present when the PR was merged.
This API solves problems relating to variable frame rate tracks and being able to ensure key frames in the streams. Allowing implementing this seems like a good thing as it plugs an existing hole, so to speak.

Philip Jägenstedt

unread,
Apr 26, 2023, 3:49:14 AM4/26/23
to Henrik Boström, blink-dev, Markus Handell, Harald Alvestrand, Henrik Boström
Thanks for filing
https://github.com/web-platform-tests/wpt/issues/39642, I've asked
there for more details on what it would take to test this.

The spec change added two dictionary members to
https://w3c.github.io/mediacapture-record/#mediarecorderoptions-section
which means that it would at least be possible to add a test for
videoKeyFrameIntervalDuration and videoKeyFrameIntervalCount being
present. Can you write such a test?

Also, I think vendor signals here aren't needed given the reviews on
https://github.com/w3c/mediacapture-record/pull/216, but can you file
bugs for Gecko and WebKit?
> --
> You received this message because you are subscribed to the Google Groups "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
> To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/e104767c-a31e-4553-ad18-1a101e33d0een%40chromium.org.

Yoav Weiss

unread,
Apr 26, 2023, 6:42:09 AM4/26/23
to Markus Handell, blin...@chromium.org, Harald Alvestrand, Henrik Boström
On Fri, Apr 21, 2023 at 6:48 PM 'Markus Handell' via blink-dev <blin...@chromium.org> wrote:

I think that a real explainer that outlines the API shape and how developers would be using it would really help here with reviewing this.
Developer facing documentation could be a good replacement for that, if y'all have any.
 
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Philip Jägenstedt

unread,
Apr 26, 2023, 11:36:40 AM4/26/23
to Yoav Weiss, Markus Handell, blin...@chromium.org, Harald Alvestrand, Henrik Boström
On Wed, Apr 26, 2023 at 12:42 PM Yoav Weiss <yoav...@chromium.org> wrote:


On Fri, Apr 21, 2023 at 6:48 PM 'Markus Handell' via blink-dev <blin...@chromium.org> wrote:

I think that a real explainer that outlines the API shape and how developers would be using it would really help here with reviewing this.

I would suggest searching for "keyframeinterval" in https://w3c.github.io/mediacapture-record/, I found that to be enough to understand the API surface and what it does.

Yoav Weiss

unread,
Apr 27, 2023, 3:04:11 AM4/27/23
to Philip Jägenstedt, Markus Handell, blin...@chromium.org, Harald Alvestrand, Henrik Boström

Markus Handell

unread,
Apr 27, 2023, 3:24:06 AM4/27/23
to Yoav Weiss, Philip Jägenstedt, blin...@chromium.org, Harald Alvestrand, Henrik Boström

Thanks for filing
https://github.com/web-platform-tests/wpt/issues/39642, I've asked
there for more details on what it would take to test this.


I added some more detail there.
 
The spec change added two dictionary members to
https://w3c.github.io/mediacapture-record/#mediarecorderoptions-section
which means that it would at least be possible to add a test for
videoKeyFrameIntervalDuration and videoKeyFrameIntervalCount being
present. Can you write such a test?


Yes!
 
Also, I think vendor signals here aren't needed given the reviews on
https://github.com/w3c/mediacapture-record/pull/216, but can you file
bugs for Gecko and WebKit?

Philip Jägenstedt

unread,
Apr 27, 2023, 6:38:11 AM4/27/23
to Markus Handell, Yoav Weiss, blin...@chromium.org, Harald Alvestrand, Henrik Boström
On Thu, Apr 27, 2023 at 9:24 AM Markus Handell <hand...@google.com> wrote:

Thanks for filing
https://github.com/web-platform-tests/wpt/issues/39642, I've asked
there for more details on what it would take to test this.


I added some more detail there.
 
The spec change added two dictionary members to
https://w3c.github.io/mediacapture-record/#mediarecorderoptions-section
which means that it would at least be possible to add a test for
videoKeyFrameIntervalDuration and videoKeyFrameIntervalCount being
present. Can you write such a test?


Yes!

Thanks! It won't test the behavior, but will at least let the tests show if there's some support or not, and catch typos in IDL, which happens.
 
Also, I think vendor signals here aren't needed given the reviews on
https://github.com/w3c/mediacapture-record/pull/216, but can you file
bugs for Gecko and WebKit?

Bugs filed:

Thank you!

Skimming https://w3c.github.io/mediacapture-record/#mediarecorderoptions-section I have just one more question about interop here. The spec says "If both videoKeyFrameIntervalDuration and videoKeyFrameIntervalCount are not null, the UA may ignore either." It seems to me an implementation will definitely pick one of them to ignore and it will be deterministic. Is there any reason to leave this up to the UA instead of writing in the spec which takes precedent?

Best regards,
Philip

Markus Handell

unread,
Apr 27, 2023, 7:40:14 AM4/27/23
to Philip Jägenstedt, Yoav Weiss, blin...@chromium.org, Harald Alvestrand, Henrik Boström
Yep this topic was discussed on https://github.com/w3c/mediacapture-record/pull/216#discussion_r1159521616 and earlier. In the end I backed out of my proposed semantics due to scepticism so the PR leaves it unspecified.

During the interim that hbos@ speaks to where the PR was merged, it was decided that a separate spec issue be filed on that topic, https://github.com/w3c/mediacapture-record/issues/219.

Philip Jägenstedt

unread,
Apr 27, 2023, 10:02:59 AM4/27/23
to Markus Handell, Yoav Weiss, blin...@chromium.org, Harald Alvestrand, Henrik Boström
Great, with https://github.com/w3c/mediacapture-record/issues/219 filed and the discussion you linked to, I don't think this needs to block.

LGTM1 to ship given a surface-level test in WPT as discussed.

Chris Harrelson

unread,
Apr 28, 2023, 4:24:20 PM4/28/23
to Philip Jägenstedt, Markus Handell, Yoav Weiss, blin...@chromium.org, Harald Alvestrand, Henrik Boström
LGTM2

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.

Yoav Weiss

unread,
Apr 28, 2023, 10:43:02 PM4/28/23
to Chris Harrelson, Philip Jägenstedt, Markus Handell, blin...@chromium.org, Harald Alvestrand, Henrik Boström
LGTM3

Markus Handell

unread,
May 5, 2023, 2:49:34 AM5/5/23
to Yoav Weiss, Chris Harrelson, Philip Jägenstedt, blin...@chromium.org, Harald Alvestrand, Henrik Boström
Thanks all! 
Reply all
Reply to author
Forward
0 new messages