[opus] Regarding encoded data

Greg Maxwell gmaxwell at gmail.com
Fri Jul 31 17:05:32 UTC 2020


On Fri, Jul 31, 2020 at 4:55 PM u <ugurbd at gmail.com> wrote:

> Hello,
>
> I've been trying to understand how to use opus codec for quite some time.
> There is a thing that doesn't make sense to me. I will try to explain what
> it is below,
>
> In *opus_encode() *function, *opus_int16 pcm* is said to have a size of *frame_size
> * channels*, where *frame_size* is said to be one of* 20, 240, 480, 960,
> 1920, and 2880.*
> Let's say, frame_size is 960, then opus_int16 pcm's size in bytes would be
> *3840*. Documentation page says the recommended size for *output payload *should
> be around
> *4000.*
> I check the return values returned by *opus_encode(), *and they are
> between 250 and 300, which is the length of the encoded packet.
>
> Now, we are supposed to send *ouput_payload* - which is 4000 bytes long -
> over the network. That means sending more bytes than sending opus_int16
> pcm, which is length of *3840 *in bytes*.*
> So what is the advantage of encoding the data if we are to send more bytes
> than initially held?
>

You are supposed to send the first return-value bytes of the buffer.  The
4000 number is just the size of the buffer you are providing which is a
hard limit for how much the encoder could output at once.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xiph.org/pipermail/opus/attachments/20200731/57ac3f60/attachment.html>


More information about the opus mailing list