Confused by `VideoDecoderConfig.codedWidth`, does not reflect the actual coded width of the underlying coded frame
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript
- 領域
- api, audio-video-rtc
調査の方向性
まず VideoDecoderConfig.codedWidth と VideoFrame.codedWidth の WebCodecs 定義を確認し、次に提供されている VideoEncoder/VideoDecoder AVC 再現を実行します。報告された構成の寸法とデコードされたフレームの寸法を比較します。動作が意図されたものかどうかを判断し、仕様を変更する場合はその変更について合意に達することが完了の条件です。
索引モデルが issue の本文から書いたものです。
説明
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?
- 主要言語
- HTML
- スター
- 1.3k
- フォーク
- 192
- 平均マージ
- 21時間 7分
- マージ済み PR(30日)
- 8
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
w3c/webcodecs のほかの issue
-
privacy-needs-resolution
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
editorial
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
w3c/webcodecs#972 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
w3c/webcodecs#971 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
effort: low prio: low ready
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
digitalfabrik/integreat-cms#4616 ·
メンテナーはふだん 5 日以内に返信
-
refactor topic-map
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
メンテナーはふだん 1 日以内に返信
-
Add an EPUB parserオープンarea: core good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
openapi/gknowledge#21 ·
-
get() for StrEnum対応中かも @FeJo5952 が今日担当しました。 オープンgood first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
collective/icalendar#1921 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
ETQ admin, le select de condition d'une annotation répétable liste les champs publics deux foisオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
demarche-numerique/demarche.numerique.gouv.fr#14301 ·
メンテナーはふだん 1 日以内に返信