Many video encoder implementations include efficient ways to calculate the PSNR of an encoded frame. This can be highly useful for analyzing the generated video quality. This is currently being added to webrtc-stats but is desirable also for WebCodecs.
Some examples of software encoders supporting this functionality include libvpx (VP8/VP9), libaom (AV1) and OpenH264. As for hardware encoders I'm aware of at least D3D12 and VideoToolbox exposing this, assuming the underlying implementation supports it.
There is however no guarantee that it will be available, so it should be generated on a best-effort basis.
I suggest adding a boolean generatePsnr to the VideoEncoderEncodeOptions dictionary (default to false) to request PSNR data from the encoder. If the encoder generated PSNR data, then put it in a new dictionary YuvVideoPsnr (containing separate measurements for the Y, U and V channels) inside the EncodedVideoChunkMetadata dictionary.
Many video encoder implementations include efficient ways to calculate the PSNR of an encoded frame. This can be highly useful for analyzing the generated video quality. This is currently being added to webrtc-stats but is desirable also for WebCodecs.
Some examples of software encoders supporting this functionality include libvpx (VP8/VP9), libaom (AV1) and OpenH264. As for hardware encoders I'm aware of at least D3D12 and VideoToolbox exposing this, assuming the underlying implementation supports it.
There is however no guarantee that it will be available, so it should be generated on a best-effort basis.
I suggest adding a boolean
generatePsnrto theVideoEncoderEncodeOptionsdictionary (default to false) to request PSNR data from the encoder. If the encoder generated PSNR data, then put it in a new dictionaryYuvVideoPsnr(containing separate measurements for the Y, U and V channels) inside theEncodedVideoChunkMetadatadictionary.