Skip to content

Instantly share code, notes, and snippets.

@jsrjenkins
Created March 18, 2021 19:10
Show Gist options
  • Save jsrjenkins/5bf77260800fed496acad178d2e12be0 to your computer and use it in GitHub Desktop.
Save jsrjenkins/5bf77260800fed496acad178d2e12be0 to your computer and use it in GitHub Desktop.
set -exuo pipefail
LIVESTREAM_URL=$1
if [[ ! $# -eq 1 ]]; then
echo "usage: $0 <URL>"
exit 1
fi
# Referencing FFMpeg to Icecast2 Streaming Sample Gist: https://gist.github.com/keiya/c8a5cbd4fe2594ddbb3390d9cf7dcac9
URL=$(streamlink $LIVESTREAM_URL worst --stream-url)
channels=2
samplerate=48000
codec="flac"
# if you have a slow hardware, set lower value.
level=10
ffmpeg \
-i $URL \
-ar $samplerate \
-ac $channels \
-c:a $codec -compression_level $level \
-f ogg \
-content_type 'application/ogg' \
icecast://source:d0ntHACKME@localhost:8000/stream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment