Add ability to generate PSNR statistics for an encoded video frame
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 1.3k
- Forks
- 194
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 3
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the WebCodecs definitions for VideoEncoderEncodeOptions and EncodedVideoChunkMetadata, then review the linked webrtc-stats PSNR field for expected semantics. Done means the API can request PSNR generation, reports separate Y, U, and V measurements when available, and preserves best-effort behavior when encoders do not provide them.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, audio-video-rtc
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100