demo · v136

Variable resolution recording

The chromestatus changelog calls out the new hev1.* and avc3.* codec strings: unlike hvc1 / avc1, the parameter sets travel in-band, so the encoder can change resolution mid-stream without breaking decoders. Below: a canvas-driven source that grows from 320×240 to 640×480 partway through, recorded in each codec, then probed for resolution stitching.

Probing MediaRecorder codec support…

which codec strings does this browser advertise?

recorded mimeType
first half (320×240)
second half (640×480)
verdict

the code

// avc3 / hev1 = in-band parameter sets → safe to change resolution mid-stream.
// avc1 / hvc1 = out-of-band → locked to whatever the first SPS/PPS said.
const rec = new MediaRecorder(stream, {
  mimeType: "video/mp4;codecs=avc3.42E01F",
});
rec.start();
setTimeout(() => canvas.width = 640, 2000);  // bump resolution; rec keeps going.

why this angle

The sibling concept demonstrates that HEVC and the new AVC profiles record. This concept demonstrates the reason the hev1 / avc3 variants were specifically added: in-band parameter sets. Without them, the codec string locks a single resolution into the file. Real-world senders (variable-bitrate cameras, screen capture that changes window size, adaptive uplinks) need to change resolution without restarting the recorder — only the in-band variants support that.

see also