Skip to content

Instantly share code, notes, and snippets.

@kfatehi
Created January 6, 2019 03:02
Show Gist options
  • Save kfatehi/07bdef95c132215598a23caf4ce7c2f5 to your computer and use it in GitHub Desktop.
Save kfatehi/07bdef95c132215598a23caf4ce7c2f5 to your computer and use it in GitHub Desktop.
hls to icecast with ffmpeg
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"
# above 12 are not recommended
# 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