| 1 |
.\" Copyright (c) 2007 - 2020 Moritz Grimm <[email protected]> |
| 2 |
.\" |
| 3 |
.\" This program is free software; you can redistribute it and/or modify |
| 4 |
.\" it under the terms of the GNU General Public License version 2 as |
| 5 |
.\" published by the Free Software Foundation. |
| 6 |
.\" |
| 7 |
.\" This program is distributed in the hope that it will be useful, |
| 8 |
.\" but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 9 |
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 10 |
.\" GNU General Public License for more details. |
| 11 |
.\" |
| 12 |
.Dd @BUILD_DATE@ |
| 13 |
.Dt EZSTREAM 1 |
| 14 |
.Os @PACKAGE_NAME@ @PACKAGE_VERSION@ |
| 15 |
.Sh NAME |
| 16 |
.Nm ezstream |
| 17 |
.Nd source client for Icecast with external de-/encoder support |
| 18 |
.Sh SYNOPSIS |
| 19 |
.Nm |
| 20 |
.Bk -words |
| 21 |
.Op Fl hqrVv |
| 22 |
.Fl c Ar configfile |
| 23 |
.Op Fl p Ar pidfile |
| 24 |
.Ek |
| 25 |
.Nm |
| 26 |
.Bk -words |
| 27 |
.Fl s Ar file |
| 28 |
.Ek |
| 29 |
.Sh DESCRIPTION |
| 30 |
.Nm |
| 31 |
is a command line source client for media streams, primarily for streaming |
| 32 |
to Icecast servers. |
| 33 |
.Pp |
| 34 |
It allows the creation of media streams based on input from files or standard |
| 35 |
input that is piped through an optional external de- and encoder. |
| 36 |
As every part of this chain is highly configurable, ezstream can be useful in |
| 37 |
a large number of streaming setups. |
| 38 |
.Ss Command line arguments |
| 39 |
.Bl -tag -width Ds |
| 40 |
.It Fl c Ar configfile |
| 41 |
Use the XML configuration in |
| 42 |
.Ar configfile . |
| 43 |
.It Fl h |
| 44 |
Print a summary of available command line arguments with short descriptions |
| 45 |
and exit. |
| 46 |
.It Fl p Ar pidfile |
| 47 |
Write the |
| 48 |
.Nm |
| 49 |
process ID |
| 50 |
.Pq a single number |
| 51 |
to |
| 52 |
.Ar pidfile . |
| 53 |
The file will be written even when it already exists. |
| 54 |
A file lock is maintained until the main |
| 55 |
.Nm |
| 56 |
process terminates. |
| 57 |
If the file cannot be written for any reason, |
| 58 |
.Nm |
| 59 |
will log this, but not consider it a fatal error. |
| 60 |
.It Fl q |
| 61 |
Be more quiet. |
| 62 |
Suppress the output that external programs send to standard error. |
| 63 |
.It Fl r |
| 64 |
Maintain a line of real-time status information about the stream on standard |
| 65 |
output. |
| 66 |
.Po |
| 67 |
Implies |
| 68 |
.Fl q . |
| 69 |
.Pc |
| 70 |
.It Fl s Ar file |
| 71 |
Run |
| 72 |
.Nm |
| 73 |
as a line-based shuffling utility. |
| 74 |
If a |
| 75 |
.Ar playlist |
| 76 |
argument of |
| 77 |
.Dq - |
| 78 |
is given, a list of media file names is read from standard input |
| 79 |
instead of an input file. |
| 80 |
After successfully reading the entire list, it is shuffled and printed to |
| 81 |
standard output, and |
| 82 |
.Nm |
| 83 |
will exit. |
| 84 |
.It Fl V |
| 85 |
Print the |
| 86 |
.Nm |
| 87 |
version number and exit. |
| 88 |
.It Fl v |
| 89 |
Increase logging verbosity. |
| 90 |
May be used up to three times to also include debug logging output. |
| 91 |
.El |
| 92 |
.Ss Runtime control |
| 93 |
.Nm Ezstream |
| 94 |
offers limited runtime control via signals. |
| 95 |
By sending a signal to the ezstream process, e.g. with the |
| 96 |
.Xr kill 1 |
| 97 |
utility, a certain action will be triggered. |
| 98 |
.Bl -tag -width -Ds |
| 99 |
.It Cd SIGHUP |
| 100 |
Rereads the playlist file after the track that is currently streamed. |
| 101 |
If the playlist is not to be shuffled, |
| 102 |
.Nm |
| 103 |
attempts to find the previously streamed file and continue with the one |
| 104 |
following it, or restarts from the beginning of the list otherwise. |
| 105 |
.It Cd SIGUSR1 |
| 106 |
Skips the currently playing track and moves on to the next in playlist mode, or |
| 107 |
restarts the current track when streaming a single file. |
| 108 |
.It Cd SIGUSR2 |
| 109 |
Triggers rereading of metadata for the stream by running the configured |
| 110 |
program or script. |
| 111 |
This is the only meaningful signal when streaming from standard input. |
| 112 |
.El |
| 113 |
.Pp |
| 114 |
.Sh CONFIGURATION FILE SYNTAX |
| 115 |
The |
| 116 |
.Nm |
| 117 |
utility uses a simple XML configuration file format. |
| 118 |
It has a tree-like structure and is made up of |
| 119 |
.Em XML elements . |
| 120 |
Of all the possible XML features, only regular elements that contain text or |
| 121 |
other elements, and comments, appear in an |
| 122 |
.Nm |
| 123 |
configuration file. |
| 124 |
.Pp |
| 125 |
Each element in the configuration file consists of a |
| 126 |
.Em start tag , |
| 127 |
its content, and an |
| 128 |
.Em end tag . |
| 129 |
For example: |
| 130 |
.Pp |
| 131 |
.Dl \&<filename\&>playlist.m3u<\&/filename\&> |
| 132 |
.Dl \&<\&!-- XML comments look like this. --\&> |
| 133 |
.Sh XML CONFIGURATION |
| 134 |
In this section, each available element is listed and described. |
| 135 |
Note that for this purpose, elements are introduced in their short, i.e. empty |
| 136 |
form. |
| 137 |
In the configuration file, they need to be used as |
| 138 |
.Em start tag + content + end tag , |
| 139 |
like in the introductory example shown above. |
| 140 |
.Ss Root element |
| 141 |
.Bl -tag -width -Ds |
| 142 |
.It Sy \&<ezstream\ /\&> |
| 143 |
.Pq Mandatory. |
| 144 |
The configuration file's root element. |
| 145 |
It contains all other configuration elements. |
| 146 |
.Pp |
| 147 |
.El |
| 148 |
.Ss Servers block |
| 149 |
.Bl -tag -width -Ds |
| 150 |
.It Sy \&<servers\ /\&> |
| 151 |
This element contains all server blocks as child elements. |
| 152 |
Its parent is the |
| 153 |
.Sy \&<ezstream\ /\&> |
| 154 |
element. |
| 155 |
.Pp |
| 156 |
A configuration file may contain multiple named server configurations. |
| 157 |
The stream configuration determines what server configuration should be used. |
| 158 |
.El |
| 159 |
.Ss Server block |
| 160 |
.Bl -tag -width -Ds |
| 161 |
.It Sy \&<server\ /\&> |
| 162 |
.Pq Mandatory. |
| 163 |
This element contains a complete server configuration as child elements. |
| 164 |
Its parent is the |
| 165 |
.Sy \&<servers\ /\&> |
| 166 |
element. |
| 167 |
.El |
| 168 |
.Ss Server configuration |
| 169 |
.Bl -tag -width -Ds |
| 170 |
.It Sy \&<name\ /\&> |
| 171 |
Set the name of the server configuration. |
| 172 |
This may be referenced in a |
| 173 |
.Sy \&<stream\ /\&> . |
| 174 |
.Pp |
| 175 |
The name is case-aware, but not case-sensitive. |
| 176 |
.Pp |
| 177 |
Default: |
| 178 |
.Ar default |
| 179 |
.It Sy \&<protocol\ /\&> |
| 180 |
Transport protocol used to stream to the server: |
| 181 |
.Pp |
| 182 |
.Bl -tag -width RoarAudio -compact |
| 183 |
.It Ar HTTP |
| 184 |
Plain-text HTTP. |
| 185 |
The \&<tls\ /\&> option defines, if TLS via RFC2817 or RFC2818 is also |
| 186 |
attempted. |
| 187 |
.It Ar HTTPS |
| 188 |
HTTP over TLS. |
| 189 |
This option implies that \&<tls\ /\&> is set to |
| 190 |
.Qq required . |
| 191 |
.It Ar ICY |
| 192 |
ICY streaming protocol |
| 193 |
.It Ar RoarAudio |
| 194 |
RoarAudio streaming protocol |
| 195 |
.El |
| 196 |
.Pp |
| 197 |
Default: |
| 198 |
.Ar HTTP |
| 199 |
.It Sy \&<hostname\ /\&> |
| 200 |
.Pq Mandatory. |
| 201 |
The FQDN host name or IP address of the server. |
| 202 |
.It Sy \&<port\ /\&> |
| 203 |
Port number on which the server is listening. |
| 204 |
.Pp |
| 205 |
Default: |
| 206 |
.Ar 8000 |
| 207 |
.It Sy \&<user\ /\&> |
| 208 |
User to authenticate as on the server. |
| 209 |
.Pp |
| 210 |
Default: |
| 211 |
.Ar source |
| 212 |
.It Sy \&<password\ /\&> |
| 213 |
.Pq Mandatory. |
| 214 |
Password to authenticate with on the server. |
| 215 |
.It Sy \&<reconnect_attempts\ /\&> |
| 216 |
Number of reconnect attempts in case of connection issues with the server, |
| 217 |
or 0 |
| 218 |
.Pq zero |
| 219 |
for trying indefinitely. |
| 220 |
.Pp |
| 221 |
Default: |
| 222 |
.Ar 0 |
| 223 |
.It Sy \&<tls\ /\&> |
| 224 |
Configure the TLS encryption requirement for the server connection. |
| 225 |
Possible values are: |
| 226 |
.Pp |
| 227 |
.Bl -tag -width 0|NO|FALSE -compact |
| 228 |
.It Ar None |
| 229 |
No TLS encryption will be attempted. |
| 230 |
.It Ar May |
| 231 |
Opportunistic TLS encryption may be used, if the server supports it |
| 232 |
.It Ar Required |
| 233 |
TLS encryption is required. |
| 234 |
This is the only setting that is providing security against both passive and |
| 235 |
active attackers. |
| 236 |
.El |
| 237 |
.Pp |
| 238 |
Default: |
| 239 |
.Ar May |
| 240 |
.Pp |
| 241 |
This option is ignored when \&<protocol\ /\&> is set to |
| 242 |
.Ar HTTPS , |
| 243 |
which implies a value of |
| 244 |
.Ar Required . |
| 245 |
.It Sy \&<tls_cipher_suite\ /\&> |
| 246 |
Configure allowed cipher suites for TLS. |
| 247 |
.Pp |
| 248 |
For example (modern cipher suites, PFS, TLS 1.2 or better): |
| 249 |
.Sy HIGH:!RSA:!SHA:!DH:!aNULL:!eNULL:!TLSv1 . |
| 250 |
.Pp |
| 251 |
Default: |
| 252 |
.Em libshout default cipher suite |
| 253 |
.It Sy \&<ca_dir\ /\&> |
| 254 |
Directory in which OpenSSL finds root CA certificates for validating the |
| 255 |
.Ar HTTPS |
| 256 |
server identity. |
| 257 |
.Pp |
| 258 |
Default: |
| 259 |
.Em system default |
| 260 |
.It Sy \&<ca_file\ /\&> |
| 261 |
Path of a root CA bundle file for validating the |
| 262 |
.Ar HTTPS |
| 263 |
server identity. |
| 264 |
.Pp |
| 265 |
Default: |
| 266 |
.Em system default |
| 267 |
.It Sy \&<client_cert\ /\&> |
| 268 |
X.503 client certificate and key |
| 269 |
.Pq in PEM format containing both certificate and key in the same file |
| 270 |
for authentication on an |
| 271 |
.Ar HTTPS |
| 272 |
server. |
| 273 |
.Pp |
| 274 |
Default: |
| 275 |
.Em no client certificate authentication |
| 276 |
.El |
| 277 |
.Ss Streams block |
| 278 |
.Bl -tag -width -Ds |
| 279 |
.It Sy \&<streams\ /\&> |
| 280 |
This element contains all stream blocks as child elements. |
| 281 |
Its parent is the |
| 282 |
.Sy \&<ezstream\ /\&> |
| 283 |
element. |
| 284 |
.Pp |
| 285 |
.Em Note: |
| 286 |
While multiple stream configurations are supported by the file format, only |
| 287 |
the one configuration with the name |
| 288 |
.Ar default |
| 289 |
will be used by |
| 290 |
.Nm . |
| 291 |
.El |
| 292 |
.Ss Stream block |
| 293 |
.Bl -tag -width -Ds |
| 294 |
.It Sy \&<stream\ /\&> |
| 295 |
.Pq Mandatory. |
| 296 |
This element contains the entire stream configuration as child elements. |
| 297 |
Its parent is the |
| 298 |
.Sy \&<streams\ /\&> |
| 299 |
element. |
| 300 |
.El |
| 301 |
.Ss Stream configuration |
| 302 |
.Bl -tag -width -Ds |
| 303 |
.It Sy \&<name\ /\&> |
| 304 |
Set the name of the stream configuration. |
| 305 |
.Pp |
| 306 |
The name is case-aware, but not case-sensitive. |
| 307 |
.Pp |
| 308 |
.Em Note: |
| 309 |
At this time, only the stream configuration with the default name is |
| 310 |
used and must be present. |
| 311 |
.Pp |
| 312 |
Default: |
| 313 |
.Ar default |
| 314 |
.It Sy \&<mountpoint\ /\&> |
| 315 |
.Pq Mandatory. |
| 316 |
Stream mountpoint on the server. |
| 317 |
.It Sy \&<public\ /\&> |
| 318 |
Boolean setting of whether the broadcast may be listed in a public YP |
| 319 |
directory, or not. |
| 320 |
.Pp |
| 321 |
.Bl -tag -width 0|NO|FALSE -compact |
| 322 |
.It Ar 0|No|False |
| 323 |
The broadcast is private (the default). |
| 324 |
.It Ar 1|Yes|True |
| 325 |
The broadcast is public. |
| 326 |
.El |
| 327 |
.It Sy \&<intake\ /\&> |
| 328 |
Use the intake |
| 329 |
.Po |
| 330 |
input media |
| 331 |
.Pc |
| 332 |
configuration with the provided symbolic name for this stream. |
| 333 |
.Pp |
| 334 |
Default: |
| 335 |
.Ar default |
| 336 |
.It Sy \&<server\ /\&> |
| 337 |
Use the server configuration with the provided symbolic name for this stream. |
| 338 |
.Pp |
| 339 |
Default: |
| 340 |
.Ar default |
| 341 |
.It Sy \&<format\ /\&> |
| 342 |
.Pq Mandatory. |
| 343 |
The stream format. |
| 344 |
.Pp |
| 345 |
.Bl -tag -width Matroska -compact |
| 346 |
.It Ar Ogg |
| 347 |
Ogg media format |
| 348 |
.It Ar MP3 |
| 349 |
MP3 audio format |
| 350 |
.It Ar WebM |
| 351 |
WebM media format |
| 352 |
.It Ar Matroska |
| 353 |
Matroska media format |
| 354 |
.El |
| 355 |
.It Sy \&<encoder\ /\&> |
| 356 |
Use the encoder configuration with the provided symbolic name |
| 357 |
.Pq see below , |
| 358 |
for (re)encoding the stream. |
| 359 |
Not configuring an encoder makes |
| 360 |
.Nm |
| 361 |
stream input media files as-is. |
| 362 |
.Pp |
| 363 |
The configured encoder's output stream format must match what is configured |
| 364 |
in |
| 365 |
.Sy \&<format\ /\&> . |
| 366 |
.It Sy \&<stream_name\ /\&> |
| 367 |
Informational name of the broadcast. |
| 368 |
.Pp |
| 369 |
Default: |
| 370 |
.Em none |
| 371 |
.It Sy \&<stream_url\ /\&> |
| 372 |
Informational URL associated with the broadcast, e.g. the web site. |
| 373 |
.Pp |
| 374 |
Default: |
| 375 |
.Em none |
| 376 |
.It Sy \&<stream_genre\ /\&> |
| 377 |
Informational genre of the broadcast. |
| 378 |
.Pp |
| 379 |
Default: |
| 380 |
.Em none |
| 381 |
.It Sy \&<stream_description\ /\&> |
| 382 |
Informational description of the broadcast. |
| 383 |
.Pp |
| 384 |
Default: |
| 385 |
.Em none |
| 386 |
.It Sy \&<stream_quality\ /\&> |
| 387 |
Informational quality setting of the VBR broadcast. |
| 388 |
.Pp |
| 389 |
Default: |
| 390 |
.Em none |
| 391 |
.It Sy \&<stream_bitrate\ /\&> |
| 392 |
Informational bitrate setting of the CBR broadcast. |
| 393 |
.Pp |
| 394 |
Default: |
| 395 |
.Em none |
| 396 |
.It Sy \&<stream_samplerate\ /\&> |
| 397 |
Informational sample rate of the broadcast audio. |
| 398 |
.Pp |
| 399 |
Default: |
| 400 |
.Em none |
| 401 |
.It Sy \&<stream_channels\ /\&> |
| 402 |
Informational number of audio channels of the broadcast. |
| 403 |
.Pp |
| 404 |
Default: |
| 405 |
.Em none |
| 406 |
.El |
| 407 |
.Ss Intakes block |
| 408 |
.Bl -tag -width -Ds |
| 409 |
.It Sy \&<intakes\ /\&> |
| 410 |
This element contains all intake blocks as child elements. |
| 411 |
Its parent is the |
| 412 |
.Sy \&<ezstream\ /\&> |
| 413 |
element. |
| 414 |
.Pp |
| 415 |
A configuration file may contain multiple named intake configurations. |
| 416 |
The stream configuration determines what intake |
| 417 |
.Po |
| 418 |
media input |
| 419 |
.Pc |
| 420 |
configuration should be used. |
| 421 |
.El |
| 422 |
.Ss Intake block |
| 423 |
.Bl -tag -width -Ds |
| 424 |
.It Sy \&<intake\ /\&> |
| 425 |
.Pq Mandatory. |
| 426 |
This element contains the entire input media configuration as child elements. |
| 427 |
Its parent is the |
| 428 |
.Sy \&<intakes\ /\&> |
| 429 |
element. |
| 430 |
.El |
| 431 |
.Ss Intake configuration |
| 432 |
.Bl -tag -width -Ds |
| 433 |
.It Sy \&<name\ /\&> |
| 434 |
Set the name of the intake configuration. |
| 435 |
This may be referenced in a |
| 436 |
.Sy \&<stream\ /\&> . |
| 437 |
.Pp |
| 438 |
The name is case-aware, but not case-sensitive. |
| 439 |
.Pp |
| 440 |
Default: |
| 441 |
.Ar default |
| 442 |
.It Sy \&<type\ /\&> |
| 443 |
Configure the input media type: |
| 444 |
.Pp |
| 445 |
.Bl -tag -width AUTODETECT -compact |
| 446 |
.It Ar autodetect |
| 447 |
Attempt to autodetect, whether the input is a playlist, or a single media |
| 448 |
file. |
| 449 |
Playlists are detected by their |
| 450 |
.Dq Li .m3u |
| 451 |
and |
| 452 |
.Dq Li .txt |
| 453 |
file name extensions. |
| 454 |
.Pq This is the default. |
| 455 |
.It Ar file |
| 456 |
The input is one single media file. |
| 457 |
.It Ar playlist |
| 458 |
The input is a playlist. |
| 459 |
Playlists are a newline-delimited list of media file path names. |
| 460 |
Comments in playlists are introduced by a |
| 461 |
.Sq Li # |
| 462 |
sign at the beginning of a line and ignored by |
| 463 |
.Nm . |
| 464 |
.It Ar program |
| 465 |
The input is an executable |
| 466 |
.Dq Playlist Program . |
| 467 |
See |
| 468 |
.Xr SCRIPTING |
| 469 |
for more information. |
| 470 |
.It Ar stdin |
| 471 |
The input is read from standard input and streamed as-is without any |
| 472 |
reencoding. |
| 473 |
.El |
| 474 |
.It Sy \&<filename\ /\&> |
| 475 |
The input media file name; mandatory for all but the |
| 476 |
.Ar stdin |
| 477 |
type. |
| 478 |
.It Sy \&<shuffle\ /\&> |
| 479 |
Boolean setting of whether the |
| 480 |
.Ar playlist |
| 481 |
type media should be shuffled, or not. |
| 482 |
.Pp |
| 483 |
.Bl -tag -width 0|NO|FALSE -compact |
| 484 |
.It Ar 0|No|False |
| 485 |
Stream the playlist content sequentially (the default). |
| 486 |
.It Ar 1|Yes|True |
| 487 |
Shuffle the playlist prior to streaming its content. |
| 488 |
.El |
| 489 |
.It Sy \&<stream_once\ /\&> |
| 490 |
Boolean setting of whether |
| 491 |
.Nm |
| 492 |
should exit after streaming its media input, or start over. |
| 493 |
.Pp |
| 494 |
.Bl -tag -width 0|NO|FALSE -compact |
| 495 |
.It Ar 0|No|False |
| 496 |
Attempt to start over whenever the end of the media input is reached (the |
| 497 |
default). |
| 498 |
.It Ar 1|Yes|True |
| 499 |
After streaming all media input, exit. |
| 500 |
.El |
| 501 |
.El |
| 502 |
.Ss Metadata block |
| 503 |
.Bl -tag -width -Ds |
| 504 |
.It Sy \&<metadata\ /\&> |
| 505 |
This element contains the entire metadata configuration as child elements. |
| 506 |
Its parent is the |
| 507 |
.Sy \&<ezstream\ /\&> |
| 508 |
element. |
| 509 |
.El |
| 510 |
.Ss Metadata configuration |
| 511 |
.Bl -tag -width -Ds |
| 512 |
.It Sy \&<program\ /\&> |
| 513 |
Set an executable |
| 514 |
.Dq Metadata Program |
| 515 |
to be queried for all metadata on |
| 516 |
.Sy SIGUSR2 |
| 517 |
or whenever a new track begins. |
| 518 |
See |
| 519 |
.Xr SCRIPTING |
| 520 |
for more information. |
| 521 |
.Pp |
| 522 |
Default: |
| 523 |
.Em use metadata as contained in media files |
| 524 |
.It Sy \&<format_str\ /\&> |
| 525 |
Set the format of the string that should be used for the |
| 526 |
.Sq Li @M@ |
| 527 |
placeholder, when quering for metadata from an executable. |
| 528 |
.Pp |
| 529 |
Default: |
| 530 |
.Li @a@ - @t@ |
| 531 |
.It Sy \&<refresh_interval\ /\&> |
| 532 |
Configure a time interval for additional metadata updates via a |
| 533 |
.Dq Metadata Program : |
| 534 |
.Pp |
| 535 |
.Bl -tag -width -1 -compact |
| 536 |
.It Ar -1 |
| 537 |
Do not trigger any additional metadata updates (the default). |
| 538 |
.It Ar 0 |
| 539 |
Trigger metadata updates at the highest reasonable frequency. |
| 540 |
.It Ar \&>0 |
| 541 |
Configure the time |
| 542 |
.Pq in seconds |
| 543 |
in between additional metadata updates. |
| 544 |
.El |
| 545 |
.It Sy \&<normalize_strings\ /\&> |
| 546 |
Boolean setting of whether metadata strings should have excess whitespace |
| 547 |
removed, or not. |
| 548 |
.Pp |
| 549 |
.Bl -tag -width 0|NO|FALSE -compact |
| 550 |
.It Ar 0|No|False |
| 551 |
Use metadata strings as-is (the default). |
| 552 |
.It Ar 1|Yes|True |
| 553 |
Trim leading and trailing whitespace, as well as remove excess whitespace |
| 554 |
in case that there is more than one in sequence. |
| 555 |
.El |
| 556 |
.It Sy \&<no_updates\ /\&> |
| 557 |
Boolean setting of whether metadata updates should be suppressed altogether, |
| 558 |
or not. |
| 559 |
.Pp |
| 560 |
.Bl -tag -width 0|NO|FALSE -compact |
| 561 |
.It Ar 0|No|False |
| 562 |
Update metadata in the usual manner (the default). |
| 563 |
.It Ar 1|Yes|True |
| 564 |
Disable all metadata updates, and keep existing metadata in streams untouched. |
| 565 |
.El |
| 566 |
.El |
| 567 |
.Ss Decoders block |
| 568 |
.Bl -tag -width -Ds |
| 569 |
.It Sy \&<decoders\ /\&> |
| 570 |
This element contains all decoder blocks as child elements. |
| 571 |
Its parent is the |
| 572 |
.Sy \&<ezstream\ /\&> |
| 573 |
element. |
| 574 |
.El |
| 575 |
.Ss Decoder block |
| 576 |
.Bl -tag -width -Ds |
| 577 |
.It Sy \&<decoder\ /\&> |
| 578 |
This element contains all configuration of a single decoder. |
| 579 |
Its parent is the |
| 580 |
.Sy \&<decoders\ /\&> |
| 581 |
element. |
| 582 |
.El |
| 583 |
.Ss Decoder configuration |
| 584 |
.Bl -tag -width -Ds |
| 585 |
.It Sy \&<name\ /\&> |
| 586 |
Set the name of the decoder configuration. |
| 587 |
.Pp |
| 588 |
The name is case-aware, but not case-sensitive. |
| 589 |
.Pp |
| 590 |
Default: |
| 591 |
.Ar default |
| 592 |
.It Sy \&<program\ /\&> |
| 593 |
.Pq Mandatory. |
| 594 |
Set the full command line to decode a media input file, represented by the |
| 595 |
.Sq @T@ |
| 596 |
placeholder, into a |
| 597 |
.Dq canonical internal format |
| 598 |
on standard output. |
| 599 |
.Pp |
| 600 |
The canonical format should be the same for all configured decoders, e.g. RAW |
| 601 |
audio with a specific signedness, bitrate, and samplerate that can be |
| 602 |
consumed by encoders. |
| 603 |
.Pp |
| 604 |
For exotic use cases, metadata placeholders may be used here. |
| 605 |
.Pp |
| 606 |
Example: |
| 607 |
.Dl \&<program\&>oggdec -R -o - @T@\&</program\&> |
| 608 |
.It Sy \&<file_ext\ /\&> |
| 609 |
.Pq Mandatory. |
| 610 |
Set a filename extension to be associated with this decoder. |
| 611 |
.Pp |
| 612 |
It is possible to specify more than one |
| 613 |
.Sy \&<file_ext\ /\&> |
| 614 |
element per decoder to associate more than one file extension to the same |
| 615 |
decoder. |
| 616 |
.Pp |
| 617 |
A filename extension can only be associated with one decoder. |
| 618 |
.El |
| 619 |
.Ss Encoders block |
| 620 |
.Bl -tag -width -Ds |
| 621 |
.It Sy \&<encoders\ /\&> |
| 622 |
This element contains all encoder blocks as child elements. |
| 623 |
Its parent is the |
| 624 |
.Sy \&<ezstream\ /\&> |
| 625 |
element. |
| 626 |
.El |
| 627 |
.Ss Encoder block |
| 628 |
.Bl -tag -width -Ds |
| 629 |
.It Sy \&<encoder\ /\&> |
| 630 |
This element contains all configuration of a single encoder. |
| 631 |
Its parent is the |
| 632 |
.Sy \&<encoders\ /\&> |
| 633 |
element. |
| 634 |
.El |
| 635 |
.Ss Encoder configuration |
| 636 |
.Bl -tag -width -Ds |
| 637 |
.It Sy \&<name\ /\&> |
| 638 |
.Pq Mandatory. |
| 639 |
Set the name of the encoder configuration. |
| 640 |
This may be referenced in a |
| 641 |
.Sy \&<stream\ /\&> |
| 642 |
block in case (re)encoding is desired. |
| 643 |
.Pp |
| 644 |
The name is case-aware, but not case-sensitive. |
| 645 |
.Pp |
| 646 |
Default: |
| 647 |
.Ar default |
| 648 |
.It Sy \&<format\ /\&> |
| 649 |
.Pq Mandatory. |
| 650 |
Stream format produced by this encoder. |
| 651 |
This must be one of the available stream formats as specified for the |
| 652 |
.Sy \&<stream\ /\&> |
| 653 |
block. |
| 654 |
.It Sy \&<program\ /\&> |
| 655 |
.Pq Mandatory. |
| 656 |
Set the full command line to encode the |
| 657 |
.Dq canonical internal format |
| 658 |
from standard input into a supported stream format on standard output. |
| 659 |
.Pp |
| 660 |
Metadata placeholders may be used here. |
| 661 |
.Pp |
| 662 |
Example: |
| 663 |
.Dl \&<program\&>oggenc -r -q 1.5 -t @M@ -\&</program\&> |
| 664 |
.El |
| 665 |
.Sh SCRIPTING |
| 666 |
The |
| 667 |
.Nm |
| 668 |
utility provides hooks for externally controlled playlist and metadata |
| 669 |
management. |
| 670 |
This is done by running external programs or scripts that need to behave in |
| 671 |
ways explained here. |
| 672 |
.Ss Common Rules |
| 673 |
.Bl -dash -compact |
| 674 |
.It |
| 675 |
The program must be an executable file. |
| 676 |
.It |
| 677 |
The program must write one line to standard output and exit. |
| 678 |
.It |
| 679 |
The program must not require arbitrary command line options to function. |
| 680 |
A wrapper script must be used if there is no other way. |
| 681 |
.El |
| 682 |
.Ss Playlist Programs |
| 683 |
.Bl -dash -compact |
| 684 |
.It |
| 685 |
The program must return only filenames, with one filename per execution. |
| 686 |
.It |
| 687 |
The program should not return an empty line unless |
| 688 |
.Nm |
| 689 |
is supposed to know that the end of the playlist has been reached. |
| 690 |
This is significant when the |
| 691 |
.Li \&<stream_once/\&> |
| 692 |
option is enabled. |
| 693 |
.El |
| 694 |
.Ss Metadata Programs |
| 695 |
.Bl -dash -compact |
| 696 |
.It |
| 697 |
The program must not return anything (just a newline character is okay) if it |
| 698 |
is called by |
| 699 |
.Nm |
| 700 |
with a command line argument that the program does not support. |
| 701 |
.It |
| 702 |
When called without command line arguments, the program should return a |
| 703 |
complete string that should be used for metadata. |
| 704 |
.It |
| 705 |
When called with the command line argument |
| 706 |
.Qq Li artist , |
| 707 |
the program should return only the artist information of the metadata. |
| 708 |
.Pq Optional. |
| 709 |
.It |
| 710 |
When called with the command line argument |
| 711 |
.Qq Li title , |
| 712 |
the program should return only the title information of the metadata. |
| 713 |
.Pq Optional. |
| 714 |
.It |
| 715 |
The supplied metadata must be encoded in UTF-8. |
| 716 |
.El |
| 717 |
.Sh METADATA |
| 718 |
The main tool for handling metadata with |
| 719 |
.Nm |
| 720 |
is placeholders in decoder and encoder commands that are replaced with real |
| 721 |
content during runtime. |
| 722 |
.Pp |
| 723 |
.Em Note: |
| 724 |
All placeholders are replaced with content enclosed in single quotes, with |
| 725 |
escaped single quote and backslash characters in between, so that |
| 726 |
interpretation by the shell does not occur. |
| 727 |
.Em \&Do not add any additional quoting! |
| 728 |
.Ss Metadata Placeholders |
| 729 |
.Bl -tag -width -Ds |
| 730 |
.It Sy @T@ |
| 731 |
Replaced with the media file name. |
| 732 |
Required in |
| 733 |
.Li /ezstream/decoders/decoder/program . |
| 734 |
Available in |
| 735 |
.Li /ezstream/metadata/format_str . |
| 736 |
.It Sy @M@ |
| 737 |
Replaced with a metadata string. |
| 738 |
.Pq See below for a detailed explanation. |
| 739 |
Available in |
| 740 |
.Li /ezstream/decoders/decoder/program |
| 741 |
and |
| 742 |
.Li /ezstream/encoders/encoder/program . |
| 743 |
.It Sy @a@ |
| 744 |
Replaced with the artist information. |
| 745 |
Available in |
| 746 |
.Li /ezstream/decoders/decoder/program , |
| 747 |
.Li /ezstream/encoders/encoder/program |
| 748 |
and |
| 749 |
.Li /ezstream/metadata/format_str . |
| 750 |
.It Sy @t@ |
| 751 |
Replaced with the title information. |
| 752 |
Available in |
| 753 |
.Li /ezstream/decoders/decoder/program , |
| 754 |
.Li /ezstream/encoders/encoder/program |
| 755 |
and |
| 756 |
.Li /ezstream/metadata/format_str . |
| 757 |
.It Sy @b@ |
| 758 |
Replaced with the album information. |
| 759 |
Available in |
| 760 |
.Li /ezstream/decoders/decoder/program , |
| 761 |
.Li /ezstream/encoders/encoder/program |
| 762 |
and |
| 763 |
.Li /ezstream/metadata/format_str . |
| 764 |
.It Sy @s@ |
| 765 |
Replaced with the string returned by |
| 766 |
.Li /ezstream/metadata/program |
| 767 |
when called without any command line arguments. |
| 768 |
Available only in |
| 769 |
.Li /ezstream/metadata/format_str . |
| 770 |
.El |
| 771 |
.Ss The @M@ Placeholder |
| 772 |
While all other placeholders are simply replaced with whatever data they are |
| 773 |
associated with, |
| 774 |
.Sq Li @M@ |
| 775 |
is context-sensitive. |
| 776 |
The logic used by |
| 777 |
.Nm |
| 778 |
is the following: |
| 779 |
.Bd -literal -offset indent |
| 780 |
If ('@M@ is present') |
| 781 |
If (/ezstream/metadata/program AND /ezstream/metadata/format_str) |
| 782 |
Replace with format string result. |
| 783 |
Else |
| 784 |
If (NOT /ezstream/metadata/program AND '@t@ is present') |
| 785 |
Replace with empty string. |
| 786 |
else |
| 787 |
Replace with generated metadata string. |
| 788 |
Endif |
| 789 |
Endif |
| 790 |
Endif |
| 791 |
.Ed |
| 792 |
.Pp |
| 793 |
The generated metadata string for |
| 794 |
.Sq Li @M@ |
| 795 |
is of the format |
| 796 |
.Dq Em Artist - Title , |
| 797 |
if both artist and title information is available. |
| 798 |
If one of the two is missing, the available one is displayed without a leading |
| 799 |
or trailing dash, e.g. just |
| 800 |
.Dq Em Artist . |
| 801 |
If neither artist nor title are available, the name of the media file \(em |
| 802 |
without its file extension \(em is used. |
| 803 |
.Ss Metadata Caveats |
| 804 |
It is possible to generate strange results with odd combinations of |
| 805 |
placeholders, external metadata programs and updates during runtime via |
| 806 |
.Sy SIGUSR2 . |
| 807 |
If things start to become just confusing, simplify. |
| 808 |
.Pp |
| 809 |
Metadata updates during runtime are done with a eccentric feature of libshout. |
| 810 |
Additional metadata information that is already present in the stream sent via |
| 811 |
.Nm |
| 812 |
is usually destroyed and replaced with the new data. |
| 813 |
It is not possible to properly discern between artist and title information, |
| 814 |
which means that anything set with the |
| 815 |
.Sy SIGUSR2 |
| 816 |
feature will continue to end up entirely in the |
| 817 |
.Qq Em Title |
| 818 |
field of a stream. |
| 819 |
.Pp |
| 820 |
Additional limitations in Icecast may apply as well, where one historic |
| 821 |
example is that of all possible Ogg-based streams, only Ogg Vorbis can have |
| 822 |
its metadata manipulated. |
| 823 |
.Pp |
| 824 |
The ID3v1 tags |
| 825 |
.Pq relevant when streaming in MP3 format |
| 826 |
do not specify any character encoding, so |
| 827 |
.Nm |
| 828 |
operates in a manner of |
| 829 |
.Dq best effort . |
| 830 |
In case of encoding issues, it may help to explicitly set a codeset to work |
| 831 |
with via the |
| 832 |
.Ev LC_CTYPE |
| 833 |
environment variable, as |
| 834 |
.Nm |
| 835 |
assumes ID3v1 tags to be in the user's current locale. |
| 836 |
Note that, even though support for different locales is provided by |
| 837 |
.Nm , |
| 838 |
Icecast itself and the listening clients also have a say in the matter. |
| 839 |
The only way to ensure consistent results with metadata in non-Ogg streams is |
| 840 |
to use only the characters available in the ISO-8859-1 codeset. |
| 841 |
.Pp |
| 842 |
External encoders may put additional, and possibly artificial, restrictions on |
| 843 |
valid characters in metadata. |
| 844 |
.Sh FILES |
| 845 |
.Bl -tag -width "!!EXAMPLES_DIR!!" -compact |
| 846 |
.It Pa !!EXAMPLES_DIR!! |
| 847 |
Directory containing example configuration files for various uses of |
| 848 |
.Nm , |
| 849 |
as well as example playlist and metadata scripts. |
| 850 |
.El |
| 851 |
.Sh SEE ALSO |
| 852 |
.Xr ezstream-cfgmigrate 1 , |
| 853 |
.Xr ezstream-file.sh 1 |
| 854 |
.Sh AUTHORS |
| 855 |
.Nm |
| 856 |
was written by: |
| 857 |
.Pp |
| 858 |
.An Ed Zaleski Aq [email protected] |
| 859 |
.An Moritz Grimm Aq [email protected] |
| 860 |
.Pp |
| 861 |
.An -nosplit |
| 862 |
This manual was written by |
| 863 |
.An Moritz Grimm . |