Problem
Chromium and Chrome implementation of video decoder does not display the correct value for the encoded frame width
and height
when the video is produced by W3C specification MediaRecorder
ad the video codec is set to VP8 or VP9.
The result is various incorrect values being output for videoWidth
, videoHeight
, ImageBitmap.width
, ImageBitmap.height
, MediaStreamTrack.getSettings().width
and MediaStreamTrack.getSettings().height
and the tab crashing when HTMLMediaElement.captureStream()
is called on a <video>
element where the encoded frames have variable resolution through the track (tab crashes at first resize
of the <video>
element).
In brief the bug is described at https://bugs.chromium.org/p/chromium/issues/detail?id=1004018.
Solution
Add an attribute and property to HTML <video>
decodeAndDisplayFrameResolution
element which mandates the VP8 and VP9 video decoders decode each individual encoded frame and display the potentially variable resolution (width and height) frames at HTML <video>
element during playback instead of only reading the initial pixel dimensions once from the metadata of the WebM file.
Adding the attribute and property will avoid ambiguity as to what width and height is expected to be displayed at the HTML <video>
element meaning that when variable resolution frames are encoded there will be a means officially specified to decode and display the each encoded frame which could potentially be encoded with variable resolution within the media file instead of only decoding the initial frame or media file metadata resolution.