These days, most people have at least one computer and a large collection of media files. The conventional practice for most people has always been to have redundant copies of their media collection on their various computers. While this system technically works, it is highly inefficient and creates the unnecessary task of keeping the media collection on each computer synchronized and up-to-date with the others. A far better solution is to keep all the media on one computer and stream it as needed to the other machines over the network.
Streaming technology has been around for over a decade and is something that most people are at least a little familiar with. (Youtube uses streaming flash-based video to work) In the past, playing large files over the internet was usually pointless due to the fact that the software of the time required the whole file to download (often on slow connections) before the media could be played. With streaming media, the remainder of a file is fetched as the first part it is being played, so there is no need to wait to get the whole thing before watching it. The video quality on early streaming media was often quite bad, (a trade-off between quality and speed was necessary when most people were stuck on dial-up) but with the near-ubiquitous availability of broadband in most urban and suburb areas today, high-quality streaming media has finally become practical.
We have assembled this guide to help you set up a cross-platform media streaming service using a Linux computer as a server. With our guide, you will be able to stream media to any other computer you own. Other guides on the subject discuss how to set up a Samba-based solution, but we feel that our solution is simpler and easier since you only have to install and configure one program instead of several. For this purpose, we use GNUMP3d . GNUMP3d is a program that makes media available through a web-based interface. Instead of using the Samba protocol, GNUMP3d uses ordinary HTTP to get the job done.
This guide assumes that you have a Linux-based computer available and are ready to begin the installation process immediately. If this is not the case, you should set up a Linux-based environment to use. It doesn't really matter which distro you are using, but for the sake of simplicity, we are going to use Ubuntu in this demonstration since Ubuntu has a large following and the needed software is already in the repositories. If your distro does not have a pre-compiled package of GNUMP3d available, you will need to compile it yourself.
What you will need:
1. A web browser
2. Root or superuser access to the Linux system that is to be the media server
3. Access to the Ubuntu repositories through apt-get (or the GNUMP3d source code and any necessary compile tools)
5. Some music and/or video files to test with
Installation of GNUMP3d is fairly simple and involves only a few steps. In this guide, we are going to assume that your movies and music are stored in your Linux home directory with the folder names Movies and Music , respectively.
1. Open a terminal. (run xterm or your favorite terminal application)
2. Run sudo apt-get install gnump3d if you are using Ubuntu 8.04 or earlier. If you are using 8.10, you have to install the package manually . If you are building from source, head on to the next step.
3. Provide your sudo or root password and let the package manager install GNUMP3d. If you are building from source, download the source tarball from the GNUMP3d website, untar, and compile it.
4. The installation process will create a folder called music in the system's var folder. Navigate to that folder by running cd /var/music
5. The time has come to populate the music folder with your media library. Although you could copy your movies and music folders to /var/music, there is a far better way. Linux has the ability to create symbolic links (symlinks) to other folders. The system is able to seamlessly follow these links. By creating symlinks to the Music and Movie folders in your home directory, you can leave your media library where it is and still make it available for streaming.
Since you did not personally create the /var/music folder, you are not able to copy files to it with your own user account. For this reason, you have to use sudo to make the links. Run sudo ln -s ~/Movies Movies and sudo ln -s ~/Music Music to make shortcuts to your music and movie folders. From that point on, anytime you add a file to your media collection, the file will automatically be made available for streaming.
Once you have your media library linked to the stream folder, configuration is complete. Your collection is available through a web interface. To access it, go to http://YOUR_SERVER_NETWORK_ADDRESS:8888 (for example, if your server is on 192.168.2.3, you should go to http://192.168.2.3:8888) Depending on how your media collection is organized, you are able to steam entire folders or individual files. (m3u playlist files are generated for each file or folder) Depending on your media player settings, you will be able to play a stream by either clicking on a file or folder or by copying the link location for the files/folders you want to play. (In Firefox, right-click on a media link and select copy link location )
Different players work better for different kinds of files. On Windows, we've had the best luck with Winamp for music and VLC Media Player for video. Although Winamp and Windows Media player were able to play MP3 and OGG Vorbis audio streams perfectly, they had trouble with playing streaming FLAC (Free Lossless Audio Codec) files. Totem Media Player and Amarok had no difficulty with any type of audio or video file we tested them with on Linux, although during our test the video sync was slightly off on Totem but not on VLC.
While GNUMP3d can stream many types of media files, what you can actually play and your playback experience is largely determined by what your media player can handle and the shortcomings of that particular player. Officially, GNUMP3d is for MP3 and OGG Vorbis files, but we noticed that the general rule with GNUMP3d is that if you can play it, you can probably stream it.
Once your streaming media server is running, there are several other factors that may impact its effectiveness. Streaming media is best when used over a fast connection, so high-quality video and large FLAC files will work very well over a fast LAN with several megabits of bandwidth, but will be much worse over the internet. The reason for this is that even though you may have broadband and have port forwarding configured to allow you to stream media over the internet from your computer, your upload speed will be the ultimate deciding factor on how fast the stream goes. ISPs usually only allow slow upload speeds because providing you with upstream bandwidth costs them much more than downstream bandwidth.
If you can only upload at less than 100 kbs, you are going to be looking at a huge bottleneck if you try to stream high quality files over the internet. In this way, you will probably experience constant buffering if you try to stream some FLAC music from your home computer when you're at work. (lower-quality MP3 will probably work fine in such a situation) However, your LAN will transmit data as fast as the hardware is capable of, so streaming high-quality media is a whole different story when you're at home.
You should avoid streaming media files that are protected (or crippled, depending on how you look at it) with Digital Rights Management. DRM exists to limit how you can use the media you've purchased, and streaming may not be one of the “approved” uses. If you try to stream a DRMed file, it may refuse to play. For this reason, you should steer clear of DRMed media whenever possible, since you can never really own it. Many DRMed music files are often of lower audio quality than the same song would be on CD. For this reason, we recommend that you buy CDs instead of digital downloads whenever possible, since you can rip CDs to the format and quality you want.