Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract raw opus stream from existing ogg file #29

Open
jw-redpanda opened this issue Oct 8, 2021 · 3 comments
Open

extract raw opus stream from existing ogg file #29

jw-redpanda opened this issue Oct 8, 2021 · 3 comments

Comments

@jw-redpanda
Copy link

First of all, thanks for your excellent work :>
The server.js example works as expected and the sound can be played in the chrome browser.

I tried out my own ogg/opus file and split it into chunks using NNNN.txt format but they cannot be played normally. I guess it may be due to the fact that server.js expects to receive raw OPUS data without ogg header.

My question is... how can I extract the raw OPUS stream from an ogg file? I tried out ffmpeg and opusenc with no luck since they all convert audio in opus with ogg header.

Would you please advise the tool to extract raw stream? Any suggestion?

@samirkumardas
Copy link
Owner

samirkumardas commented Oct 8, 2021

If you have already an Opus packet with the Ogg header, you don't need to use this library. You can convert them into PCM by calling the function decodeAudioData directly.

In our case, we got bare opus packet using the libopus encoder https://opus-codec.org/downloads/

@jw-redpanda
Copy link
Author

Thanks samirkumardas for your kind reply.

In fact, I am interested in using your approach to stream a very large ogg file by chunks from node server to the chrome browser. However, decodeAudioData expects complete binary data of an ogg file, which takes some time to begin playing since the file is large, especially when the Internet connection is slow.

BTW, I am a newbie in web audio, can you tell me what is OCM?

@samirkumardas
Copy link
Owner

Sorry, it was a typo. I meant to say PCM :)

In our case, we would convert from PCM into Opus. Then at the browser end, we received it over WebSocket and used this library to get the PCM stream back. Using WebAudio API, you can play PCM data.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants