[opus] How to identify packets to input to opus_decode()

Timothy B. Terriberry tterribe at xiph.org
Mon Apr 29 22:25:47 PDT 2013


HK Wong wrote:
> for Opus. I am now using sources of libopus. The first question is for
> calling opus_decode(), do I need to skip the header bytes of an opus
> file before I can input the file data to opus_decode()? Or will libopus
> handle this automatically?

You need to feed libopus distinct packets, and you need to parse out the 
size of those packets from the file first. This is not handled 
automatically by libopus (that is what libopusfile is for).

> Actually I have browsed through the site, but there is nothing detail
> talking about the header bytes of opus file. When I compare two opus
> files by hex viewer I can identify the header portion, but have no clue
> how each packet is allocated.

You can find details on the headers here:
http://tools.ietf.org/html/draft-ietf-codec-oggopus

Most of the details of the Ogg layer that encapsulates Opus packets is 
found here:
http://tools.ietf.org/html/rfc3533

> BTW, I know libopusfile is solely for decoding and should be more
> convenience for my application. However, the .a files are not compatible
> with Microchip compiler.

The source code of libopusfile is here:
http://git.xiph.org/?p=opusfile.git

I don't know anything about your environment, but you should be able to 
compile your own library from the source files there.


More information about the opus mailing list