I am trying to record a video using HTML5 VideoEncoder. There's a number of AVC profiles one can use (https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#av1). According to that page, 4:2:2 profiles are starting from 7A
, like this:
let videoEncoder = new VideoEncoder({
output: (encodedChunk, config) => {
// recording chunks using mp4box or mp4muxer
},
error: (error) => {
console.log("onCodecError ", error);
},
});
videoEncoder.configure({
codec: "avc1.7A1032", // 4:2:2 profile
width: 1920,
height: 1280,
hardwareAcceleration: "prefer-hardware",
avc: { format: "avc" },
});
Unfortunately this returns DOMException: Unsupported codec profile.
I tried the following script to discover any supported 7A
profiles:
for (let i = 0; i < 256*256; i++) {
try {
let config = {
codec: "avc1.7A" + i.toString(16),
width: 1920,
height: 1280,
framerate: 25,
bitrate: 50_000_000,
avc: { format: "avc" },
};
let response = await VideoEncoder.isConfigSupported(config);
if (response.supported) { console.log(config.codec); }
} catch(e) {}
}
And found quite a few actually:
For example, 7A4032
. Unfortunately, despite this profile works well, it results in YUV420 recording. Also it's nowhere to be found on a https://developer.mozilla.org/en-US/docs/Web/Media/Formats/codecs_parameter#av1 page, so I am afraid it's a kind of a glitch.
So, the question is, is there any way to record video with YUV422 profile?
UPD: even more weird that the same happens with VP09 codec. It's format is vp09.PP.LL.DD, where PP defines profile. So 00 and 02 are for 420, while 01 and 03 are for 422. And I can't create any 01 or 03 profile as well.