Gagravarr / VorbisJava

A library for working with Ogg Vorbis files
Apache License 2.0
126 stars 26 forks source link

as convert ByteBuffer to Ogg Vorbis? #18

Closed futuri closed 8 years ago

futuri commented 8 years ago

I receive audio data (RAW audio) by websocket and I need to encode to Ogg Vorbis, how could it?

...
public void onMessage(WebSocket ws, ByteBuffer buffer) {
        //System.out.println(buffer);
        //HERE encoder buffer to ogg
}
...

help :( Regards

Gagravarr commented 8 years ago

There is no Encoding support in the library at the moment, sorry, and given the complexity involved I'm not sure it ever will be

Likely your best bet is to fire up a worker thread, have that spawn a copy of the command line VorbisEnc tool (with appropriate options for quality, input from stdin etc), have that feed the raw audio to the stdin of the process, and grab the resulting ogg file from stdout for sending on / storing / etc