On Feb 10, 2013, at 8:16 AM, Robin Gareus <robin(a)gareus.org> wrote:
On 02/10/2013 08:38 AM, Jeremy Hansen wrote:
I'm looking for a simple tool where I can point it at an http audio
stream, define a number of seconds to detect silence and exit with a
non-zero status if silence is detected. It seems like this should be
easy but I've been search high and low for such a utility and nothing
simple exists. Unfortunately I'm not much of a developer, but this
doesn't seem like it would be that difficult. Maybe it's harder than
I think, hence no tool that I can find.
https://github.com/x42/silan may do the job. It prints ranges or silence
in a file or stream (incl. mp3,aac,wma,ogg,m4a,.. decoding and http,
rtmp stream support thanks to libav/ffmpeg). It is used by airtime
(sourcefabric's radio) to highlight silent ranges.
silan -t 0.1 -s -60d "http://mp2.somafm.com:9016" \
| grep -quiet "Sound Off" \
&& echo " do something"
This is strange. This works, but I'm unable to grep the output and I'm not sure
why. If I pipe to grep, I get nothing. I tried redirecting stderr to stdout and
doesn't seem to work.
[jeremy@serv src]$ ./silan -t 2.0 -s -40d
"http://live.skidrowstudios.com:8000/live"
Info: signal threshold: 0.010000 ^= -40.000dBFS
0.069569 Sound On
15.814150 Sound Off
Doing the same test:
[jeremy@serv src]$ ./silan -t 2.0 -s -40d
"http://live.skidrowstudios.com:8000/live" | grep "Sound Off"
Info: signal threshold: 0.010000 ^= -40.000dBFS
I get nothing.
Thanks
-jeremy