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

WebM Container Support for Opus Tools #49

Open
anthumchris opened this issue Dec 3, 2019 · 5 comments
Open

WebM Container Support for Opus Tools #49

anthumchris opened this issue Dec 3, 2019 · 5 comments

Comments

@anthumchris
Copy link

anthumchris commented Dec 3, 2019

How feasible would it be to add official tooling support for WebM Containers? Like Ogg, WebM seems to be a preferred, royalty-free web standard moving forward. Currently, Ogg containers are not supported by Media Source Extensions (MSE), but MSE does support WebM (see w3c/media-source#245). I am currently using third-party tools like ffmpeg to create WebM Opus audio files for use with MSE.

Use Case

Based on my research & experimentation, MSE currently provides the lowest possible latency for Opus playback in browsers with slow connections, allowing audio to be played as soon as the first audio bytes are downloaded. Additionally, MSE offers native platform Opus decoding without needing to use WebAssembly and the Web Audio API to decode and play PCM audio. Would be great to use official Opus tools to achieve this.

Without MSE, native browser playback requires up to 100k to be downloaded (HTTP range requests for start (metadata) and last (duration calculation) bytes). This is problematic for slow internet connections capable of sustainably streaming an Opus file. For example, a 64 bitrate Opus file over a 72 kbps connection yields a 12s playback latency in Chrome and 5s in Firefox:

https://fetch-stream-audio.anthum.com/72kbps/opus/house--64kbs.opus?cacheBust=1

Screen Shot 2019-12-03 at 10 46 03 AM

(more throttled endpoints)

@anthumchris anthumchris changed the title WebM Container Support WebM Container Support for Opus Tools Dec 3, 2019
@anthumchris
Copy link
Author

I haven't been able to determine what MSE bytestreams Safari supports. I probed with:

console.log([
  MediaSource.isTypeSupported('audio/webm; codecs="opus"'),
  MediaSource.isTypeSupported('audio/mp4; codecs="opus"'),
  MediaSource.isTypeSupported('audio/mp2t; codecs="opus"'),
  MediaSource.isTypeSupported('audio/mpeg; codecs="opus"'),
  MediaSource.isTypeSupported('audio/aac; codecs="opus"')
])

@guest271314
Copy link

@anthumchris

Currently, Ogg containers are not supported by Media Source Extensions (MSE)

FYI: MSE on Chromium 105 now supports passing ('opus') EncodedAudioChunk from WebCodecs https://plnkr.co/edit/cAbZqVXfzZMFOaxL?preview.

@guest271314
Copy link

@anthumchris

See https://github.com/guest271314/WebCodecsOpusRecorder. From my testing the WebCodecs configuration and Opus packets in a single file has less total size than Opus in WebM produced by Chromium MediaRecoder implementation.

@vadimkantorov
Copy link

it would already be useful even if it's just supported in opusdec for demuxing+decoding

@vadimkantorov
Copy link

Btw it appears that mkv + opus can significantly save space on omitting silence: https://video.stackexchange.com/questions/37055/possible-to-force-ffmpeg-to-omit-silence-in-audio-files-and-produce-discontinuou/37056?noredirect=1#comment47208_37056

if opusenc can support output webm streams + silence suppression, it would be very practical and not force ffmpeg usage and be faster

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

No branches or pull requests

3 participants