w3c / w3c/webcodecs

When is encoder conversion necessary?

Open
#407 18 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

extension
Dominant language
HTML
Stars
1.3k
Forks
194
Avg merge
1d 13h
Merged PRs (30d)
3

Description

The spec specifies that an implementation MUST support pixel format conversion for rendering and MUST support sample format conversion at least to float32. The spec thus makes it clear that everything has to be convertible to float32 (samples) and RGBA (pixels). But, all that VideoEncoder and AudioEncoder have to say on the matter is «Attempt to use [[codec implementation]] to encode frameClone according to options.». In practice, Chrome will happily convert anything to the pixel/sample format used internally by the selected codec. It'll even happily scale for you! But, it won't resample or mix/split tracks? Poking different AudioDatas and VideoFrames into it, I can get it to do some things and not to do others, but it's not at all clear what it will and won't do.

The question is, what aspects of this internal conversion during encoding are MUST, SHOULD, or implementation-specific? Right now, it seems like it's all implementation-specific, and if that's so, it would be nice to document that fact in the spec. But, surely it MUST at least support pixel and sample format conversion, as those are both codec-specific. The spec should make this clear.

(Apologies for all the issue posts lately, but the upshot is that there are now two implementations of the spec, so that's a good thing, right?)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the WebCodecs spec's VideoEncoder and AudioEncoder encoding steps, focusing on the instruction to encode a frame according to options. Compare the stated conversion requirements with the observed Chrome behavior, then clarify which pixel, sample, scaling, resampling, and channel-mixing conversions are required, recommended, or implementation-specific.

Written by the indexing model from the issue text.

Assessment

Tech stack
html
Domain
api, audio-video-rtc
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.