fix: handle av1 VideoDecoder errors#334
Open
matthew-hre wants to merge 2 commits intosiddharthvaddem:mainfrom
Open
fix: handle av1 VideoDecoder errors#334matthew-hre wants to merge 2 commits intosiddharthvaddem:mainfrom
matthew-hre wants to merge 2 commits intosiddharthvaddem:mainfrom
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix AV1 VideoDecoder error during export when recordings use AV1 in WebM containers (the default on Linux). When
web-demuxerreturns a bare "av01" codec string, we now parse theAV1CodecConfigurationRecordfrom the extradata to build the full WebCodecs-compatible codec string (e.g. "av01.0.09M.08").Motivation
My export kept crashing 😭. Chrome/Electron's
MediaRecorderwrites AV1 WebM files with anAV1CodecConfigurationRecordwhose version field is 127 (0xFFfirst byte) instead of the spec-mandated 1 (0x81). Theweb-demuxerlibrary's WASM-side parser (set_av1_codec_string) strictly checksversion != 1and bails early, returning a bare "av01" string rather than the full parametrized form. VideoDecoder.configure() then rejects it with "Unknown or ambiguous codec name", making all AV1 exports fail.extradata: FF 09 0C 00 ↓ web-demuxer: version = 0xFF & 0x7F = 127 ≠ 1 → early return → "av01" ↓ VideoDecoder.configure({ codec: "av01" }) → "Unknown or ambiguous codec name"When
getDecoderConfig()returns a bare "av01", we now parse the extradata ourselves, only requiring the marker bit to be set rather than a strict version check. For the example above this produces "av01.0.09M.08" (Main profile, level 3.1, Main tier, 8-bit). Falls back to "av01.0.01M.08" if extradata is missing or too short.Type of Change
Related Issue(s)
None. Discovered while packaging for NixOS.
Screenshots / Video
N/A: no UI changes. The fix is in the export pipeline (
streamingDecoder.ts).Testing
Before fix: Export fails with "VideoDecoder Error: Unknown or ambiguous codec name"
After fix: Export completes successfully
You can verify your recording is AV1/WebM with:
ffprobe -v warning -select_streams v:0 -show_entries stream=codec_name ~/.config/openscreen/recordings/<your-recording>.webmIf you see
Unknown version 127 of AV1CodecConfigurationRecord found!in the warnings, your file is affected by this bug.Checklist
Summary by CodeRabbit