You can obtain the latest version of Naiocast at: http://www.naiocast.theartofweb.net
You can contact the author of Naiocast at: naiocast@theartofweb.net
You can report bugs of Naiocast at: naiocast@theartofweb.net
(You should have received a copy of the GNU General Public License along with Naiocast; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA)
Documentation Content:
Naiocast is a Web based streaming server, similar to SHOUTcast and Icecast. It currently supports MP3 audio streams only. It can be used to create an Internet Radio station or a privately running jukebox.
Naiocast is an open source project written in Perl and released under the GNU General Public License.
It requires neither expensive dedicated servers nor compilation on the target machine.
Naiocast, the project, includes:
It basically works by having naioSC sending stream audio from your computer to a Naiocast Server, over standard HTTP.
That is accomplished by using HTTP POST Method. It is kinda endless upload from your computer to a web server. As you probably know, you CAN upload stuff from your computer to a web server, although your computer is behind many different Routers or Proxies. That is because outbound port 80 (HTTP) is not blocked by default (else, you would not be able to surf the internet!). The following is a little http chunk that shows you how the stream is actually sent from your computer to a Naiocast Server:
- on your computer, where the stream is generated: (naioSC)
POST /cgi-bin/NCServer/receiver.cgi HTTP/1.0 Host: mywebhost.com User-Agent: Naiocast/1.8 Connection: close Content-Type: application/octet-stream Content-Length: 204800000 Naiocast Binary Header Raw Binary Data (stream)... Song Title Raw Binary Data (stream)... Song Title ...etc...
When a user reaches a Naiocast Server the user's computer begins to stream it while it is downloading it and playing it in the same time. The following is a little http chunk that shows you what actually happens when a user reaches a Naiocast Server:
- Media Player request: (Winamp)
GET /cgi-bin/NCServer/nph-play.cgi HTTP/1.1 Accept: */* Host: mywebhost.com User-Agent: WinampMPEG/5.53 Connection: Keep-Alive Icy-MetaData: 1
- Naiocast Server response:
ICY 200 OK icy-notice1:<BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR> icy-notice2:SHOUTcast Distributed Network Audio Server/posix v1.6.0rc2<BR> icy-name:My Web Radio ***LIVE*** icy-genre:Hip-Hop icy-url:http://www.mywebhost.com content-type:audio/mpeg icy-pub:0 icy-br:128 icy-metaint:32768 ID3v2.3.0 Header Raw Binary Data (stream)... Song Title Raw Binary Data (stream)... Song Title ...etc...
As you can see, it totally looks like a regular SHOUTcast server response! Also, ID3v2.3.0 header is embedded on top of the stream for those clients not supporting ICY tags.
In a nutshell, Naiocast is a workaround for not having a hosting provider that allows long running background processes (If we ignore tha CGI ones). Normally to solve this problem, you would just run "icecast" on your server, and that would be that. But if you cannot, you run Naiocast and it sneaks its processing time in by running "inside" of Apache.
Shoutcast has, or at least used to have, a 1 mb buffer. This means that it stores the last meg of the incoming stream and shoves it out to connecting clients. This is annoying because you cannot turn it off and you cannot (or at least could not) change the size. This meant about a 5-minute delay for 16kbps streams which are not so common now but used to be very common 5 or 6 years ago.
In Naiocast, you get the smallest audio latency ever because of its 8000 bytes buffer (up to a 5-second delay).
Broadcasting from one own computer would appeal to many casual users were they not to immediately encouter a Firewall/Router problem.
Broadcasting is almost always blocked until adjustments are made to the Firewall or the Router, causing many people to lose interest after they discover they have to deal with such a technical obstacle.
Naiocast lets you set up your Radio even if your network is behind many different Routers or Proxies.
Also, Naiocast allows you to transmit and listen in that network environment, typical in businesses, that use a Firewall to disable everything except web traffic, so no streaming is possible.
In order to listen to your stream, users connect to a Naiocast Server, not to your computer (where the stream is generated, anyway). Thus, your IP address is not revealed.
As you probably know, Nicecast By Rogue Amoeba [External link] is the easiest way to broadcast music from the Macintosh (OS X). Nicecast can help you create your own internet Radio station or allow access to your iTunes music library from anywhere in the world.
Nicecast creator have recently added support for both UpnP and NAT-PMP, which means many routers will be automatically configured to allow outside listeners. If your router supports UPnP or NAT-PMP, you can open up Nicecast and broadcast.
However, your router MAY NOT support UPnP or NAT-PMP. Also, your computer MAY be behind a blocking Firewall. That is where Naiocast comes in real handy. Users can listen to your Nicecast stream thru a Naiocast Server.
In order to accomplish that, naioSC and Nicecast must be in the same place. naioSC connects to Nicecast (broadcasting locally) and sends the stream to a Naiocast Server on the internet. Finally, users can listen to your Nicecast stream. That is quite the big benefit using Naiocast!
In order to run a Naiocast Server your web host (Linux) just needs Perl [External link] installed. Apache [External link] is recommended as the most robust and full-featured server for running a Naiocast Server.
Apache must support NPH (non parsing headers) [External link] in order to send ICY [External link] tags.
In order to run naioSC your computer needs Perl installed. Both Linux and Macintosh users can run naioSC from the terminal. Windows users must install ActivePerl by ActiveState [External link] for running Perl.
Most shared hosting providers do not allow long-running background processes for a reason, and although one is certainly free to circumvent that, It is not something Naiocast is meant to come out in favor of. If you need dedicated hosting, you need dedicated hosting, it is an ethics issue not a software issue. If you just cannot afford a dedicated server, then Naiocast is the (only) way to go.
The Naiocast Server is meant to be installed in the /cgi-bin directory of your web host; e.g., www.mywebhost.com/cgi-bin Yet, you are free to install it in the root level of your web host; e.g., www.mywebhost.com (in case you are new to owning a web host, the root level is in the public_html directory with most web hosts).
To get files to your web host, you will need to use some form of File Transfer Protocol (FTP), so be sure to have one ready before proceeding. Using your FTP client, make a connection to your web server and navigate to the chosen directory where you should install the Naiocast Server. Upload the "NCServer" folder to your web server. Make sure your FTP client is transferring using ASCII mode (pure text): http://courses.wccnet.edu/computer/mod/na36c.htm [External link] It is critical that you do not move, nor, rename, the "NCServer" folder or files inside it ("receiver.cgi", "nph-play.cgi"); doing so will cause the Naiocast Server not to function.
You must now set the file permission on the .cgi (Perl) files. Chmod files "receiver.cgi" and "nph-play.cgi" to 755 (-rwxr-xr-x) The following link might give you an idea how to go about doing that: http://www.perlservices.net/en/faq/cute_ftp.shtml#SIX [External link]
Launch a Web browser and open the "receiver.cgi" file (if you installed the Naiocast Server in the /cgi-bin directory it should be: www.mywebhost.com/cgi-bin/NCServer/receiver.cgi). Your Web browser should be showing this message: "Naiocast Server - Status: Active" If so, you have installed the Naiocast Server correctly. It is now ready to broadcast to listeners, while waiting for stream from your computer to come up.
You would normally start broadcasting with Naiocast by launching naioSC Perl script from the unix terminal (windows user must launch naioSC from the MS-DOS Prompt); but first, you must edit "config.txt" file in the "naioSC" folder. It is a plain text file looking like this:
## # NaioSC and Naiocast Server Configuration File ## ; (Stream Generator, running SHOUTcast or Icecast, ; where naioSC is going to grab audio from) ; ; ROGUE AMOEBA'S NICECAST (Built in Server) Address and Port Nicecast-Addr = 127.0.0.1 Nicecast-Port = 8000 ; Naiocast Server Address ; ; (This must be the absolute URL to the receiver.cgi file on the web host) NCServer-Addr = http://www.mywebhost.com/cgi-bin/NCServer/receiver.cgi NCServer-Pass = mypassword ; Naiocast Server Header Type ; ; 1 = SHOUTcast, 2 = Icecast NCServer-Header-Type = 1 ; Naiocast Server Max Listeners ; ; NCServer-Max-Listeners = 25
(*) You do not need to set the password file on the Naiocast Server on your own. First time you run naioSC, it will store the password you previously set in the "config.txt" file for you on the Naiocast Server in the "NCServer" folder in the "_pswd.txt" file (this file cannot be read by users). If you were to change you password in the "config.txt" file make sure to delete the "_pswd.txt" file on the Naiocast Server first.
Once you have saved the config file, you can launch Rogue Amoeba's Nicecast and start broadcasting. Then, in order to launch naioSC, open up the terminal and type in the following:
cd desktop/naiocast/naioSC perl naioSC.pl (or) sh naioSC.sh (It will automatically reconnect if the server drops the connection)
The following should appear in the terminal window:
MacMini-Famiglia-Vituzzi:~ Larry$ cd desktop/naiocast/naioSC MacMini-Famiglia-Vituzzi:~/desktop/naiocast/naioSC Larry$ perl naioSC.pl THEARTOFWEB Software 2001-2008 ( ) ( ( NAIOCAST ) ) ( ( ( ) ) ) ( ( ( ) ) ) ( ( ( naioSC - Sender Client ) ) ) ( ( ( ) ) ) ( ( ( ) ) ) ( ( Version 1.8.4 ) ) ( ) -> Running on: UNIX (darwin) -> Checking Naiocast Server at www.theartofweb.net on port 80 ... -> Response: Naiocast Server is Active -> Checking Audio Source at 127.0.0.1 on port 8000 ... -> Response: Icecast 2.3.1 -> Preparing for Broadcasting ... -> Sending Naiocast Binary Header (1017 Bytes) ... Sent! -> Relaying from 127.0.0.1 to www.theartofweb.net ... -> Broadcasting ... (you are on air!)
naioSC should be now redirecting (uploading) the Nicecast stream to the Naiocast Server; You are on air on the internet, live from your computer!
Users can reach your stream at:
http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi/listen.pls http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi/listen.xspf http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi/listen.m3u http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi/listen.ram http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi/listen.asx
They are not real files, though. They are created on the fly by the Naiocast Server.
When you visit internet Radio stations, they have a page that tells you how to link to them. Usually such links are to PLS files stored on the Radio stations' servers; e.g., your web host. These seem to be the preferred method of initiating a broadcast. Also, iTunes, Winamp, VLC media player, Real Player and Foobar can play PLS files. PLS files typically provide several URLs your audio-player can try to play the station. The Naiocast Server PLS file looks like this:
[playlist] NumberOfEntries=1 File1=http://www.mywebhost.com/cgi-bin/NCServer/nph-play.cgi Length=-1 Title1=My Web Radio Version=2
More Informations about ".pls", ".xspf", ".m3u" and ".ram" files:
http://en.wikipedia.org/wiki/PLS_(file_format) [External link]
http://en.wikipedia.org/wiki/XSPF [External link]
http://en.wikipedia.org/wiki/M3U [External link]
http://en.wikipedia.org/wiki/Advanced_Stream_Redirector [External link]
http://en.wikipedia.org/wiki/RealAudio [External link]
Naiocast ("The Software") is provided as is. THEARTOFWEB Software ("The Author") is not responsible for any damage to the user's computer system or data and in no event will The Author, its officers, directors, employees or agents be responsible to the user for any consequential, incidental, or indirect damages (including damages for loss of business profits, business interruption, lost of business information, and the like) arising out of the use or inability to use the The Software, even if The Author has been advised of the possibility of such damages. Because some states do not allow the exclusion or limitation of liability for consequential or incidental damages, the above limitations may not apply to you.
THEARTOFWEB Software is not responsible for the content of any broadcast served with The Software. We have neither the resources, nor the desire, to attempt to censor the use of our products, and therefore leave legal responsibility with our users. By broadcasting with The Software, the user assumes all legal responsibilities including any related to potential copyright infringement, and waives the right to bring litigation against THEARTOFWEB Software.
Yes, absolutely. Is it legal to broadcast copyrighted audio? Yes, if done properly. For full information, please see this link http://www.copyright.gov/carp/webcasting_rates_final.html [External link] , which explains the fees associated with webcasting and the reasoning behind them (US only). Laws in your country may vary. THEARTOFWEB Software accepts no responsibility for the content of any broadcast served with Naiocast. We have neither the resources, nor the desire, to attempt to censor the use of our products, and therefore leave legal responsibility with our users. The user assumes all legal responsibilities including any related to potential copyright infringement. It is the burden of the user to make sure their broadcast is in compliance with the laws of his/her own country.
Musical compositions and sound recordings are creative works that are protected by the copyright laws of the United States (title 17, U.S. Code) and other countries. Under U.S. law, the owner of a copyright has the exclusive right to (and to authorize others to) reproduce the work, use parts of the work in a new creation, distribute the work in whole or in part, and to publicly display or perform the work (including on web pages and through webcasting). With few exceptions, it is illegal to reproduce, distribute or broadcast a sound recording without the permission of the copyright owner. It is your responsibility to comply with the copyright laws of the United States and other countries in which you broadcast and to pay all applicable royalties to the copyright owners when you become a webcaster. Keep in mind that Naiocast Radio is available internationally. There have been recent amendments to the copyright law regarding webcasting of sound recordings. These new provisions allow webcasting under the terms of a statutory license, as a way to help webcasters get permission without having to go to each sound recording's owner. The statutory license, however, has strict requirements that you must follow. Some of these requirements include the payment of license fees, limitations on the number of songs from the same album or artist that may be played in a three hour period (called the sound recording performance complement); a prohibition on publishing advance playlists; and a requirement to identify the song, artist and album on the website. There are other requirements as well. The Recording Industry Association of America provides quite a bit of information on copyright law as it applies to webcasting, and both ASCAP and BMI have created license agreements that they are willing to grant to webcasters that they believe conform to the provisions of the new copyright rules for webcasting. For additional information on the statutory license and other aspects of webcasting, please visit the following sites:
http://www.copyright.gov/ [External link]
http://www.ascap.com/index.html [External link]
http://www.ascap.com/weblicense/webintro.html [External link]
http://www.bmi.com/ [External link]
http://www.bmi.com/iama/webcaster/index.asp [External link]
If you are uncertain about what you can and cannot do, you must check with the copyright owner or the owner's representatives (such as through the organizations above), or consult a lawyer.
Software Engineer:
Giangaetano Vituzzi [External link] » THEARTOFWEB Software [External link]
Documentation:
This documentation was written by Giangaetano Vituzzi. He takes all of the credit, and none of the blame.
Special Thanks:
Richard Clamp - dmap_pack/unpack Perl subroutine.
Ilya Zakharevich - MP3::Tag::ID3v2 Perl Module.
Gisle Aas - LWP / The World-Wide Web library for Perl.
Fellows at comp.lang.misc.perl and it.comp.lang.perl
My dad - If he let me unblock inbound port 8000, I would have not come up with Naiocast...