[Icecast-dev] grabbing raw PCM from ices2
Pete Yadlowsky
pmy at virginia.edu
Sun May 31 12:42:41 PDT 2009
Hi,
I'm running Ices 2.0.1 in conjunction with Icecast 2.3.1 (on gentoo
linux) to generate a live ogg stream for radio station WTJU
(http://wtju.net/). In addition to encoding and streaming live audio,
we'd like to record our broadcasts to disk for archival. I know that
ices has a "savefile" feature, but that isn't so useful, because the
file being written simply grows without bound for as long as ices
continues to run. That might be ok if the file could be periodically
truncated to its beginning (rather than to its end), but I don't know
any way of doing that on an open file. Also, the savefile feature writes
the encoded data, but we'd prefer to have access to the raw PCM for
later encoding to FLAC. (Ices is getting its data from an ALSA device;
maybe there's some way of tapping ALSA directly? Anyway...)
What would be useful for us is some sort of audio FIFO by which other
processes could tap ices' incoming PCM stream, without fear of filling
the disk partition with a single ever-growing file. I have implemented
such a FIFO as a simple circular buffer, where each "cell" in the buffer
is a file of fixed maximum size. As each file is filled with PCM data to
its maximum, ices moves on to the next, and round and round it goes.
Synchronization with reader processes is achieved with file locking.
Seems to work. Shared memory might be another way to do this.
If anyone is interested, I'm willing to supply a set of diffs.
--
Pete Yadlowsky
ITC Unix Systems Support
University of Virginia
More information about the Icecast-dev
mailing list