How does ogg streaming work?

I recently tried to understand how it works ogg vorbis

, so I wrote a simple encoder / decoder for ogg vorbis

. And now I am trying to understand how all internet radio stations work. And what I don't understand: if you need to process all 3 headers vorbis

to know how to decode audio (channels, rate, etc.), how can they continuously stream audio and stream it from a random track position?

+3


source to share


1 answer


Ogg (Vorbis or otherwise) streams do not work by streaming from random positions in a track. This makes packaging more difficult for internet radio services and why Ogg doesn't work on SHOUTcast servers.

For Ogg streaming, the server must parse the original Ogg frame headers from the original stream. When a new client connects, these frame headers are sent to the client before any new audio data. After that, the server starts sending frames for the current position in the stream, but it doesn't start randomly. It starts with the correct frame border.



You can see this behavior for yourself. Start an Icecast server with the original stream using Ogg with Vorbis or FLAC. Use Wireshark to capture packets from two different client connections running at different times. Then compare the original Ogg frames you get from the server. You will see two frames that set things up and then frames in the middle of the stream.

+1


source







All Articles