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 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478
|
#!/usr/bin/perl -w
# run this document through perl to check its syntax
use Pod::Checker;
podchecker(\*DATA);
__END__
=pod
=head1 NAME
mod_mp3 - FAQ for the Apache mod_mp3 streaming module
=head1 So what is mod_mp3?
This turns apache into your basic RIAA hating, but every college student loving mp3 streaming server. It can do a number of things. It can play from a list of files, either straight through or randomly. It can be used as a handler if you just have mp3s or ogg files on your server and you want to stream them with the corret headers. It can also be used to cache mp3's into memory and have the server operate entirely from memory. Enjoy, groove, mp3s not included.
=head1 Where do I get it from?
You can get it from either http://software.tangent.org/download/ via the web or ftp://www.tangent.org/pub/apache/ via ftp.
=head1 What sort of license does it have?
You are pretty much free to use it as you please. Check out the License file with the distribution for more details. (Its very BSD like)
=head1 How can I make suggestions for it?
Send email to brian@tangent.org
=head1 How can I report a bug?
You are better off going to http://media.tangent.org/submit.pl. Just submit a bug. This works best right now.
=head1 How do I install it?
Read the INSTALL file that comes along with the module.
=head1 How do I use it?
Listen 8000
<VirtualHost www.example.com:8000>
ServerName www.exampe.com
MP3Engine On
MP3CastName "Brian's Tunes"
MP3Genre "Much, nutty"
MP3 /export/mp3
MP3 /tmp/madonna.mp3
MP3 /tmp/cows.mp3
MP3Random On
#Increase this if your connections are timing out
Timeout 1200
ErrorLog /usr/local/apache/logs/music_error_log
</VirtualHost>
Make sure you also enable Listen for port 80 if you are also running a regular webserver. Also, keep in mind that while I set mine up with VirtualHosts, you could just as easily use Directory, or Location directives. You could run as many streams out of a single host as you want.
=head1 So what are the directives?
=over 4
=item MP3
Either a filename or directory filled with mp3s (it recurses into subdirectories)
=item MP3Engine
Turn on the streaming mp3 server.
=item MP3CastName
Name of your server
=item MP3Genre
Genre that will be sent to the client
=item MP3Random
Tells mod_mp3 to randomly dish out music
=item MP3Stream
I am not useable yet.
=item MP3Loop
Causes requests to loop thrugh the music requested indefinetly.
=item MP3LimitPlayConnections
Limit the number of play requests possible.
=item MP3Log
Logs transaction ID of the player, md5sum of mp3 file, and song title, example: MP3Log /usr/local/apache/logs/mp3stream_log
=item MP3ReloadRequest
When enabled this causes mod_mp3 to reload all of playlists/files/directories for each request.
=item MP3Playlist
This takes a file filled with mp3 filenames and loads the filename into mod_cgi list (most MP3 player's playlists are in this format)
=item MP3Cache
Tells mod_mp3 to cache all of the files to memory instead of getting them at request time from disk. This can take up a lot of memory but is quite a bit faster if you are expecting a large load. This directive must come first if used.
=item MP3DefaultOperation
You can use this to send a different default output than just straight MP3. The different options are: rss, m3u, m3u2, pls, pls2, list, select. It will also take a second option with can be a regular expression to match browsers with.
=item MP3Allow
When turned on, only files that are matched with a regular expression given with this directive will load. So "MP3Allow *.mp3" would only load file that ended with .mp3.
=item MP3Deny
Same as MP3Allow but it denies files by filenames.
=item MP3DispatchAgent
Tells ModMP3 to use a specific dispatch agent (internal, mysql, playlist, pgsql)
=item MP3MySQLConnectInfo
If you are using the mysql Dispatch agent. specify the hostname,username,password #for the database to connect to. (MP3MySQLConnectInfo "localhost" "USERNAME" "PASSWORD").
=item MP3MySQLInfo
Database and Table info (MP3MySQLInfo "DATABASENAME" "TABLENAME")
=item MP3MySQLTokenTable
Table to use to find tokens.
=item MP3PgConnectInfo
If you are using the mysql Dispatch agent. specify the hostname,username,password #for the database to connect to. (MP3PgConnectInfo "localhost" "USERNAME" "PASSWORD").
=item MP3PgInfo
Database and Table info (MP3PgInfo "DATABASENAME" "TABLENAME")
=item MP3PgTokenTable
Table to use to find tokens.
=back
=head1 XMMS is just sitting here doing nothing.
Look at the example, you probably don't have your virtualhost defined correctly.
=head1 What protocols are being supported?
Whatever I can get my hands on. Right now that means just
Icecast and Shoutcast. Shout is full supported and ice is
coming along nicely. We can also do the headers for Ogg files.
=head1 Can I write an interface for it?
Yes. The idea is to let other people write the interface for mod_mp3. To enable this a couple of hooks have been added. You can find a list of the contents to a server by doing a http://example.com:8000/?op=rss. If you want, you can this grab songs based on the ID of the song (which is the filename MD5'ed). An examle is: http://avenger.tangent.org:8080/?op=play&song=475c47c405940fde1737e8bc85f65760&song=7777e58678fcc5fcc96d449b4951ebd1
This was just a start, there is a mailing list for the interface, as I get an idea about what people want, more will be added
=head1 What are the different flags I can give op ?
=over 4
=item ?op=select
lets you search, but also lists ALL the songs, on the bottom of the list, you can selct individual songs, and play them.. (make your own playlist, search for songs, etc).
=item ?op=rdf
listing in RDF format Version 1.0
=item ?op=rss
listing in RSS format Version 0.91
=item ?op=m3u
Makes a playlist in m3u format, and sends it to you, if you have the proper settings with mime-types this would/could load up winamp for you with the entire collectionas a playlist.
=item ?op=m3u2
different format of the playlist.
=item ?op=pls
Winamp playlist
=item ?op=pls2
Another playlist format
=item ?op=list
List in RSS version 0.91
=item ?op=play
Plays songs randomly.
=item ?op=reload
Tells the server to reload all of its playlists.
=item ?op=mbm
Displays the songs in Musicbrainz DTD
=item ?op=index
Shows the index page, if you have one set in your document root for this host. (NOTE, index can be replaced by anything that is not mentioned above, i.e it could be ?op=blowupafghasnistan).
=back
=head1 Will this work with Apple's OSX?
Several people have written in and said that it will. If I get a binary I will put it up for people to download and use. Which has been happening. Keep in mind though that until someone sends me a copy of OSX (I own a Mac) I won't be actively testing it.
=head1 So what is up with Apple's Itunes?
In theory it supports the shout protocol, but in reality it seems to ignore file names found in the stream.
=head1 So what are streams?
A cute idea. Look through the mail archives for the mailing lists for more info. This is not completly supported yet.
=head1 Will this work with SSL?
According to people on the mailing list, it will work just fine. Trick is you need a player that can do SSL. You can either do this by tunneling or I am told by using IE with some native player.
=head1 My build is dieing with apxs=255?
You are not going to like the answer to this. Basically at some point you have either installed multiple copies of Apache or somehow munged your current copy. Do this: "apxs -g -n example; cd example; make". Did that work? If it didn't your copy of Apache is munged.
=head1 So what about Vorbis support?
Go look at http://media.tangent.org/article.pl?sid=01/05/04/1547242
=head1 I am getting a sync error from the client, what does that mean?
Check that you are not accidently loading any files that may not be mp3's. That is the normal culprit. You can make sure you are only loading mp3 files by using the MP3Allow directive (MP3Allow *.mp3).
=head1 Apache is loading very slowly.
You have some crazy sized music collection I take it? And you are just point Apache at the directory and waiting for it to start right? Well, it will, but it is going to take a while. I would suggest using a playlist instead. You can generate one with "find /export/mp3 | grep -i "\.mp3" > /tmp/playlist"
=head1 What is this RSS thing, and where can I find a perl/php class to handle it?
You can find out information on RSS at <A HREF="">. There is a perl class on CPAN called XML::RSS that will parse RSS. For PHP look at this http://nwow.org/rssparse-0.4.tar.gz
=head1 What does all the info in the logs mean ?
Example:
[16/Jul/2001:22:36:19 -0400] fc62362bf4cd1a8602bbf170409b8d04 7652fcbd1077f4ffa58ba36d10c8d9d4
Explanation:
=over 4
=item [16/Jul/2001:22:36:19 -0400]
the stuff in the [] is pretty self explanatory.
=item fc62362bf4cd1a8602bbf170409b8d04
The second string is the transaction id of the player
=item 7652fcbd1077f4ffa58ba36d10c8d9d4
The third string is the MD5 of the file being streamed for that player
=item Pharoahs
The fourth string is the ID3 Name or filename if there is no id3 tag for that file.
=back
=head1 Do I have to use a virtual host for this?
No, not at all. You can put directives in the root of your httpd.conf or even put them in a directory (you could also technically put them in a .htaccess file, but that would be pretty horrible for performance).
=head1 What is a dispatch?
A dispatch is an internal handler. It is what gets the data to Apache to send. The default handler is a simple load the data into memory and use it sort of thing. There is also currently a MySQL dispatch, Postgres dispatch, and a playlist dispatch. If you are going to do large scale broadcasting the MySQL dispatch is probably what you want. Also, if you want to reload without restarting Apache, then any dispatch other then the internal dispatch is what you want. If you lack a database, the playlist dispatch is probably the way to grow. It lack token support like the MySQL and Postgres dispatch though.
=head1 How do I use the MySQL dispatch?
First, you need to have MySQL installed. Second you need to tell configure to use mysql (./configure --with-mysql). Third you need to create a database to hold the table. There is a sample schema in the support directory. mod_mp3 will load the files for you if you want, it does this with the MP3 directive (also with playlists), or you can choose to load them by hand. As long as you use similair names for the columns you will be ok. You will need to call MP3DispatchAgent and MP3MySQLConnectInfo to feed the right information to Apache so that it can connect to you DB.
=head1 How do I use the Postgres dispatch?
First, you need to have Postgres installed. Second you need to tell configure to use mysql (./configure --with-postgres). Third you need to create a database to hold the table. There is a sample schema in the support directory. mod_mp3 will load the files for you if you want, it does this with the MP3 directive (also with playlists), or you can choose to load them by hand. As long as you use similair names for the columns you will be ok. You will need to call MP3DispatchAgent and MP3PostgresConnectInfo to feed the right information to Apache so that it can connect to you DB. You should realize that this is quite alpha at this point and misses many of the features of the MySQL dispatch. Patches to fix this of course are encouraged.
=head1 How do I use the Playlist dispatch?
This has to be one of the easiest methods to use mod_mp3. Use the playlist directive to specify a playlist to use and you are in business. Updating it will update the available files (and may cause clients to reconnect at the next song). No token support is currently provided by this dispatch.
=head1 I am trying to use the MySQL dispatch, but Apache won't load
This is a symptom of having PHP with MySQL support and ModMP3 with MySQL support built-in. The fix for this is to recompile PHP. The PHP configure script warns you about this. The exact message is:
+--------------------------------------------------------------------+
| *** WARNING *** |
| |
| You chose to compile PHP with the built-in MySQL support. If you |
| are compiling a server module, and intend to use other server |
| modules that also use MySQL (e.g, mod_auth_mysql, PHP 3.0, |
| mod_perl) you must NOT rely on PHP's built-in MySQL support, and |
| instead build it with your local MySQL support files, by adding |
| --with-mysql=/path/to/mysql to your configure line. |
If you installed PHP as an RPM, please let us know what you did to fix this problem.
=head1 I just want to have Apache stream files while mixing them with other files, can I do this?
Yep! Just do a AddHandler mp3-file *.mp3 or AddHandler ogg-handler *.ogg to your httpd.conf and you are good to go.
=head1 What are tokens?
Tokens are like cookies that are specified in the URL. For example:
http://example.com:8000/?op=play&token=rock
The above would play any file that is associated with the "rock" token. For more information on this you should send email to the developers list.
=head1 I am using the MySQL dispatch but no data is being loaded, what is up?
You probably have called MP3 or MP3Playlist before you specified the MySQL information. Don't do that, it will not work :) See the sample MySQL file in the support directory.
=head1 So you say you are having bandwidth problems?
Since you have bandwidth issues, it is time to turn on compression. Actually, it is time to use LAME to compress your mp3 files even more than they are now, before transit across your broadband network.
Look at it this way:
You have 100 kilo bits per second of upload capability. You have to consider the protocol overhead or minus 10% or 15%. You have a 128 Kbit quality MP3 you want to stream. The calculation looks something like this:
((100,000 - 10%) / 128000) = 0.703125
This means you get 0.7 of your connection dedicated for music (aka 70% music, 30% pops & static).
To fix this you have to lower the bitrate of your mp3 stream, and try the calculation above again until you get a whole number. This means you need to use the mod_mp3 MP3Encoder directive to lower your mp3 bitrate while they are on their way out the door:
MP3Encoder "/usr/local/bin/lame -q 2 -b 48 --silent % -"
This solution imposes a penalty on your system resources as long as your streaming music with LAME. This is not something you want to use on a multi-user setup like Ampache, or Mummi. As long as your doing this for your own personal, and don't have to share the system, it shouldn't be a problem. =)
=head1 Will this work on any flavor of windows? How portable is it?
There is no reason why this should not compile under windows. Currently no one has ever provided the instructions on how to do this though. In fact any system that can compile Apache and has SYSV shared memory should be able to compile this software.
=head1 Where can I find a directory server that is mod_mp3 aware?
Vidyut Luther has made a directory server which works with Icecast servers and mod_mp3. You can find out more information on it here : <A HREF="http://yp.modmp3.net/">yp.modmp3.net</A>
=head1 So what is the future?
World domination? Complete online server that would make any radio station drool. Support for more than just mp3. You name it, I am open to ideas. The big thing for me is that I want to give people a voice. Just like apache opened up the web for anyone to publish thoughts and ideas that they have, I want this module to extend that same philosphy to the online airwaves. The FCC is never going to make community radio a reality, hopefully this will give people an alternative. Ok, now that that soap box bit is over, the idea is to create a server which can be controlled by other applications. Let people write good interfaces and not worry about the actual protocols and methods of delivery.
=head1 Appendix A. MP3 httpd.conf Examples
=head2 Simple
Listen 8000
<VirtualHost avenger.tangent.org:8000>
ServerName avenger.tangent.org
MP3Engine On
MP3CastName "Brian's Tunes"
MP3Genre "Much, nutty"
MP3 /export/mp3
MP3DefaultOperation select
Timeout 1200
ErrorLog /usr/local/apache/logs/music_error_log
</VirtualHost>
=head2 Ogg
Listen 8001
<VirtualHost avenger.tangent.org:8001>
ServerName avenger.tangent.org
MP3Engine On
MP3CastName "Brian's Tunes"
MP3Genre "Much, nutty"
MP3 /export/ogg
MP3MimeType audio/x-ogg
ErrorLog /usr/local/apache/logs/music_error_log
Timeout 1200
</VirtualHost>
=head2 Advanced
# The mod_mp3 virtual host.
# Do not just make-up any name here for the ServerName directive.
# Use real, valid, host names from the DNS.
# Increase the timeout if you have large length mpeg files.
# Timeout of zero means no timeout.
<VirtualHost 123.456.789.101>
ServerName music.example.com
ServerAdmin webmaster@example.com
ErrorLog /var/log/httpd-error.log
SetEnvIfNoCase User-Agent mozilla is_a_browser
# Toggle the MP3 module On/Off.
MP3Engine On
# Control the number of connections to mod_mp3.
# Upload speed divided by bitrate is the rule of thumb.
# example with DSL 768/768 line, and mp3 w/128 bitrate:
# floor((768000 - 10%) / 128000) = 5
# Remember that about 5% to 15% of your bandwidth is consumed by overhead.
# and since 90% of a stream is not so good, we round-down, and get five.
# Your mileage may vary.
MP3LimitPlayConnections 2
# Name this radio station.
MP3CastName "mod_mp3 radio"
# Give your Station a format type (aka Classical, Electronic, rock'n'roll, etc.).
MP3Genre "various"
# Multiple MP3 directives are allowed.
# Rule of thumb dictates you not use the MP3 direcctive when using a MP3Playlist.
MP3 "/data/mp3z"
# This can increase the performance on large collections, but not dramatically.
# It is a good idea to avoid using this with the MP3 directive,
# unless you know what your doing.
#MP3Playlist /data/playlist.m3u
# Toggle the stream mode On/Off
# This doens't work at the moment.
# When enabled, you should comment-out any MP3, or MP3Playlist directives.
#MP3Stream On
# Randomize (aka shuffle) the mod_mp3 internal playlist for playback.
#MP3Random On
</VirtualHost>
=head2 MySQL Support
<VirtualHost 123.123.78.90>
ServerName mp3s.yourdomain.com
ServerAdmin webmaster@yourdomain.com
CustomLog /www/modmp3/logs/access_log combined
#Turn the ModMp3 engine ON.
MP3Engine On
#The name of your broadcast.
MP3CastName "Linuxpowered Radio"
#What dispatch agent you want to use
MP3DispatchAgent mysql
#If the Agent is Mysql, specify the hostname,username,password
#for the database to connect to.
MP3MySQLConnectInfo "localhost" "USERNAME" "PASSWORD"
#Now specify the database and tablename where the songs are stored.
MP3MySQLInfo "DATABASENAME" "TABLENAME"
# Specify the table for tokens
MP3MySQLTokenTable "tokens"
#Specify where the MP3's are. This must come after the MySQL directives
MP3 "/www/modmp3/songs"
MP3Genre "various"
MP3Random On
MP3Log /www/modmp3/logs/mp3_log
MP3Allow *.mp3
</VirtualHost>
=cut
|