The Horde Provides: Mixing Multiple Icecast Streams (ft. ffmpeg)_

Support the Entertainment Community Fund.
🇺🇦 Resources to help support the people of Ukraine. 🇺🇦
October 14, 2021 @12:34

Over a decade ago I took the LiveATC feed for KJFK ground and SomaFM's venerable Groove Salad and mixed them together into a nice background music stream that I'd listen to while working. Recently I setup an Icecast stream of my Uniden BearCat BC125AT scanner so I could listen to it from anywhere in the house but it is very jarring when abject silence is broken by a burst of traffic on the radio so I went spelunking in the digital horde and out fell a shell script. A quick modification and this is what came out the other side.

#!/bin/sh
while true; do
        ffmpeg \
                -i MY_INTERNAL_ICECAST_SERVER_URL \
                -i REDACTED_GO_SUPPORT_SOMAFM \
                -filter_complex \
                        "[0:a]volume=0.9[scanner]; \
                        [1:a]volume=0.5[soma]; \
                        [scanner][soma]amix=inputs=2:duration=shortest" \
                -c:a mp3 -b:a 64k -f mp3 -threads 4 -b 32k \
                -ice_name "Groove Salad meets a Uniden BearCat" \
                -ice_genre Ambient \
                -ice_description "SomaFM's Groove Salad meets my Uniden Scanner" \
                -ice_public 0 \
                icecast://source:REDACTED@REDACTED:8000/scannersalad
done

The result reminds me very much of SF 10-33 but with more relevant to me audio. You may want to mess around with volumes in the -filter_complex to adjust to your liking depending on your sources. If you are using a source that uses a stereo stream to multiplex two sources (I seem to recall there are several LiveATC streams that do this) you may be able to use the pan filter to get at the one you want.

Comment via e-mail. Subscribe via RSS.