Confused by `VideoDecoderConfig.codedWidth`, does not reflect the actual coded width of the underlying coded frame
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Muss geklärt werden
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- javascript
- Bereich
- api, audio-video-rtc
Rechercherichtung
Beginnen Sie mit den WebCodecs-Definitionen für VideoDecoderConfig.codedWidth und VideoFrame.codedWidth und führen Sie dann die bereitgestellte VideoEncoder/VideoDecoder-AVC-Reproduktion aus. Vergleichen Sie die gemeldeten Konfigurationsdimensionen mit den Dimensionen des dekodierten Frames; abgeschlossen ist die Untersuchung, wenn entschieden wurde, ob das Verhalten beabsichtigt ist, und eine Einigung über die Änderung an der Spezifikation, falls überhaupt eine erforderlich ist, erzielt wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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?
- Vorherrschende Sprache
- HTML
- Sterne
- 1.3k
- Forks
- 193
- Ø Merge
- 1 T. 4 Std.
- Gemergte PRs (30 T.)
- 12
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus w3c/webcodecs
-
privacy-needs-resolution
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
editorial
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
w3c/webcodecs#983 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
w3c/webcodecs#978 · 3 Kommentare ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
w3c/webcodecs#977 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
virtualmin/virtualmin-gpl#1322 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
kind/bug needs-priority needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
konveyor/tackle2-hub#1166 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 4 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
UKGovernmentBEIS/inspect_ai#6268 ·
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
bherbruck/solvecraft#11246 · 1 Kommentar · 1 Reaktion ·