[icecast] Auto Archiving function for Icecast.

Akos Maroy darkeye at tyrell.hu
Wed Apr 24 08:03:08 UTC 2002



Raymond,

> Does anyone know how to set up auto-archiving with icecast. I have an
> encoder coming in with a radio station. I want to create hourly mp3
> archives of their streams that are coming to my icecast server. Got any
> ideas?

I have a set of scripts that do this for me. The idea basically is:

- encode in 4 hour sessions, that is 6 sessions per day (use 4 hour-long 
darkice recording sessions, and cron to start the new recording every 4 
hours)

<p>- use the remote dump feature of icecast to dump the streams in the
server, each session under a different name. The result is something like:

/path/to/mp3/dump/session1.mp3
/path/to/mp3/dump/session2.mp3
...
/path/to/mp3/dump/session6.mp3

<p>- have a script, that at a given time cuts out the last half hour of the 
current stream dump, and call this script from cron every half hour.

Here the idea is, that from the time point, you can calculate:

- what is the current dump file called
- what is the last half hour (e.g. at 10:32 it is 10:00 - 10:30)
- where is this last half hour in the current dump (e.g. 10:00 - 10:30 
am is in the 3rd session, at offset 2:00 - 2:30, since session 3 is from 
8:00 - 12:00)

As you know the bitrate of the stream, you can calculate the byte offset 
and amount of bytes to cut from the dump file (e.g. 128 kb/s stream is 
((128 / 8) * 60) kB/minute, a half hour section is ((128 / 8) * 60 * 
1000 * 30) bytes)

- use dd to cut the desired mp3 data from the current dump, e.g.:

dd if=session3.mp3 of=1000.mp3 bs=BYTES_PER_HALF_HOUR skip=4 count=1

where skip=4 tells dd to skip the first 4 half-hour segments

You can cut with dd if you take care to cut by the mp3 frame boundaries. 
Of course, this only works with fixed bitrate encoding. Also, some mp3 
experts would argue that there will be some mess at the boundries of the 
cut, as mp3 can spread information across several frames.

Nevertheless, I didn't find a convenient command line mp3 cutting tool 
(didn't look much either, after found this solution with dd)

Of course, you can simply adjust this pattern to your needs (hour-long 
cuts, different number of recording sessions, etc.)

<p>Akos

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-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 Icecast mailing list