Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for Opus audio in fragmented MP4 #1219

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/media-segment-request.js
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,8 @@ const handleSegmentBytes = ({
// if we have a audio track, with a codec that is not set to
// encrypted audio
if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== 'enca') {
trackInfo.audioCodec = tracks.audio.codec;
// note Opus box name is capitalized, but things want lowercase for checks
trackInfo.audioCodec = tracks.audio.codec.toLowerCase();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We get this information from mux.js specifically lib/mp4/probe.js and we toLowerCase the codec there if it isn't one that we know. I guess i'm just not understanding how we can get here with a codec that isn't lowercase. Do you have a test source that we can look at?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, here's my test page that combines a few things:
https://brionv.com/misc/hls-test/ogv.html

The Opus audio track: https://brionv.com/misc/hls-test/caminandes-llamigos.webm.audio.opus.mp4

The actual codec fourCC for Opus in MP4 is "Opus" (0x7375704F) -- it is not lowercased in the actual binary file.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll pull up the local source and double-check versions of everything when I get a chance -- feel free to shoot any questions on my usage and I'll try my best to answer. :)

I'm not 100% confident I'm correctly labeling everything in the m3u8 for the Opus track version. (iOS accepts the MP3 audio version.)

}

// if we have a video track, with a codec that is not set to
Expand Down