anthumchris / opus-stream-decoder

Instantly decode Ogg Opus audio streams in chunks with JavaScript & WebAssembly (Wasm)
124 stars 21 forks source link

Live Streaming Decoding #12

Open sberniz opened 4 years ago

sberniz commented 4 years ago

Hi, does this have the option for live steram decoding?. I am in need of one. and this is the closest. but not sure if it works. Please let me know, and if you have sample code. thanks

anthumchris commented 4 years ago

If the stream is an Ogg Opus byte stream it should work. I think the internal opusfile lib requires the Ogg header page to be appended first. I haven't tried out-of-sequence Ogg Opus files. Have you seen the Opus example at fetch-stream-audio?

sberniz commented 4 years ago

Hi, thanks, i haven't seen it before..i was reading through the code is a bit confusing.. but to make sure.. it'll work on client side decoding correct?. I'm looking because I have an online radio.i'm using ogg. because is light. and is what i want. but of course. ios does not support it.. and I only have one stream.. i will give it a try tomorrow morning.but if you have any code samples. or hints. let me know. thanks Santiago

On Sat, May 23, 2020 at 2:37 PM AnthumChris notifications@github.com wrote:

If the stream is an Ogg Opus file it should work. I think the internal opusfile lib requires the Ogg header page to be appended first. I haven't tried out-of-sequence Ogg Opus files. Have you seen the Opus example at fetch-stream-audio https://fetch-stream-audio.anthum.com/?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AnthumChris/opus-stream-decoder/issues/12#issuecomment-633143732, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABPLTKU2NFMWPZZN3273TBLRTA6Z5ANCNFSM4NIRVAUQ .

anthumchris commented 4 years ago

Yes, it does client-side decoding. Happy to help, feel free to email me directly and I can make some time.

adminy commented 3 years ago

Its too slow for streaming, I had to save the decoded frames into a list and play the audio with a delay.

anthumchris commented 3 years ago

@adminy Have you seen the fetch-stream-audio example? You may consider posting a question on StackOverflow if you're encountering difficulties with your code so the community can possibly assist you.

adminy commented 3 years ago

No thanks @AnthumChris, I am sticking with libopus of course, but I don't need programming help. I found out something new from fetch-stream-audio, which is constructing audio buffers ahead of time. The reason I am saying it's slow is because I'm going to be using it in a voice call application, so for me the goal is to reduce latency as much as possible (dropping frames is normal), I think I'm almost there. I'll also be refactoring the code for mono channel sound.

As for the network infrastructure, it will be web sockets since it's a stream not a static file. So again, it is very important that I improve that latency.

anthumchris commented 3 years ago

Nice one! Sounds like a fun project.