File: tutorials_icecast.html

package info (click to toggle)
idjc 0.9.11-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,900 kB
  • sloc: python: 22,118; ansic: 16,761; sh: 5,650; makefile: 208; sed: 16
file content (370 lines) | stat: -rw-r--r-- 17,971 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="description" content="Internet DJ Console (IDJC) is a Shoutcast/Icecast internet radio client incorporating features for live radio show production." />
<meta name="keywords" xml:lang="en" content="idjc dj shoutcast icecast radio linux gtk live recorded voip irc" />
<link rel="shortcut icon" href="favicon.png" type="application/png" />
<link rel="stylesheet" href="style.css" type="text/css" />
<!--[if lte IE 7]><link rel="stylesheet" href="style_ie.css" type="text/css" /><![endif]-->
<title>Internet DJ Console Homepage</title>

<script type="text/javascript">
// Change the title text and highlight a navigation bar option.
function ui(title, menu) {
  document.getElementById('title').innerHTML = title;
  s = document.getElementById(menu).style;
  s.color = "#F70";
  s.fontWeight = "bold";
  s.textDecoration = "underline";
}
</script>

</head>
<body>
<!-- Hidden h1 title for search engine seeding -->
<h1 class="unshown">Internet DJ Console Homepage IDJC</h1>
<table id="main-table">
 <tr><td>
            <table>
               <tr id="logo-holder">
                  <td>
                  <img src="site-logo.png" width="148" height="212" alt="website logo" title="Internet DJ Console homepage"/>
                  </td>
               </tr>
               <tr>
                  <td id="left-sidebar">
                   <h3>Contents</h3>
                   <ul id="sidebar-menu">
                    <li><a href="index.html" id="front-page-nav">Front page</a></li>
                    <li><a href="tour.html" id="tour-nav">Tour</a></li>
                    <li>
                     <ul>
                      <li><a href="tour_main.html" id="tour-main-nav">Main window</a></li>
                      <li><a href="tour_miniplayers.html" id="tour-miniplayers-nav">Mini Players</a></li>
                      <li><a href="tour_output.html" id="tour-output-nav">Output</a></li>
                      <li><a href="tour_preferences.html" id="tour-preferences-nav">Preferences</a></li>
                     </ul>
                    </li>
                    <li><a href="install.html" id="install-nav">Installation</a></li>
                    <li>
                     <ul>
                      <li><a href="install_standard.html" id="install-standard-nav">Standard</a></li>
                      <li><a href="install_build.html" id="install-build-nav">Building</a></li>
                      <li><a href="install_first_run.html" id="install-first-run-nav">First run</a></li>
                     </ul>
                    </li>
                    <li><a href="tutorials.html" id="tutorials-nav">Tutorials</a></li>
                    <li>
                     <ul>
                      <li><a href="tutorials_icecast.html" id="tutorials-icecast-nav">Icecast</a></li>
                      <li><a href="tutorials_shoutcast.html" id="tutorials-shoutcast-nav">Shoutcast</a></li>
                      <li><a href="tutorials_voip.html" id="tutorials-voip-nav">VoIP</a></li>
                      <li><a href="tutorials_jack_ports_demystified.html" id="tutorials-jackportsdemyst-nav">JACK Ports</a></li>
                      <li><a href="tutorials_secrets.html" id="tutorials-secrets-nav">Secrets</a></li>
                     </ul>
                    </li>
                    <li><a href="code.html" id="code-nav">Extra code</a></li>
                    <li>
                     <ul>
                      <li><a href="code_idjcmon.html" id="code-idjcmon-nav">idjcmon.py</a></li>
                      <li><a href="code_pipewire_appname.html" id="code-pipewire-appname-nav">pipewire patch</a></li>
                     </ul>
                    </li>

                    <li><a href="contact.html" id="contact-nav">Contact</a></li>
                   </ul>
                  </td>
               </tr>
            </table>
     </td>
     <td>
            <table id="right-table">
               <tr>
                  <td id="top-titlebar">
                     <h2 id="title"></h2>
                  </td>
               </tr>
               <tr>
                  <td>
<script type="text/javascript">
ui('Tutorials: Streaming with Icecast and IDJC', 'tutorials-icecast-nav')
</script>

<h4>Aims</h4>

<p>In this section I'm going to walk you through the procedure of setting up an Iceccast server
and then sending a live stream to it with IDJC. In addition I will demonstrate the connection of
a listener to show that everything really does work.</p>

<p>The advice below is for demonstration purposes only. Not covered are best practices of locking
down an Icecast server for serious use. For that and other non IDJC related matters there are the
<a href="https://icecast.imux.net/">Icecast forums</a> and the Icecast documentation itself.</p>

<h4>Setting up Icecast</h4>

<h5>Why local?</h5>
<p>Everything in this tutorial will be demonstrated on the same machine and while not as impressive as
sending a stream half way across your house, by making this tutorial single machine specific I can
not only leave multi-machine as an exercise to the reader but also not have to worry about anyone's
local network specifics or how many machines they have reasonable access to.</p>

<h5>Installing Icecast</h5>

<ul><li>
<p>Ubuntu</p>
<pre class="reduced">sudo apt-get install icecast2</pre>
</li><li>
<p>Debian</p>
<pre class="reduced">sudo -c "apt-get install icecast2"</pre>
</li></ul>

<h5>The configuration file</h5>

<p>Take a look in your <em>/etc/icecast2/</em>
directory and you should find a file called <em>icecast.xml</em>. This file is and will be referred to as the
Icecast server configuration file. In it are the settings for the various different Icecast options.
Here below are the typical contents.</p>

<pre class="big-code" title="icecast.xml">&lt;icecast&gt;
    &lt;limits&gt;
        &lt;clients&gt;100&lt;/clients&gt;
        &lt;sources&gt;2&lt;/sources&gt;
        &lt;threadpool&gt;5&lt;/threadpool&gt;
        &lt;queue-size&gt;524288&lt;/queue-size&gt;
        &lt;client-timeout&gt;30&lt;/client-timeout&gt;
        &lt;header-timeout&gt;15&lt;/header-timeout&gt;
        &lt;source-timeout&gt;10&lt;/source-timeout&gt;
        <span style="color:gray;">&lt;!-- If enabled, this will provide a burst of data when a client
             first connects, thereby significantly reducing the startup
             time for listeners that do substantial buffering. However,
             it also significantly increases latency between the source
             client and listening client.  For low-latency setups, you
             might want to disable this. --&gt;</span>
        &lt;burst-on-connect&gt;1&lt;/burst-on-connect&gt;
        <span style="color:gray;">&lt;!-- same as burst-on-connect, but this allows for being more
             specific on how much to burst. Most people won't need to
             change from the default 64k. Applies to all mountpoints  --&gt;</span>
        &lt;burst-size&gt;65535&lt;/burst-size&gt;
    &lt;/limits&gt;

    &lt;authentication&gt;
        <span style="color:gray;">&lt;!-- Sources log in with username 'source' --&gt;</span>
        &lt;source-password&gt;hackme&lt;/source-password&gt;
        <span style="color:gray;">&lt;!-- Relays log in username 'relay' --&gt;</span>
        &lt;relay-password&gt;hackme&lt;/relay-password&gt;

        <span style="color:gray;">&lt;!-- Admin logs in with the username given below --&gt;</span>
        &lt;admin-user&gt;admin&lt;/admin-user&gt;
        &lt;admin-password&gt;hackme&lt;/admin-password&gt;
    &lt;/authentication&gt;

    <span style="color:gray;">&lt;!-- set the mountpoint for a shoutcast source to use, the default if not
         specified is /stream but you can change it here if an alternative is
         wanted or an extension is required
    &lt;shoutcast-mount&gt;/live.nsv&lt;/shoutcast-mount&gt;
    --&gt;</span>

    <span style="color:gray;">&lt;!-- Uncomment this if you want directory listings --&gt;</span>
    <span style="color:gray;">&lt;!--
    &lt;directory&gt;
        &lt;yp-url-timeout&gt;15&lt;/yp-url-timeout&gt;
        &lt;yp-url&gt;http://dir.xiph.org/cgi-bin/yp-cgi&lt;/yp-url&gt;
    &lt;/directory&gt;
     --&gt;</span>

    <span style="color:gray;">&lt;!-- This is the hostname other people will use to connect to your server.
    It affects mainly the urls generated by Icecast for playlists and yp
    listings. --&gt;</span>
    &lt;hostname&gt;localhost&lt;/hostname&gt;

    <span style="color:gray;">&lt;!-- You may have multiple &lt;listener&gt; elements --&gt;</span>
    &lt;listen-socket&gt;
        &lt;port&gt;8000&lt;/port&gt;
        <span style="color:gray;">&lt;!-- &lt;bind-address&gt;127.0.0.1&lt;/bind-address&gt; --&gt;</span>
        <span style="color:gray;">&lt;!-- &lt;shoutcast-mount&gt;/stream&lt;/shoutcast-mount&gt; --&gt;</span>
    &lt;/listen-socket&gt;
    <span style="color:gray;">&lt;!--
    &lt;listen-socket&gt;
        &lt;port&gt;8001&lt;/port&gt;
    &lt;/listen-socket&gt;
    --&gt;</span>

    <span style="color:gray;">&lt;!--&lt;master-server&gt;127.0.0.1&lt;/master-server&gt;--&gt;</span>
    <span style="color:gray;">&lt;!--&lt;master-server-port&gt;8001&lt;/master-server-port&gt;--&gt;</span>
    <span style="color:gray;">&lt;!--&lt;master-update-interval&gt;120&lt;/master-update-interval&gt;--&gt;</span>
    <span style="color:gray;">&lt;!--&lt;master-password&gt;hackme&lt;/master-password&gt;--&gt;</span>

    <span style="color:gray;">&lt;!-- setting this makes all relays on-demand unless overridden, this is
         useful for master relays which do not have &lt;relay&gt; definitions here.
         The default is 0 --&gt;</span>
    <span style="color:gray;">&lt;!--&lt;relays-on-demand&gt;1&lt;/relays-on-demand&gt;--&gt;</span>

    <span style="color:gray;">&lt;!--
    &lt;relay&gt;
        &lt;server&gt;127.0.0.1&lt;/server&gt;
        &lt;port&gt;8001&lt;/port&gt;
        &lt;mount&gt;/example.ogg&lt;/mount&gt;
        &lt;local-mount&gt;/different.ogg&lt;/local-mount&gt;
        &lt;on-demand&gt;0&lt;/on-demand&gt;

        &lt;relay-shoutcast-metadata&gt;0&lt;/relay-shoutcast-metadata&gt;
    &lt;/relay&gt;
    --&gt;</span>

    <span style="color:gray;">&lt;!-- Only define a &lt;mount&gt; section if you want to use advanced options,
         like alternative usernames or passwords
    &lt;mount&gt;
        &lt;mount-name&gt;/example-complex.ogg&lt;/mount-name&gt;

        &lt;username&gt;othersource&lt;/username&gt;
        &lt;password&gt;hackmemore&lt;/password&gt;

        &lt;max-listeners&gt;1&lt;/max-listeners&gt;
        &lt;dump-file&gt;/tmp/dump-example1.ogg&lt;/dump-file&gt;
        &lt;burst-size&gt;65536&lt;/burst-size&gt;
        &lt;fallback-mount&gt;/example2.ogg&lt;/fallback-mount&gt;
        &lt;fallback-override&gt;1&lt;/fallback-override&gt;
        &lt;fallback-when-full&gt;1&lt;/fallback-when-full&gt;
        &lt;intro&gt;/example_intro.ogg&lt;/intro&gt;
        &lt;hidden&gt;1&lt;/hidden&gt;
        &lt;no-yp&gt;1&lt;/no-yp&gt;
        &lt;authentication type="htpasswd"&gt;
                &lt;option name="filename" value="myauth"/&gt;
                &lt;option name="allow_duplicate_users" value="0"/&gt;
        &lt;/authentication&gt;
        &lt;on-connect&gt;/home/icecast/bin/stream-start&lt;/on-connect&gt;
        &lt;on-disconnect&gt;/home/icecast/bin/stream-stop&lt;/on-disconnect&gt;
    &lt;/mount&gt;

    &lt;mount&gt;
        &lt;mount-name&gt;/auth_example.ogg&lt;/mount-name&gt;
        &lt;authentication type="url"&gt;
            &lt;option name="mount_add"       value="http://myauthserver.net/notify_mount.php"/&gt;
            &lt;option name="mount_remove"    value="http://myauthserver.net/notify_mount.php"/&gt;
            &lt;option name="listener_add"    value="http://myauthserver.net/notify_listener.php"/&gt;
            &lt;option name="listener_remove" value="http://myauthserver.net/notify_listener.php"/&gt;
        &lt;/authentication&gt;
    &lt;/mount&gt;

    --&gt;</span>

    &lt;fileserve&gt;1&lt;/fileserve&gt;

    &lt;paths&gt;
		<span style="color:gray;">&lt;!-- basedir is only used if chroot is enabled --&gt;</span>
        &lt;basedir&gt;/usr/share/icecast2&lt;/basedir&gt;

        <span style="color:gray;">&lt;!-- Note that if &lt;chroot&gt; is turned on below, these paths must both
             be relative to the new root, not the original root --&gt;</span>
        &lt;logdir&gt;/var/log/icecast2&lt;/logdir&gt;
        &lt;webroot&gt;/usr/share/icecast2/web&lt;/webroot&gt;
        &lt;adminroot&gt;/usr/share/icecast2/admin&lt;/adminroot&gt;
        <span style="color:gray;">&lt;!-- &lt;pidfile&gt;/usr/share/icecast2/icecast.pid&lt;/pidfile&gt; --&gt;</span>

        <span style="color:gray;">&lt;!-- Aliases: treat requests for 'source' path as being for 'dest' path
             May be made specific to a port or bound address using the "port"
             and "bind-address" attributes.
          --&gt;</span>
        <span style="color:gray;">&lt;!--
        &lt;alias source="/foo" dest="/bar"/&gt;
          --&gt;</span>
        <span style="color:gray;">&lt;!-- Aliases: can also be used for simple redirections as well,
             this example will redirect all requests for http://server:port/ to
             the status page
          --&gt;</span>
        &lt;alias source="/" dest="/status.xsl"/&gt;
    &lt;/paths&gt;

    &lt;logging&gt;
        &lt;accesslog&gt;access.log&lt;/accesslog&gt;
        &lt;errorlog&gt;error.log&lt;/errorlog&gt;
        <span style="color:gray;">&lt;!-- &lt;playlistlog&gt;playlist.log&lt;/playlistlog&gt; --&gt;</span>
      	&lt;loglevel&gt;3&lt;/loglevel&gt; <span style="color:gray;">&lt;!-- 4 Debug, 3 Info, 2 Warn, 1 Error --&gt;</span>
      	&lt;logsize&gt;10000&lt;/logsize&gt; <span style="color:gray;">&lt;!-- Max size of a logfile --&gt;</span>
        <span style="color:gray;">&lt;!-- If logarchive is enabled (1), then when logsize is reached
             the logfile will be moved to [error|access|playlist].log.DATESTAMP,
             otherwise it will be moved to [error|access|playlist].log.old.
             Default is non-archive mode (i.e. overwrite)
        --&gt;</span>
        <span style="color:gray;">&lt;!-- &lt;logarchive&gt;1&lt;/logarchive&gt; --&gt;</span>
    &lt;/logging&gt;

    &lt;security&gt;
        &lt;chroot&gt;0&lt;/chroot&gt;
        <span style="color:gray;">&lt;!--
        &lt;changeowner&gt;
            &lt;user&gt;nobody&lt;/user&gt;
            &lt;group&gt;nogroup&lt;/group&gt;
        &lt;/changeowner&gt;
        --&gt;</span>
    &lt;/security&gt;
&lt;/icecast&gt;</pre>

<p>What we should do now is copy and paste this file into a text editor or start editing a copy of your original
file. Hint: use your own file in preference to mine. Launch a text editor like gedit to do this.</p>

<p>Next, select Save As in the text editor's menu, choose the file name icecast.xml, and save it in your home directory.</p>
<h5>Attempting to run</h5>

<pre>$ icecast2 -c icecast.xml
FATAL: could not open error logging (/var/log/icecast2/error.log): No such file or directory
FATAL: could not open access logging (/var/log/icecast2/access.log): No such file or directory
FATAL: Could not start logging
</pre>

<p>Fix this by editing icecast.xml and change the logdir setting to /tmp which will solve the problem of
inadequate write permissions and try again. Leave Icecast running for the time being.</p>

<h4>Configuring IDJC</h4>

<p>If not running Pipewire start the JACK sound server as follows in order to ensure unimpeded access to the soundcard by
Pulseaudio.</p>
<pre>$ jackd -d dummy -r 44100</pre>

<p>Run IDJC and select Output from the View menu. In the Output window click Configuration so the
configuration section is visible.</p>

<p>Click Connection, then New.</p>
<p>For Server type you want Icecast 2 Master, for Hostname, localhost, port number should be 8000, mount point
can be what you like but choose /listen, login name needs to be source and the password will be the default
password, which is <span title="Obviously a server exposed to the Internet should never&#32;
be configured to use its default password"><em>hackme</em></span>. Click Ok to add the server to the list.</p>

<p>Click Format. Select MPEG and click the right arrow repeatedly until all the option boxes appear.</p>

<p>Click Individual Controls so the controls section is visible and click the button that says
localhost:8000/listen.</p>

<p>If the button stays in you have made the connection.</p>

<p>If the connection fails try 127.0.0.1 in place of localhost.</p>

<h4>Streaming some audio</h4>

<p>Click the <em>+</em> button on the left media player and using the file selector add a track to the
playlist. Click play. Make sure the crossfader is set all the way to the left. Of the player's Audio Feed settings,
make sure Stream is on and DJ is off and Monitor Mix is set to DJ.
You should be able to see activity in the Str Peak meter.</p>

<p>If you can't hear anything right now it's because DJ is off and/or you are running a dummy JACK soundcard,
which is what you want for the sake of this test.</p>

<h4>Join the stream as a listener</h4>

<pre>$ mplayer http://localhost:8000/listen</pre>

<p>After a brief moment audio should start to play and within thirty seconds the listener count in the main IDJC
window should have risen to 1. It's possible to add more listeners up to the maximum number currently
specified in the Icecast configuration file.</p>
                  </td>
               </tr>
            </table>
     </td>
 </tr>
</table>
</body>
</html>