ubuntu で icecast サーバを立てる
- icecast2 と ezstream をインストールする
sudo apt-get install icecast2 ezstream
- icecast2 のインストールで管理パスワードの設定が始まるので適当にやる
- icecast のデーモンが立ち上がるところまでやられるので
localhost:8000
を適当に確認してみる
- 適当な mp3 とプレイリストを用意する
- ezstream の設定ファイルを用意する
#
以降があると死ぬ気がするので実際には削除するurl
は、 nginx でプロキシしてるからといって 80 とかにすると login failed とか言われたりするので、実際にアクセスする URL がどうであれとりあえずlocalhost:<icecast_port>
にしておくのが安定な気がする
<ezstream> <url>http://localhost:8000/stream1</url> #your streaming server’s http://ip-or-host:port/stream1 <sourcepassword>hackme</sourcepassword> #refer to your icecast.xml’s <source-password> <format>MP3</format> <filename>/path/to/playlist.m3u</filename>#this still needs to be created <stream_once>0</stream_once>#when file from <filename> is done being streamed, repeat. <metadata_format>@s@</metadata_format># artist - title .. <svrinfoname>Streamy Stream Stream</svrinfoname> <svrinfourl>http://www.openserverproject.com</svrinfourl> <svrinfogenre>Cantopop</svrinfogenre> <svrinfodescription>These sections are for YP listing information only</svrinfodescription> <svrinfobitrate>128</svrinfobitrate> <svrinfochannels>2</svrinfochannels> <svrinfosamplerate>44100</svrinfosamplerate> <svrinfopublic>0</svrinfopublic> </ezstream>
- ezstream を起動する
ezstream -c stream1.xml &
- 聞く
- icecast の管理ページを見ると新たにリストされてる
- この場合、 example.com:8000/stream1.m3u とかいう URL で聞けるようになる
- つまり、 mount point が
stream1
ということっぽい
- icecast の管理ページを見ると新たにリストされてる
- ついでに、 nginx で
ic.
を 8000 にプロキシするようにしたりする
Source Client
Icecast は、それ単体ではプレイリストを読む、音を生成するといった機能はなく、そのために Source Client が 必要になる。 上記の例では、 ezstream を source client として使ってる。
liquidsoap が管理しやすくて良さそう
liquidsoap
- インストールする
apt-get install liquidsoap
- 設定ファイルを設置する
- 以下のように書いたファイルを、
/etc/liquidsoap/stream2.liq
として保存する
- 以下のように書いたファイルを、
output.icecast (%mp3, host = "localhost", port = 8000, password = "hackme", mount = "stream2", mksafe(playlist("/path/to/playlist.m3u")))
- サービスを開始する
service liquidsoap start
日本語
- したいこと
- タイトルとかを日本語で出したい
- status
- できてない
- ezstream が日本語対応してない感じある?
- できた
- liquidsoap 使う
- できてない
- したこと
<mount> <mount-name>/stream1</mount-name> <charset>UTF8</charset> </mount>
Mount Point 追加方法
rsync -av analbum/ user@host:./analbum/
などとして曲を icecast を動かしてるサーバに転送する- 必要であれば、
convmv -f sjis -t utf8 -r --notest *
などとしてファイル名を utf-8 に変換する - プレイリストを作成する
find $PWD -name '*.mp3' >analbum.m3u
- 必要であれば、上の方法にしたがってタグを UTF-8 に治す
- 上記のように
/etc/liquidsoap/analbum.liq
ファイルを作成し、 liquidsoap を再起動する - 必要であれば、 icecast.xml でタグを utf8 で表示するように設定する
- liquidsoap の
out.icecast
の引数にencoding
があるのでこれでうまくできるかもしれないけど試してない
- liquidsoap の
- ソースの数が、 icecast.xml で決まった数を超えてないことを確認する
service liquidsoap restart
する- icecast.xml の設定を変更した場合、 icecast2 もリスタートする
参考