Coder Social home page Coder Social logo

Example of ogg encoding about opus HOT 4 CLOSED

discordjs avatar discordjs commented on June 27, 2024
Example of ogg encoding

from opus.

Comments (4)

Phil-Barber avatar Phil-Barber commented on June 27, 2024

Any chance of any pointers for where to look or where to ask for hints?

from opus.

Phil-Barber avatar Phil-Barber commented on June 27, 2024

OK so further digging:

I downloaded node-opus which is documented to work with node-ogg

I have noticed the result of Encoder.encode is not the same between node-opus and @discordjs/opus. It seems node-opus spits out what I believe to be an ogg_packet, and discordjs/opus gives a buffer.

ie.:
opus stream -> discord/opus.decode -> node-opus.encode -> log:

{ packet: <Buffer 4f>,
  bytes: 19,
  b_o_s: 1,
  e_o_s: 0,
  granulepos: -1,
  packetno: 0,
  'ref.buffer':
   <Buffer 18 33 11 04 01 00 00 00 13 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff 00 00 00 00 00 00 00 00> }

compared to
opus stream -> discord/opus.decode -> discord/opus.encode -> log:

<Buffer 78 80 64 26 7e d0 2f e8 f5 a5 6d 1c da 41 04 0b 33 d9 ee 3a 0b ee 53 a6 f6 bb cf 55 c8 e3 36 e1 18 4a 9f e9 7f 94 8d a3 0c 96 b3 a1 f7 03 e7 9a 78 db ... >

So that will be my problem. I need to create ogg packets from these buffers is my guess...

I'm curious though why these two opus encoding libraries are so different though unless I've royally messed something up

from opus.

Phil-Barber avatar Phil-Barber commented on June 27, 2024

The answer on how to do this is in here and only builds in node 10 I think so I suppose this can be closed
https://github.com/Rantanen/node-opus/blob/master/lib/Encoder.js#L66

Unless there is an easier way you know of to achieve this?

from opus.

iCrawl avatar iCrawl commented on June 27, 2024

Because we cannot depend on node-ogg and we should not either. This library is stripped of all dependencies that come with node-opus usally.

Reason being is that TooTallNate/node-ogg#23
And it doesn't look like it's really maintained, nor do I have the interest in maintaining another native library myself to keep it up to date for node LTS changes.

from opus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.