[opus] Opus Raw Pakcets

Ralph Giles giles at thaumas.net
Fri Jun 17 11:54:19 UTC 2016


On 2016-06-17 10:50 AM, Rizwan Ishaq wrote:

> 1) does 960 means number of samples in the (20msec frame)? (fs=48KHz)

That's correct.

> 2) The raw opus packet (i.e OPUS payload), how can I convert it to an
> playable format?

You can pass the payload section of the RTP packets directly to an opus
decoder to convert to PCM float or integer samples.

To save it in a file other audio players can handle, you need to
re-encapsulate the data in a media container. Such files use the '.opus'
filename extension. There's some rough example code for this in the
opus-tools package. See for example
https://git.xiph.org/?p=opus-tools.git;f=src/opusrtp.c;hb=HEAD#l103

This disk and stream format is specified in
https://tools.ietf.org/html/rfc7845.html


> 3) is there any information OPUS payload has(except TOC(first byte))???

The first several bytes define how the audio is split into frames, the
duration, audio bandwidth, and the coding mode. This is described in
https://tools.ietf.org/html/rfc6716#section-3.1

> 4) I have RAW opus packets now, I want to convert it to representable
> files, integer, float any method?? or any help (decoder)?? 

You need to call `opus_decoder_create` to set up a decoder instance, and
then pass each successive payload buffer to `opus_decode` or
`opus_decode_float`.

Hope that helps,
 -r



More information about the opus mailing list