Confused by `VideoDecoderConfig.codedWidth`, does not reflect the actual coded width of the underlying coded frame
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Da chiarire
- Stato di attività
- Ferma
- Stack tecnologico
- javascript
- Ambito
- api, audio-video-rtc
Direzione di ricerca
Inizia con le definizioni WebCodecs per VideoDecoderConfig.codedWidth e VideoFrame.codedWidth, quindi esegui la riproduzione AVC fornita di VideoEncoder/VideoDecoder. Confronta le dimensioni di configurazione riportate con le dimensioni del frame decodificato; il lavoro è completato quando si è deciso se il comportamento è intenzionale e si è raggiunto un accordo sull’eventuale modifica alla specifica.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
In all permutations I have tried ((Chrome, Firefox, Safari) x (Windows, Mac)), the codedWidth and codedHeight properties in the VideoDecoderConfig emitted by VideoEncoder contain the display dimensions of the frame, or in other words, the dimensions with which the encoder was initialized. In my work on Mediabunny, I have relied on this behavior extensively as a means to communicate video dimensions to muxers.
However, I kind of just realized... that behavior is wrong (probably)? The definition of VideoDecoderConfig.codedWidth is:
Width of the VideoFrame in pixels, potentially including non-visible padding, and prior to considering potential ratio adjustments.
Which is identical to the definition of VideoFrame.codedWidth.
So let's say we do this:
const decoder = new VideoDecoder({
output: (frame) => {
console.log("Actual coded width:", frame.codedWidth);
console.log(frame);
},
error: console.error,
});
const encoder = new VideoEncoder({
output: (chunk, meta) => {
console.log("Reported coded width:", meta.decoderConfig.codedWidth);
decoder.configure(meta.decoderConfig);
decoder.decode(chunk);
decoder.flush();
},
error: console.error,
});
encoder.configure({
codec: 'avc1.64001f',
width: 650,
height: 650,
bitrate: 1e6,
});
const canvas = new OffscreenCanvas(650, 650);
const ctx = canvas.getContext('2d');
ctx.fillStyle = 'red';
ctx.fillRect(100, 100, 200, 200);
const frame = new VideoFrame(canvas, { timestamp: 0 });
encoder.encode(frame);
await encoder.flush();
We encode a 650x650 frame using AVC, which then, when decoded, has a codedWidth of 656. Makes total sense, since the dimensions have been rounded up to the nearest 16x16 macroblock, and 16 divides 656. But, the decoder config reports the codedWidth as 650.
So, same field, same definition in the spec, different values.
While I think it's useful that it contains the display dimensions, I would argue the behavior is not technically correct. Here's what I would expect:
codedWidthreflects the actualcodedWidthyou'd get by decoding the chunks (this makes it consistent, and actually provides new information that you didn't already know based on how you set up the encoder)VideoDecoderConfigis extended withdisplayWidth,displayHeight,visibleRect, andcodedRect, with definitions identical to those onVideoFrame.
What do you guys think? Is the current behavior of codedWidth faulty or intentional? Can this be fixed, or is it too late now since any change might break existing software that relies on the current behavior?
Edit:
My proposed ""change"" to codedWidth would mean that demuxers, when extracting VideoDecoderConfig for VideoDecoder, would need more complicated logic to derive the coded width, since they likely only know the display dimensions from the container metadata. Luckily, the fields are optional, so any demuxer could just omit it. But still, kinda annoying. Perhaps one should go the other route, retconning codedWidth to be defined in the spec as it is currently provided by browsers?
- Lingua principale
- HTML
- Stelle
- 1.3k
- Fork
- 192
- Merge medio
- 3h 36m
- PR unite (30g)
- 7
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di w3c/webcodecs
-
privacy-needs-resolution
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 65/100
I maintainer di solito rispondono entro 1 giorno
-
editorial
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
I maintainer di solito rispondono entro 1 giorno
-
TPAC2026
Difficoltà 5/5 Più di una settimana Idoneità per principianti 8/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di w3c/webcodecs
Issue simili
-
bug help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] 增量 SSE 解析器未识别单独 CR 换行,导致事件无法及时交付Forse già presa @king-wwwhhh l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
langchain4j/langchain4j#6669 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
microsoft/playwright#43327 ·
I maintainer di solito rispondono entro 1 giorno
-
Rename FunctionalRole BOT_DEV to DEV_STAFFForse già presa Una pull request collegata a questa issue è aperta o già unita. Apertaenhancement good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
pesu-dev/discord_bot#97 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
microsoft/TypeScript#64758 ·
I maintainer di solito rispondono entro 1 giorno