Hi misc@,

I have a an original setup at home.  I crontab logging on and off the Internet
on a minutely basis, so that I aquire a new IP every minute.  I do this for
personal reasons and I like it this way.  At the same time I also stream
mp3's from a radio station in Toronto.  Since my IP changes every minute
I have about a minute of streaming before I tcpdrop(8) and cycle pppoe(4).
At the end of a day I concatenate the snippets into one large mp3 but at
times the concatenation isn't perfect and there is a repeat, or a chop off
or a squeak.  Because the mp3 snippets have a time-delay buffer and overlap 
nothing is really lost but I'm looking for better software to concatenate these.

Take 4 mp3 files representing 4 minutes as an example:

ckln.1152650587
ckln.1152650647
ckln.1152650707
ckln.1152650767

(If you're interested in making this work I can give you the URLs to download
these for testing).

Here is the script that I now concatenate these with:

--- 
#!/bin/sh

#
# To do an entire day this script will run 3 hours 
# 

FILE="ckln-radio-stream`date +%Y%m%d`.mp3"

sleep 61

rm -f /export/ckln/$FILE

for i in `find /export/ckln -name "ckln.1*" -ctime -1 -print`; do
        dd if=$i of=/export/ckln/$FILE bs=128 count=1
        break;
done

for i in `find /export/ckln -name "ckln.1*" -ctime -1 -print`; do
        SIZE=`ls -l $i | awk '{printf("%s\n", int($5 / 614400)); }'`
        VARIABLE=`mplayer -ao null -nosound -speed 100 -v -v $i | grep " len=" 
| awk '{ split($6, a, "="); total += a[2]; if (total > 15000) { if (! 
startmessage) { printf("start: %s ", total + 128);  startmessage++; start = 
total; }; counton += a[2]; framecount++;}  if (counton >= ((((multiplier < 1) ? 
1 : multiplier) * 614400) - 15000 )) { printf("%s bytes %s frames\n", counton - 
128, framecount); exit 0; }}' multiplier=$SIZE`

        SKIP=`echo $VARIABLE | awk '{print $2}'`
        COUNT=`echo $VARIABLE | awk '{print $3}'`

        echo $VARIABLE

        dd if=$i of=$HOME/tmp.$$ skip=$SKIP count=$COUNT bs=1
        cat $HOME/tmp.$$ >> /export/ckln/$FILE
        rm -f $HOME/tmp.$$
done
---

As you can see I run mplayer at speed 100 with full verbose messages so
that I can see how large the individual frames are (with padding), with
that count I can then dd the stuff out.  Obviously it's not perfect.

What I'm looking for at best is something that checksums or hashes every
mp3 frame (I think they are around 360 bytes each or so) and finds the 
exact overlap on the next mp3 file.  ( I can't imagine the streaming server 
making a new mp3 for every connection there is, but rather doing it once
for all connections so the frames should all be the same value around the
overlap and hence checksumming should work to make the exact splice, right?)

I've thought about disecting the de-multiplex functions in mplayer to 
a customized program to do this but before I do, I want to ask if there 
is something like this out there already saving me time?

regards,

-peter

-- 
Here my ticker tape .signature #### My name is Peter Philipp #### lynx -dump 
"http://en.wikipedia.org/w/index.php?title=Pufferfish&oldid=20768394"; | sed -n 
131,136p #### So long and thanks for all the fish!!!

Reply via email to