Repository navigation
feat(spf): add an audio codec preference to the publish encoder ladder - #37
Merged
Merged
Conversation
probeEncoderSupport built its audio ladder from a hardcoded Opus codec,
so every publish session was Opus unconditionally — making RTMP/FLV and
LL-HLS egress video-only for every browser publish even where the
browser ships an AAC encoder.
Mirror the camera/screen codec seam: `audio.codec` on the engine config
prepends a preferred WebCodecs codec string to the Opus default rather
than replacing it, codec-major across the sample-rate ladder, so
`audio: { codec: 'mp4a.40.2' }` publishes AAC where the browser can
encode it and degrades to Opus where it can't. The catalog side already
describes whatever the encoder emits (mp4a init-data gating, non-Opus
sample-rate passthrough), so this is encoder-ladder work only.
Closes #36
📦 Bundle Size Report🎨 @videojs/html — 1 small size change
Presets (7)
Media (17)
Players (6)
Skins (32)
UI Components (52)
⚛️ @videojs/react — 1 small size change
Presets (7)
Media (19)
Players (5)
Skins (29)
UI Components (47)
🧩 @videojs/core — no changesEntries (77)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/jsx — no changesEntries (3)
📦 @videojs/media — no changesEntries (15)
📦 @videojs/spf — 2 small size changes
Entries (13)
ℹ️ How to interpretEach entry is independently bundled, minified, and brotli-compressed. Initial size includes its static import graph; lazy dynamic chunks are reported separately. Entries are not additive because their dependency graphs overlap. Preset rows represent realistic combined bundles. Changes of 300 B or less across initial, lazy, and total size are collapsed, not discarded. Run |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Closes #36
Summary
probeEncoderSupporthardcoded Opus as the only audio codec, so every browser publish was Opus unconditionally — and RTMP/FLV re-publish and LL-HLS egress (both structurally unable to carry Opus) went video-only. This adds theaudio.codecseam the issue asks for, as a preference walk with an Opus fallback.Changes
MoqPublishEngineConfig.audio(andProbeEncoderSupportConfig.audio) gains acodecfield — a new exportedAudioEncodeTuningtype — with the same semantics as the existingcamera/screencodec seam: the preferred WebCodecs codec string prepends to the Opus default ladder rather than replacing it, soaudio: { codec: 'mp4a.40.2' }publishes AAC where the browser can encode it and degrades to Opus where it can't (e.g. headless Chromium).deriveCatalogalready gatesmp4a.*on its AudioSpecificConfig init data and only special-cases Opus's 48 kHz sample-rate rewrite, and the audio encoder actor already ridesdecoderConfig.descriptionon every frame in the LOC Audio Config property.Testing
AudioEncoder.isConfigSupported— headless Chromium ships no AAC encoder), the Opus fallback when the preference is unsupported, and ladder dedup when the preference is the default.pnpm -F @videojs/spf test src/publish— 247 passed; spf build + fullpnpm typecheckclean.🤖 Generated with Claude Code
Summary by cubic
Adds an audio codec preference to the publish encoder ladder so browsers that can encode AAC publish AAC; others fall back to Opus. Previously, audio was always Opus, causing RTMP/FLV re-publish and LL‑HLS egress to drop audio.
Review and rollout
AudioEncodeTuning;MoqPublishEngineConfig.audioandProbeEncoderSupportConfig.audionow accept{ bitrate?, codec? }.audio.codecis tried across sample rates before Opus; unsupported preferences degrade to Opus.audio.codecis set.audio: { codec: 'mp4a.40.2' }to publish AAC where supported; no changes required otherwise.Written for commit 7f056cb. Summary will update on new commits.