ezstreamとicecastでmp3ファイルを配信


Icesめんどくない?

Ices 0.xじゃないとmp3対応してないし色々面倒くさい。


Ezstream — Icecast

上記サイトからソースなりWindows向けバイナリをダウンロード。
今回は面倒だったのでWindows環境でテストしました。

使い方は非常に簡単。
examplesフォルダに設定ファイルのサンプルが色々入っているので、それを使います。
今回はmp3を配信したかったので何も考えずに ezstream_mp3.xml をコピーしてそれを使用しました。

なお、面倒なのでパスも通さずにフルパスを書いています。

設定例

指定すべきところは以下の項目程度です。

  • url
  • sourcepassword
  • filename
  • stream_once

url はicecast2サーバのマウントポイントを指定。
sourcepassword はicecast2サーバで設定したパスワードを入力。
filename は楽曲のファイル名を1行づつ記載したファイルへのパス。(後述)
stream_once は一度のみ再生するかを設定する項目。 1 で有効、0 で無効。

<!--
   EXAMPLE: MP3 playlist stream WITHOUT reencoding

   This example streams a playlist that contains only MP3 files. No other file
   formats may be listed. Since ezstream will not be doing any reencoding, the
   resulting stream format (bitrate, samplerate, channels) will be of the
   respective input files.
 -->
<ezstream>
    <url>http://example.com:8000/test</url>
    <!--
      If a different user name than "source" should be used, set it in
      <sourceuser/>:
     -->
    <!-- <sourceuser>mr_stream</sourceuser> -->
    <sourcepassword>hackme</sourcepassword>
    <format>MP3</format>
    <filename>Z:\music\list.txt</filename>
    <!-- Once done streaming playlist.m3u, exit: -->
    <stream_once>1</stream_once>
    <!--
      The following settings are used to describe your stream to the server.
      It's up to you to make sure that the bitrate/samplerate/channels
      information matches up with your input stream files. Note that
      <svrinfoquality /> only applies to Ogg Vorbis streams.
     -->
    <svrinfoname>My Stream</svrinfoname>
    <svrinfourl>http://www.oddsock.org</svrinfourl>
    <svrinfogenre>RockNRoll</svrinfogenre>
    <svrinfodescription>This is a stream description</svrinfodescription>
    <svrinfobitrate>128</svrinfobitrate>
    <svrinfochannels>2</svrinfochannels>
    <svrinfosamplerate>44100</svrinfosamplerate>
    <!--
      Prohibit the server to advertise the stream on a public YP directory:
     -->
    <svrinfopublic>0</svrinfopublic>
</ezstream>

設定し終わったら、今度はファイルリストを作成します。
今回は list.txt というファイルを作成し、その中に記述しました。

Z:\music\hogehoge\foo.mp3
Z:\Users\hogehoge\bar.mp3
Z:\Users\hogehoge\foobar.mp3

このような感じに記述し、保存。

コマンドプロンプト等を起動し、以下のように入力して起動

Z:\ezstream-0.5.6-win32\ezstream.exe -c ezstream_mp3.xml

うまく起動できて、配信ができてれば以下のようになります。

Z:\ezstream-0.5.6-win32\ezstream.exe -c ezstream_mp3.xml
ezstream.exe: Connected to http://example.com:8000/test
ezstream.exe: Streaming ``foo''

icecast2サーバのWebUIで配信できているか確認し、任意のプレイヤーで聞いてみましょう。

おしまい。