[ogg-dev] Fwd: Additional ogg audio fomats (speex, flac, PCM)

clancy hood clancyhood at gmail.com
Sat Jun 2 09:53:45 PDT 2012


[Woops, forgot to reply to the list ; just sent the following to Ralph]

Thankyou guys.

> All Speex files (.spx) are encoded in Ogg, so speexenc is all you need
for that.
> The standard "flac" utility will encode into Ogg with the --ogg switch.

D'oh! Have been RTFM'ing an awful lot lately, but I completely missed that
flac has an --ogg switch

> You may also wish to support Opus

Great, thanks will take a look

> No one uses ogg pcm at all. I think there are some experimental implementations,
but I don't remember where they are. I wouldn't worry about that one.

No, I suppose FLAC itself would render that option somewhat obsolete, and
as you say people tend not to package flacs in oggs. Advice taken.

Thankyou also for the example files and the opus links.

> Neat. Have you looked at calculating the file length so you can set the Content-Duration
header when serving the files back?

Yes, I already do. Stream meta is dumped in a database,
non-compressed/lossless formats are transcoded to flac to be stored, and
subsequent requests may be made for the file in an arbitrary format,
depending on user settings. The content-duration header is always sent,
indeed some browsers struggle without it. However, some clients (particularly
Chrome it seems) will request byte-ranges when playing an ogg, and am
slightly confused as to whether I should return a content-duration header
whilst satisfying a byte-range request, or only during the first request.
At the moment I send it every time, and no damage appears to be done.

Incidentally, whilst the documentation is excellent, there are one or 2
things I am slightly confused about, if you don't mind my going off-topic:

1) It seems I can always rely on the first byte of the first vorbis comment
page to be 3. Is this right?
I see that some pages begin with a byte and then "vorbis", but haven't yet
found a resource that tells me what that byte means.

2) In fact, must page 2 of an ogg be a comment page, or may it be missing
altogether? So far, I've found "empty" pages with a single page segment,
but never a missing comment page.

In case you're interested, the overall intention of this part of the
program is thus: when inputting the file, it must read the stream meta,
comments etc in order to dump them in a database. When outputting the file,
the requested stream may include additional comment data which the user
intends to be included with the file, so in e.g. an ogg stream request, the
transcoded ogg file will have its (empty, if any) comment pages replaced
with pages created by my program on the fly. This is in order that I may
cache transcoded files and comments separately, since comments may change
but a transcoded file will not (am aware of the stream_serial_number
problem this gives me, btw). This means am currently getting to grips with
the bones of ogg's page structure quite intimately, and getting hold of /
creating some variations in the layout will help me unit-test the parsing
side of things as well as open up possibilities on the streaming side,
hence my original message.




On 2 June 2012 16:10, Ralph Giles <giles at thaumas.net> wrote:

> On Sat Jun  2 07:19:14 2012, clancy hood wrote:
>
> > a) a command-line utility that allows me to encode to non-vorbis ogg
> > audio (*nix)
>
> There's not really a single utility. You can make .spx files
> (speex-in-ogg) with speexenc, ogg flac files with 'flac --ogg', and
> .opus files (opus-in-ogg) with opusenc.
>
> > b) example files of the above
>
> You can get an example opus file (with metadata) at
> http://people.xiph.org/~giles/2012/opus/ehren-paper_lights-64.opus
>
> You can find some speex file e.g. at
> http://people.xiph.org/~giles/2008/lca/mirror/Wed/
>
> Ogg Flac isn't very popular; it's mostly useful for muxing with video. I
> don't have any examples handy.
>
> No one uses ogg pcm at all. I think there are some experimental
> implementations, but I don't remember where they are. I wouldn't
> worry about that one.
>
> > Am building a program part of which reads stream meta from uploaded
> > audio files, and so have written a lightweight getid3-like set of
> > classes that do this. Am handling ogg vorbis perfectly well already
> > and would like to test it against the others.
>
> Neat. Have you looked at calculating the file length so you can set the
> Content-Duration header when serving the files back?
>
> > Additionally (out of pure interest) does anyone know of good
> > literature pertaining to examples of (ab)using libogg to package
> > arbitrary audio formats?
>
> We generally discourage this, since our mission is to provide
> royalty-free, libre multimedia technology. However, if you have a
> specific audio format in mind, this is a good place to talk about the
> best way to define an Ogg encapsulation method.
>
> HTH and thanks for supporting Ogg,
>  -r
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xiph.org/pipermail/ogg-dev/attachments/20120602/781eca3e/attachment.htm 


More information about the ogg-dev mailing list