concentus icon indicating copy to clipboard operation
concentus copied to clipboard

Ability to decode Ogg/Opus multiple streams

Open mihui opened this issue 8 years ago • 5 comments

Is it possible to decode the multi-stream of ogg/opus instead of a single stream or file? Thanks.

mihui avatar Jan 18 '17 07:01 mihui

Do you mean 5.1 channel audio, or playing an Ogg file that has more than 1 elementary stream? If there is more than 1 elementary stream, are they interleaved, or does one start after the other ends?

lostromb avatar Jan 18 '17 15:01 lostromb

Thanks for your quick response, I meant "more than 1 elementary stream" with interleaved data if I understood it right, which means if I have a big size of ogg/opus data streaming back to the application, the decoder may have the ability to decode the a part of it, piece by piece, so that the application (client) will play the buffer instead of waiting for downloading the full size of the data.

mihui avatar Jan 20 '17 09:01 mihui

So, the logic that is implemented right now is really dumb - the ogg container code just looks for elementary stream [0] in the file, assumes it is opus, and creates an output using only that stream. Obviously it could be much better, but it would require the API to change something like this:

  • Instead of choosing index [0], inspect every elementary stream, make sure it is opus, and make it available to be played using syntax like "OpusStream[1].Open"
  • Parse OPUSTAGS before committing stream selection so the user/client could choose one based on tags
  • Support playback of streams that are joined end-to-end ( rare, but it can happen). This should be as simple as opening the new stream as it comes
  • Support playback of streams that have multiple interleaved streams. This is easy if we only play one at once, but becomes really difficult if we want to play both at once. I don't have a solution for this yet

lostromb avatar Feb 06 '17 23:02 lostromb

I am interested in helping to solve this issue, what concepts are needed and what programming techcnices or good practices are recommended before getting involved ? I am a Advanced JAVA Developer with intermdiate Sound related concepts knowledge and very new to the Opus/Concentus arena

mauriciogracia avatar Jul 08 '18 08:07 mauriciogracia

Well, awesome. First things first though, I want to move this issue to the Concentus.Oggfile repository since this is a feature relating to ogg files exclusively. It will also require a total redesign of the API because of the way ogg files work. I'll dump my ideas over in that repository. Some questions for you though:

  • Do you plan on working in Java or C#? The Oggfile repository is exclusive to C#, since for Java ogg file management I planned to use the existing gagravarr/VorbisJava project (though that never actually gained any traction). The C# code is the one that requires all the fixes though
  • Now that I mention it, would you like to take up that work so that native Java users can have an OggOpus interface? It seems like a fairly easy fix (a few lines of code, honestly) to get VorbisJava to start encoding / decoding Opus packets, and that would be a pretty good contribution to the Java side of Concentus.
  • Honestly, the simplest thing that I actually really need right now is just to push the Concentus jar to Maven. I know the Java language but I am 100% clueless about its infrastructure, so I never got around to actually making this package easily available in that ecosystem.

lostromb avatar Jul 10 '18 00:07 lostromb