[vorbis] Re: ogg123 and stdout
Frank Heckenbach
frank at g-n-u.de
Mon Apr 16 11:43:04 PDT 2001
fungus wrote:
> Michael Smith wrote:
> >
> > At 11:44 PM 4/15/01 +0200, you wrote:
> > >On Sat, 14 Apr 2001 11:44:42 +0000 (UTC), Christian Weisgerber wrote:
> > >
> > >$ ogg123 http://popstation.de:8002/2.ogg -d wav -o file:/dev/stdout |
> > >sox -t wav - cap.wav
> >
> > The wav header can't be written until the end. Going through stdout makes
> > it unable to do this. It probably should write an almost-correct header and
> > then go back and correct it, but doesn't.
>
> I don't think you can do a seek in stdout.
tdout is just fd #1. If it's connected to a file, you can seek in
it like in any other file. If it's a pipe, you can't.
> It should buffer up the data in memory until it knows enough
> to write the header.
Well, depending on the size of the data and available memory, this
could turn out quite difficult since it needs to read *all* the data
to know the size...
> PS: Unix wouldn't do it that way anyway, in Unix you'd do:
>
> oggtoraw <myfile.ogg | rawtowav >myfile.wav
The problem is that raw audio is missing information like sample
rate, depth, # channels. If you think of graphic formats, the
typical raw formats are PNM, and they have a minimalistic header. So
in general I'd favour a sound format with headers -- doesn't have to
be M$ wav, of course (I like the Sun audio format better, its header
is much simpler and clearer). Otherwise, you have to supply this
information on the command line or something, so your rawtowav could
be `sox -traw -wsc2 -r44100 - -twav -' (using sox-12.17.1; previous
versions had a small bug and didn't seek even if the output was to a
file).
AFAICS, writing a correct header, however you do it, will require
either sufficiently large memory or a temp file or seeking. But for
some purposes a file with a slightly wrong header works quite well,
e.g. a wav file with the size set to the maximum, which is what sox
produces when it can't seek. (As I noted in an earlier mail, oggenc
works with such files, except that the percentage and remaining time
displayed are not correct.)
Frank
--
Frank Heckenbach, frank at g-n-u.de
http://fjf.gnu.de/
PGP and GPG keys: http://fjf.gnu.de/plan
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis
mailing list