Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kick4U2/ea0fd4d59cdff23610be4e9f35546dce to your computer and use it in GitHub Desktop.
Save Kick4U2/ea0fd4d59cdff23610be4e9f35546dce to your computer and use it in GitHub Desktop.
transcode to Icecast2 from RTMP using ffmpeg and systemd.
[put transcode script]
PATH:/root/transcode/transcode.sh
[register and start service.]
PATH:/etc/systemd/system/transcode.radio.service
# systemctl enable transcode.service
# systemctl start transcode.service
[Unit]
Description=transcode service
After=network.target
Wants=icecast.service
[Service]
Type=simple
Restart=always
ExecStart=/bin/sh /root/transcode/transcode.sh
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target
#!/bin/sh
ffmpeg -re -i rtmp://****/****/**** \
-vn -codec:a libmp3lame -b:a 128k -ar 44100 -f mp3 \
-ice_name "stream name" \
-ice_description "stream description" \
-ice_genre "stream genre" \
-ice_public "1" \
-ice_url "http://localhost/" \
icecast://source:huckme@localhost:8000/mountpoint \
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment