[Speex-dev] Speex .spx bitstream format

Conrad Parker conrad at metadecks.org
Sat Apr 11 05:19:05 PDT 2009

2009/4/11  <akhalife at uci.edu>:
> Dear experts,
> I am trying to understand the structure of the Speex .spx file, so I can
> packetize each frame in one packet for example, and in the receiving end,
> I can decode a file that has all the received frames (some of them may
> lost).
> I tried to figure out what is the delimiter used to separate the frames
> but I could not so far. I also tried to deleted some data from the .spx
> file or change it, (I was doing that using a hex editor). But I noticed
> that when I change anything in the bitstream (either delete or change it).
> The decoder does not decode the entire file (it gave me empty wav file).
> Any idea on how to handle frame loss in .spx? what is the frame delimiters?

.spx is Speex in Ogg.

.spx is speex frames placed in Ogg packets, and the framing is Ogg
pages. There can be multiple packets per page (the common case for
Speex, as the packets are small but Ogg pages are usually on the order
of 4kB or so); and also Ogg packets can span pages, so you might get a
packet which starts on one page and finishes on the next.

Full documentation about Ogg is at http://www.xiph.org/ogg/

For code examples, see the source to speexenc and speexdec.

For tools for hex dumping Ogg files, see http://www.xiph.org/oggz/



More information about the Speex-dev mailing list