Last active
July 31, 2017 08:44
-
-
Save Jamie0/0b3dbd3379a0eb875193a2bf53bee36a to your computer and use it in GitHub Desktop.
Insanity Streaming Script
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
<icecast> | |
<location>Egham, UK</location> | |
<admin>com[DOT]insanityradio[AT]computing (reversed)</admin> | |
<limits> | |
<clients>100000</clients> | |
<sources>1000</sources> | |
<threadpool>10</threadpool> | |
<queue-size>524288</queue-size> | |
<client-timeout>30</client-timeout> | |
<header-timeout>15</header-timeout> | |
<source-timeout>10</source-timeout> | |
<burst-on-connect>1</burst-on-connect> | |
<burst-size>65535</burst-size> | |
</limits> | |
<authentication> | |
<source-password>hackme</source-password> | |
<relay-password>hackme</relay-password> | |
<admin-user>admin</admin-user> | |
<admin-password>hackme</admin-password> | |
</authentication> | |
<mount> | |
<mount-name>/insanity_unprocessed.mp3</mount-name> | |
<fallback-mount>/insanity_unprocessed_bak.mp3</fallback-mount> | |
<fallback-override>1</fallback-override> | |
</mount> | |
<mount> | |
<mount-name>/insanity_unprocessed.flac</mount-name> | |
<fallback-mount>/insanity_unprocessed_bak.flac</fallback-mount> | |
<fallback-override>1</fallback-override> | |
</mount> | |
<mount>/insanity_unprocessed_bak.flac</mount> | |
<mount>/insanity_unprocessed_bak.mp3</mount> | |
<mount> | |
<mount-name>/insanity320.mp3</mount-name> | |
<fallback-mount>/insanity_unprocessed.mp3</fallback-mount> | |
</mount> | |
<mount> | |
<mount-name>/insanity192.mp3</mount-name> | |
<fallback-mount>/insanity_unprocessed.mp3</fallback-mount> | |
</mount> | |
<mount> | |
<mount-name>/insanity128.mp3</mount-name> | |
<fallback-mount>/insanity_unprocessed.mp3</fallback-mount> | |
</mount> | |
<mount>/insanity.flac</mount> | |
<mount>/insanity128.aac</mount> | |
<mount>/insanity256.aac</mount> | |
<hostname>stream.cor.insanityradio.com</hostname> | |
<listen-socket> | |
<port>8000</port> | |
</listen-socket> | |
<mount> | |
<mount-name>/ob.mp3</mount-name> | |
<password>hackme</password> | |
<max-listeners>10000</max-listeners> | |
<hidden>1</hidden> | |
</mount> | |
<mount> | |
<mount-name>/ob.ogg</mount-name> | |
<password>hackme</password> | |
<max-listeners>10000</max-listeners> | |
<hidden>1</hidden> | |
</mount> | |
<!-- Allow DJs to connect to Now Playing system through various bits of controller software --> | |
<mount> | |
<mount-name>/dj_link.ogg</mount-name> | |
<password>hackme</password> | |
<max-listeners>10000</max-listeners> | |
<hidden>1</hidden> | |
</mount> | |
<fileserve>1</fileserve> | |
<paths> | |
<basedir>/usr/share/icecast2</basedir> | |
<logdir>/var/log/icecast2</logdir> | |
<webroot>/usr/share/icecast2/web</webroot> | |
<adminroot>/usr/share/icecast2/admin</adminroot> | |
<alias source="/" destination="/status.xsl"/> | |
</paths> | |
<logging> | |
<accesslog>access.log</accesslog> | |
<errorlog>error.log</errorlog> | |
<loglevel>3</loglevel> <!-- 4 Debug, 3 Info, 2 Warn, 1 Error --> | |
<logsize>10000</logsize> <!-- Max size of a logfile --> | |
</logging> | |
<security> | |
<chroot>0</chroot> | |
</security> | |
<http-headers> | |
<header name="Cache-Control" value="no-cache" /> | |
<header name="Expires" value="0" /> | |
</http-headers> | |
</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 | |
CREDS="source:hackme" | |
# Capture from ALSA to our initial unprocessed stream | |
while [ true ]; do | |
ffmpeg -f alsa -ar 44100 -i plug:dsnoop:1 -c:a mp3 -b:a 320k -legacy_icecast 1 icecast://${CREDS}@127.0.0.1:8000/insanity_unprocessed.mp3 -c:a flac -legacy_icecast 1 -content_type audio/flac icecast://${CREDS}@127.0.0.1:8000/insanity_unprocessed.flac 2>/dev/null | |
done & | |
# Process our input feed and then encode it! | |
while [ true ]; do | |
ffmpeg -i http://127.0.0.1:8000/insanity_unprocessed.flac -f wav -acodec pcm_s16le -ac 2 - | stereo_tool_cmd - - -s ~/config.sts | ffmpeg -i - \ | |
-c:a mp3 -b:a 320k -legacy_icecast 1 icecast://${CREDS}@127.0.0.1:8000/insanity320.mp3 \ | |
-c:a mp3 -b:a 192k -legacy_icecast 1 icecast://${CREDS}@127.0.0.1:8000/insanity192.mp3 \ | |
-c:a mp3 -b:a 128k -legacy_icecast 1 icecast://${CREDS}@127.0.0.1:8000/insanity128.mp3 \ | |
-c:a flac -legacy_icecast 1 -content_type audio/flac icecast://${CREDS}@127.0.0.1:8000/insanity.flac \ | |
-c:a libfdk_aac -b:a 128k -legacy_icecast 1 -content_type audio/aac icecast://${CREDS}@127.0.0.1:8000/insanity128.aac \ | |
-c:a libfdk_aac -b:a 320k -legacy_icecast 1 -content_type audio/aac icecast://${CREDS}@127.0.0.1:8000/insanity256.aac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the script that powers Insanity's core stream infrastructure.