Created
April 17, 2022 06:22
-
-
Save kfatehi/5b15b99c764972e5d9c391aad0e95e96 to your computer and use it in GitHub Desktop.
Rebroadcast (transcode) the audio of a video livestream over Icecast.
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/bash | |
# You can use streamlink to extract the stream URL, e.g.: | |
# PL_URL=$(streamlink --stream-url https://livestream-website-url best) | |
# Generally figured out from this gist... | |
# https://gist.github.com/keiya/c8a5cbd4fe2594ddbb3390d9cf7dcac9 | |
PL_URL=https://some.owncast-server.tv/hls/1/stream.m3u8 | |
while ! curl -s $PL_URL | grep -q offline; do | |
ffmpeg -re -i $PL_URL \ | |
-c:a libfdk_aac \ | |
-profile:a aac_he_v2 -ab 48k \ | |
-content_type 'audio/aac' \ | |
-vn -f adts \ | |
icecast://source:hackme@localhost:8000/some-name | |
sleep 1 | |
echo "restarting ffmpeg" | |
done | |
echo "Stream is offline" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment