-
-
Save Manawyrm/bb2e556b9603edf9f1b6372d65900d31 to your computer and use it in GitHub Desktop.
mp3.sh - Yate external/playrec script to play MP3 radio streams
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# To test add a route to: external/playrec/mp3/mp3.sh https://example.com/stream.mp3 | |
read -r REPLY | |
echo "$REPLY" | sed 's/^[^:]*:\([^:]*\):.*$/%%<message:\1:true:/;' | |
# Throw away input (but read from FD3 to not overflow the input buffer) | |
dd if=/dev/fd/3 of=/dev/null bs=64 & | |
# mpg123 options: | |
# -s, --stdout | |
# -m, --mono | |
# -q, --quiet | |
# sox options: | |
# -t, --type FILE-TYPE | |
# -r, --rate RATE[k] | |
# -b, --bits BITS | |
# -c, --channels CHANNELS | |
# -L, --endian little | |
# -e signed-integer | |
curl --silent "$1" | mpg123 -s -m -q - | sox -t raw -r 44100 -b 16 -c 1 -L -e signed-integer - -r 8000 -t raw - >&4 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment