Confused by `VideoDecoderConfig.codedWidth`, does not reflect the actual coded width of the underlying coded frame
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript
- Área
- api, audio-video-rtc
Línea de trabajo
Comienza con las definiciones de WebCodecs para VideoDecoderConfig.codedWidth y VideoFrame.codedWidth, y luego ejecuta la reproducción de AVC proporcionada de VideoEncoder/VideoDecoder. Compara las dimensiones de configuración indicadas con las dimensiones del frame decodificado; el trabajo estará terminado cuando se haya decidido si el comportamiento es intencional y se haya alcanzado un acuerdo sobre el cambio en la especificación, si lo hubiera.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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?
- Lenguaje dominante
- HTML
- Estrellas
- 1.3k
- Forks
- 192
- Merge medio
- 3 h 36 min
- PR fusionados (30 d)
- 7
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de w3c/webcodecs
-
privacy-needs-resolution
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
editorial
Dificultad 1/5 Menos de una hora Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
TPAC2026
Dificultad 5/5 Más de una semana Aptitud para principiantes 8/100
Los mantenedores suelen responder en 1 día
Todos los issues de w3c/webcodecs
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
[BUG] Re-subscribing the Mono returned by listTools/listResources/listResourceTemplates/listPrompts/listRoots duplicates the resultsPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/java-sdk#1174 · 1 reacción ·
Los mantenedores suelen responder en 2 días
-
[BUG] 运行位置的分支列表不自动刷新,外部新建的分支看不到Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
NanmiCoder/cc-haha#1533 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Remove song from playlistAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
maxrave-dev/SimpMusic#2649 ·
Los mantenedores suelen responder en 2 días
-
product/backlog
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
TencentBlueKing/bk-nodemgr#3645 ·
Los mantenedores suelen responder en 1 día