Mp4Opus

From XiphWiki
Revision as of 08:56, 21 September 2014 by Koda (talk | contribs)
Jump to navigation Jump to search

This is a draft encapsulation guide for Opus audio in the mp4 (ISO Base) media container.

MP4 already has support for declaring encoder delay and pre-roll.

For pre-roll I believe we can use 'AudioRollRecoveryEntry' for pre-roll.

For delay, Daemon404 suggested "whatever l-smash maps encoder delay to." yusuke says, "ISO and Apple recommend the use of edit list for removing priming samples from the presentation." libavformat's demuxer supports *one* edit list.


There's some work on codec-independent channel mapping, downmix and dynamic range control as part of ISO 14496-12 Amd4 We might be able use some of that, but it doesn't support the Opus case of needing to indicated which streams are coupled pairs. We'll still need to define our own extension for this.

Question: Better to reuse the channel mapping header entirely, or just report the coupled stream count and use the downmix table to do the mapping?

Possible registration process, send an email to http://mp4ra.org/request.html Possible registrar is 'opus'.

Internally everything is resampled at 48000, this is always output by the decoder, floating point numbers. But the original sample rate is stored so that the decoder can act upon it. Atom AudioSampleEntry will have 48 and the original one will be stored in the codec's one.

AudioRollRecoveryEntry - shall have a value of 384 (8ms * 48k) AudioSampleEntry - hardcoded at 16fp

descriptor - same as ogg rather than as ts, to keep things simple

channel count - already included pre skip - already included

Gain - volume atom? unused in practice - oggheader - not in ts (TODO?) when you decode samples you're supposed to multiply against this value, so that decoder can apply post volume Reusing the one in ogg.

mapping family (with vorbis mapping) 0 - mono/stereo no channel config 1 - specify # channel 2 - map to the # ouput audio channel layout https://developer.apple.com/library/mac/documentation/musicaudio/reference/CoreAudioDataTypesRef/Reference/reference.html - too complex plug it from ogg and put it in our custom atom

Things to put in custom atom

- input sr
- output gain
- channel mappaing