[opus] How to wrap Opus data in an Ogg stream?
daniel at armyr.se
Wed Oct 14 04:18:00 PDT 2015
I am trying to understand how to package opus-encoded data in an ogg stream to make a standards-compilant ogg/opus file. Most things are clear, but there is one thing I simply do not understand.
What I do understand is that Ogg is based on pages, that each come with a fairly sizeable header (>=27 bytes). Now, I encode with a fairly low bitrate, so my opus packages are <100 bytes long. Therefore, it does not make sense to place one Opus packet in each Ogg page because of the overhead.
Now, the following document (It has expired? Is it still valid?) https://tools.ietf.org/html/draft-terriberry-oggopus-01
contains the following text regarding how to place Opus audio data in an Ogg page ( =? Ogg packet ): "The first N-1 Opus packets, if any, are packed one after another into the Ogg packet, using the self-delimiting framing from Appendix B of [RFCOpus]."
Reading said appendix, it seems that this self-delimiting format is not just taking on a header to a regular packet, but somehow placing the packet length inside the packet. Is this something I have to do manually, or is there a way to tell libOpus to create these self-delimiting packets?
If I have to do it myself, is there a reference example somewhere I could look at?
Beginner Opus user.
More information about the opus