Skip to content

Opus: Need data for MP4 and WebM containers #6805

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

Open
Artoria2e5 opened this issue Aug 18, 2023 · 6 comments
Open

Opus: Need data for MP4 and WebM containers #6805

Artoria2e5 opened this issue Aug 18, 2023 · 6 comments

Comments

@Artoria2e5
Copy link
Contributor

Artoria2e5 commented Aug 18, 2023

Opus has an ISOBMFF (MP4) encapsulation defined in 2016. There may be differences in supporting the base Ogg format, in WebM container, and in the MP4/M4A container. MP4 can reasonably used in the <audio> tag: M4A/AAC files are an example.

I know that Opus WebM with up to 2 channels is okay in safari, but Opus Ogg is not okay in Safari at all.

@Artoria2e5 Artoria2e5 changed the title Opus: Need data for MP4 container Opus: Need data for MP4 and WebM containers Aug 18, 2023
@nihil-admirari
Copy link

  1. Had success opening Opus in MP4 in Safari on iOS 17.
  2. Opus in WebM doesn't work on iOS..
  3. Support depends on Lockdown Mode being disabled. If Lockdown mode is enabled, even Opus in CAF stops working.

Test files are provided by chromium:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Opus Test</title>
  <style>
    body {
        display: flex;
        flex-direction: column;
    }
  </style>
</head>
<body>
  Opus in WebM:
  <audio controls
         src="https://raw.githubusercontent.com/chromium/chromium/main/media/test/data/bear-opus.webm">
  </audio>
  Opus in MP4:
  <audio controls
         src="https://raw.githubusercontent.com/chromium/chromium/main/media/test/data/bear-opus.m4a">
  </audio>
</body>
</html>

@nihil-admirari
Copy link

Apple officially declared support for Opus in WebM and MP4 in Safari 17 Release Notes:

Added support for stereo-only Opus in MPEG-4 and WebM containers on macOS Sonoma. (50994465)

@nihil-admirari
Copy link

nihil-admirari commented Mar 7, 2024

Opus in WebM does work on iOS 17.4. Tested on https://hpr.dogphilosophy.net/test/.

@Artoria2e5
Copy link
Contributor Author

I wonder if they allow VBR in those containers too -- Opus/CAF support was originally limited to CBR. I should really get a Sonoma machine to test with...

@wbob
Copy link
Contributor

wbob commented May 9, 2024

@Artoria2e5 as the audio/webm opus file on the sample page used by @nihil-admirari is a not a Hard-CBR file I'd think so. The sample file to test variable frame size (not to be confused with bitrate) at WebKit/WebKit@b41ec21 too is a VBR file

Edit: I did test VBR playback successfully on iOS 17.5 and confirmed that the audio-blob regression in 17.4 is gone too

@wbob
Copy link
Contributor

wbob commented Mar 31, 2025

to support how the caniuse Opus page is written in the future I want to summarize. Apologies for duplicating what was already said.

There isn't much commentary on native mp4 container support for Opus in macOS/iOS Safari, if it was earlier than WebM - at best the commit history in WebKits audio-related file trees can give more insight. At a minimum Safari 17 can be assumed by this Wikipedia table.

Opus in WebM was first featured in Safari 15 release notes:

Added support for the Opus audio codec in WebM containers.

but reportedly not yet for iOS:

jyavenard: At this stage, webm is only supported on macOS and iPadOS. Not iOS.

In Safari 17 the annoucement read

Added support for stereo-only Opus in MPEG-4 and WebM containers on macOS Sonoma. (50994465)

and further WebM work in Safari 17.4 to widen support from macOS to the iOSes:

Added support for VP8/VP9 and WebM on iOS and iPadOS. (64825245)

and in Safari 17.5 a bugfix to play from audio blobs, making WebM at last a workable choice in audio-tags on all Apple platforms

Fixed firing loadeddata events for <audio> and <video> on page load. (124079735) (FB13675360)

Now Safari 18.4 features

Added support for Ogg Opus and Ogg Vorbis on macOS Sequoia 15.4, iOS 18.4, iPadOS 18.4, and visionOS 2.4. (131407707)
Added WebM support to MediaRecorder. (137560454)

likely obsoleting packaging Opus in other containers than Ogg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants