Cheap VPS & Xen Server


Residential Proxy Network - Hourly & Monthly Packages

Apple’s Darwin Streaming Server On Centos 5.2


Introduction

This tutorial will run you through the installation, configuration and preparation of media for Apple’s Darwin QuickTime Streaming Server on Centos/RHEL 5.2. Darwin QuickTime Streaming Server is capable of serving H.264 and mpeg4 file formats via the RTP/RTSP streaming protocols.

Prerequisites

  1. CentOS 5.2 x86 installed
  2. Development tools must be installed (can be installed after install with

    yum groupinstall “Development Tools”

    )

  3. Static IP address and hostname; I used 192.168.0.10 and example.org as my hostname
  4. Disable firewall and SELinux (configure later)

Installing Darwin Streaming Server 6.0.3

Currently there are no official binary packages of the current version so we will grab a source RPM. Apple’s current source package dose not compile on a Linux system without being patched. Enter the following command by command!

su –
wget http://www.abrahamsson.com/DarwinStreamingServer-6.0.3-2.src.rpm
rpm -i DarwinStreamingServer-6.0.3-2.src.rpm
cd /usr/src/redhat/SPECS/
rpmbuild -bb DarwinStreamingServer.spec
cd /usr/src/redhat/RPMS/i386/
yum –y install perl-Net-SSLeay
rpm -U DarwinStreamingServer*

When installing the RPMs the install hangs when trying to start Darwin so wait a few minutes then open another terminal session using Alt + F2 and run the following as root:

killall -9 DarwinStreamingServer

To change the administrator account from the default password of “password” use the following command:

qtpasswd administrator

So DSS starts at boot up run the following:

chkconfig –level 345 dss on

 

Configuring Darwin Streaming Server

Now open a browser and point the address to http://yourserverip:1220 and log in with the username administrator and the password you choose when running qtpasswd.

login

After logging in you will be asked for an mp3 broadcast password:

mp3passwd

ssloption

The next question you will be asked if you want to stream on port 80. Do not use this option if you are planning to run or are running a web server on the same machine.

streamon80

Next you will be asked to specify a path where your media is stored; leave this as the default for now. The current directory has some sample files that are useful for testing your installation.

path

You should now see the main administrator page as shown below:

mainadmin

You can now test your install by opening QuickTime on a client (either Windows or the Mac) and using one of the sample files installed by Darwin.

File > Open URL and type rtsp://yourip/sample_300kbit.mov

rtsp

The following video should be streamed with sound:

quicktimetest

Encoding Video with QuickTime Pro for use with DSS

Before a video can be streamed with DSS the file must be hinted and then exported to the server. Without the video being hinted streaming the file can be unpredictable and suffer a loss of sound. I bought QuickTime pro for £20 GBP, however the same process can be achieved using ffmpeg and mpeg4ip described in the next section.

Open the video in QuickTime Pro then go to File > Export and select Movie to hinted movie shown below.

exportas

Click options and select “Optimize hints for Server (creates larger file)”:

exportoptions

Save the file and upload the file to server. Move the file to /var/dss/movies; open QuickTime and select File > Open URL and type rtsp://192.168.0.110/movie.mov and the file should stream.

expotedplay

Encoding Video with ffmpeg and mpeg4ip

Encoding Video with ffmpeg and mpeg4ip seems to work just as well and is free. ffmpeg has far more features and I prefer using this method so I can script the encoding at night. It may be recommended to encode on a seprate server with less load depending on your situation.

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
yum install ffmpeg –enable rpmforge
rpm -e faad2 –nodeps
rpm -e faac –nodeps
yum install SDL-devel
wget http://garr.dl.sourceforge.net/sourceforge/mpeg4ip/mpeg4ip-1.5.0.1.tar.gz
tar xzvf mpeg4ip-1.5.0.1.tar.gz
cd mpeg4ip-1.5.0.1
./bootstrap –disable-mp4live –disable-player
make
make install

To encode a video using ffmpeg and mp4creator use the following commands (my file was an mpeg2 called movie.mpg captured from a TV card):

ffmpeg -i movie.mpg -b 300000 -s 320×240 -vcodec mpeg4 -acodec aac movie.mp4
mp4creator -optimize movie.mp4
mp4creator -hint=1 movie.mp4
mp4creator -hint=2 movie.mp4
mp4creator -list movie.mp4

To take a thumbnaill of your video for your webpage, issue the following command:

ffmpeg -y -an -i movie.mp4 -v 0 -ss starttime -t 0.001 -f image2 “thumbnail.jpg”

Move the newly created mpeg4 file to /var/dss/movies and open QuickTime; select File > Open URL and type rtsp://192.168.0.110/movie.mp4 and the file should stream.

 

References

Compiling Darwin Streaming Server for Centos 5 x86-64


http://ffmpeg.mplayerhq.hu/ffmpeg-doc.html
http://mpeg4ip.sourceforge.net/documentation/index.php

Comments

comments