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.
- CentOS 5.2 x86 installed
- Development tools must be installed (can be installed after install with
yum groupinstall “Development Tools”
- Static IP address and hostname; I used 192.168.0.10 and example.org as my hostname
- 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!
rpm -i DarwinStreamingServer-6.0.3-2.src.rpm
rpmbuild -bb DarwinStreamingServer.spec
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:
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.
After logging in you will be asked for an mp3 broadcast password:
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.
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.
You should now see the main administrator page as shown below:
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
The following video should be streamed with sound:
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.
Click options and select “Optimize hints for Server (creates larger file)”:
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.
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
tar xzvf mpeg4ip-22.214.171.124.tar.gz
./bootstrap –disable-mp4live –disable-player
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.