Darwin Streaming Server
From Streaming 411
Darwin Streaming Server is Apple's open-source streaming server. DSS is at the core of Apple's commercial QuickTime Streaming Server.
Contents |
Installation
CentOS 4.x
The following works for me under CentOS-4.x on an i686 machine and should also work for RHEL-4.x. Distributions with gcc 4, and/or x64 machines will have to edit the Buildit script under the top directory to specify correct compiler and linker to use, E.G.: gcc32 from the compat-gcc-32 package on Fedora Core 4.
1. Check out latest version:
export CVS_RSH=ssh export CVSROOT=:ext:apsl@anoncvs.opensource.apple.com:/cvs/apsl cd /usr/local/src sudo mkdir DSS sudo chown -R yourusername.yourusername DSS cd DSS cvs co StreamingServer (password will be: "yourappleusername:password")
2. Copy this Media:OSHeaders-1.0-pointersizeargfix.patch under /usr/local/src/StreamingServer
3. Patch:
cd /usr/local/src/DSS/StreamingServer patch -p0 < OSHeaders-1.0-pointersizeargfix.patch
4. Build and install:
./buildtarball cd DarwinStreamingSrvr5.6.0-Linux export username="youradminnamehere" export password="yourpasswordhere" sudo ./Install
5. Create file to start DSS automatically at boot, /etc/init.d/DSS with the following contents (TODO: add this under patch file section, or maybe create a contrib file section)
#!/bin/sh
#
# chkconfig: 35 92 12
# description: Quicktime Streaming Media Server
#
# Slight tweak of file create by Larry Underhill 05/20/02
#
# init script to start up the quicktime (Darwin) streaming server
# tested on Redhat 7.2, Fedora Core 4 and CentOS-4.3
# source function library
. /etc/rc.d/init.d/functions
case "$1" in
start)
if test -r /var/lock/subsys/dssd
then
echo "Lockfile /var/lock/subsys/dssd exists. Server not started."
failure
else
echo "Starting Darwin Streaming Server: "
/usr/local/sbin/DarwinStreamingServer && touch /var/lock/subsys/dss && success || failure
echo "Starting DSS Admin Console: "
/usr/local/sbin/streamingadminserver.pl && success || failure
echo
fi
;;
stop)
echo "Stopping Darwin Streaming Server: "
[ -f /var/lock/subsys/dss ] || exit 0
ps ax | awk '{print $1" " $5}' | awk '/DarwinStreamingServer/ {print $1}' | xargs -r kill -9 && success || failure
echo "Stopping DSS Admin Console: "
ps ax | awk '/streamingadminserver.pl/ {print $1}' | xargs -r kill -9 && success || failure
rm -f /var/lock/subsys/dss
echo
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "Usage: $0 [start|stop|restart]"
exit 1
esac
exit 0
6. Have above file called at boot time:
chmod +x /etc/init.d/DSS /sbin/chkconfig --add DSS
7. Finishing touches:
mkdir /home/qtss chown -R qtss.qtss /home/qtss usermod -c "Darwin Streaming Server"
8. When you log into the web admin interface for the first time you will be prompted to set a username and password for MP3 serving and asked if you want to set up streaming over port 80 and if you want to run the web admin over https (I can't quite remember this part, please clarify somebody).
Fedora Core 4.x, 5.x
The following works for me under Fedora Core 4,5 with gcc4. Compilation of FC4 almost the same as above (Compiling from CVS on CentOS-4.x) except step 2 and 3:
2. Patches required:
- Media:fc4.patch for proper compiling with gcc4 (inherits Media:OSHeaders-1.0-pointersizeargfix.patch)
- Media:playlist_parser.patch if you are going use PlaylistBoadcaster with mp4creator's files
- Media:parse_xml.date_display.patch date display bug fix. (put this one into
/usr/local/src/DSS/StreamingServer/WebAdmin/WebAdminHtml/)
[verem@aipetry /] cd /usr/local/src/DSS/StreamingServer [verem@aipetry StreamingServer]$ patch -p1 < fc4.patch patching file APIModules/QTSSSpamDefenseModule.bproj/QTSSSpamDefenseModule.cpp patching file CommonUtilitiesLib/OSHeaders.h patching file CommonUtilitiesLib/OSRef.h patching file CommonUtilitiesLib/UDPDemuxer.h patching file Server.tproj/QTSServer.h patching file Server.tproj/RTPSessionInterface.h [verem@aipetry StreamingServer]$ patch -p1 < playlist_parser.patch patching file PlaylistBroadcaster.tproj/playlist_parsers.cpp [verem@aipetry WebAdminHtml]# patch -p0 < parse_xml.date_display.patch patching file parse_xml.cgi
Debian Sarge
1. Become root (by using su or any other tool you prefer)
2. Install the libstdc++6 package if not already done:
~$ apt-get install libstdc++6
3. Change to working directory:
~$ cd /usr/local/src/
4. Download the Fedora Core 4 binary from the DSS home page [1]:
/usr/local/src# lynx http://www.opensource.apple.com/projects/streaming/release/DarwinStreamingSrvr5.5.4-Linux.tar.gz
5. extract it and enter the created directory:
~$ tar xvzf DarwinStreamingSrvr5.5.4-Linux.tar.gz ~$ cd DarwinStreamingSrvr5.5.4-Linux
6. Create the qtss group like this:
~/DarwinStreamingSrvr5.5.4-Linux# groupadd qtss
7. Run the Install script.
~/DarwinStreamingSrvr5.5-Linux# ./Install
8. Enter username for new DSS serveradmin.
9. Enter password for new DSS serveradmin.
10. Repeat password for new DSS serveradmin.
11. Browse to and login at:
http://ipaddress:1220/
You're done!
The group must be added manually because the included install script doesn't creates it:
There will be some warnings about ps like this one:
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
But the ps output still works for the Install script so don't pay attention to those.
Debian Etch
1. Download the Red Hat Linux 9 binary from the DSS home page [2]
2. UnTar it and enter the created directory:
~$ tar xvzf DarwinStreamingSrvr5.5-Linux.tar.gz ~$ cd DarwinStreamingSrvr5.5-Linux
3. Become root (by using su or any other tool you prefer)
4. Copy some files and directories in the actual path:
~/DarwinStreamingSrvr5.5-Linux# cp WebAdmin/perlpath.pl . ~/DarwinStreamingSrvr5.5-Linux# cp PlaylistBroadcaster.tproj/PlaylistBroadcaster . ~/DarwinStreamingSrvr5.5-Linux# cp qtpasswd.tproj/qtpasswd . ~/DarwinStreamingSrvr5.5-Linux# cp Documentation/readme.txt . ~/DarwinStreamingSrvr5.5-Linux# cp Documentation/3rdPartyAcknowledgements.rtf . ~/DarwinStreamingSrvr5.5-Linux# cp WebAdmin/src/streamingadminserver.pl . ~/DarwinStreamingSrvr5.5-Linux# cp -R WebAdmin/WebAdminHtml/ ./AdminHtml
5. Create the qtss user like this:
~/DarwinStreamingSrvr5.5-Linux# useradd qtss
6. Run the Install script.
~/DarwinStreamingSrvr5.5-Linux# ./Install
You're done!
The user must be added manually because the included install script creates it with:
# useradd -M qtss > /dev/null 2>&1
So it fails silently in Debian since the -M option is not recognized.
There will be some warnings about ps like this one:
Warning: bad ps syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
But the ps output still works for the Install script so don't pay attention to those.
Mac OSX
Patches
This is a list of collected patches for Darwin Streaming Server.
1. Add pointersizearg macros to the OSHeaders.h file. Without this patch will not compile on Fedora Core 4, CentOS-4.3 (Please add to this list). Media:OSHeaders-1.0-pointersizeargfix.patch. For more information see:
- http://lists.apple.com/archives/streaming-server-users/2006/Mar/msg00265.html Re: CVS compile problems on linux.
2. Fedora Core 4 with gcc4 compilation patches (tested against CVS snapshot from 2006-06-21) Media:fc4.patch. For more information see:
- http://lists.apple.com/archives/streaming-server-dev/2006/May/msg00038.html Patch to make DSS compile with gcc4
3. Media:playlist_parser.patch is Sverker Abrahamsson's patch. Its usefull if you are going use mp4creator's created file with PlaylistBroadcaster. For more information see:
- http://lists.apple.com/archives/streaming-server-users/2005/Oct/msg00259.html Re: 16 Movie file does not match (DSP)
- http://sourceforge.net/forum/forum.php?thread_id=1512387&forum_id=59136 discussion 'mp4creator feat PlaylistBroadcaster' problem
4. parse_xml.cgi date display patch Media:parse_xml.date_display.patch. For more details see:
- http://lists.apple.com/archives/streaming-server-dev/2006/Jun/msg00013.html parse_xml.cgi date display patch
Uninstalling
Here's a brief how-to guide to deinstall QTSS on the OS X platform.
1. Back up config files sitting at /Library/QuickTimeStreaming/Config/ as needed. Also, the qtaccess privileges file present in the Movies directory.
2. Delete the configuration receipt at /Library/Receipts/DarwinStreamingServer.pkg
3. Remove the server and the webmin perl script,
/usr/sbin/QuickTimeStreamingServer
/usr/sbin/streamingadminserver.pl
4. For completeness, also the Playlist Broadcaster & friends,
/usr/bin/PlaylistBroadcaster
/usr/bin/MP3Broadcaster
/usr/bin/StreamingLoadTool
/usr/bin/createuserstreamingdir
5. If deinstalling for good, also remove the relevant entries in
/etc/hostconfig
namely,
QTSSWEBADMIN=-YES-
QTSSRUNSERVER=-YES-
Bugs and other issues
Windows
Currently, DSS 5.5.1 cannot use the newest version of ActivePerl (5.8.8.817) on Windows Server 2003. Install ActivePerl v5.8.6 in order for Darwin to work.
If you have already installed ActivePerl (5.8.8.817), using a text editor to delete Line 33 of streamingadminserver.pl corrects the problem.
Relaying more than one live source
In relay mode, DSS doesn't change its destination port (it is choosen by DSS via RTSP SETUP). As a consequence, DSS does not work with more than one encoder source in relay mode (for example, using Axis and Vivotek live cameras).
Playlist Configuration File Format
Playlists can be created and started from the web admin interface in QTSS/DSS. They can also be created and started from QTSS Publisher on QTSS.
PlaylistBroadcaster is a command-line utility for running Media Playlists on DSS/QTSS. Using PlaylistBroadcaster requires valid config and playlist files.
The playlist file is a text file listing the paths to the media files to be included in the playlist. All audio tracks in Media Playlists must use the same encoding, sampling rate, compression, and bit rate. All video tracks in Media Playlist must use the same encoding, compression, bit rate, and frame size.
The broadcast description config file is a text file that specifies how the media should be broadcast, the playlist file, the IP address of the Darwin Streaming Server, and other information about the broadcast. Here are details on the configuration file:
Example file:
playlist_file /server/local/media/lists/playlist1 play_mode weighted_random sdp_reference_movie /music/jazz/take5.mov destination_ip_address 12.123.123.123 destination_base_port 5004 recent_movies_list_size 10 sdp_file /server/movies/playlist1.sdp logging enabled log_file /server/local/playlist1.logTo create a broadcast description file, you can use any text editor. You can give the file any name you'd like and you can save the file to any location on your server.
The file must contain these keywords followed by the appropriate value:
| Keyword | Value | ||||
| playlist_file | playlist file name and path; can be complete or relative path For example: /server/local/media/lists/playlist1 |
||||
|
|
|||||
| play_mode | can specify one of three modes: sequential, sequential_looped, or weighted_random | ||||
|
|
|||||
| sdp_reference_movie | sdp reference movie file path and name; can be complete or relative path For example: |
||||
|
|
|||||
| destination_ip_address | IP address of the local streaming server you use to broadcast the media For example: |
||||
|
|
|||||
| destination_base_port | port number Default is 5004 |
||||
|
|
|||||
| recent_movies_list_size | the minimum number of files that must play before a file may be repeated | ||||
|
|
|||||
| sdp_file | SDP file path and name; can be complete or relative path For example: |
||||
|
|
|||||
| logging | enabled or disabled | ||||
|
|
|||||
| log_file | log file path and name For example: |
||||
|
|
|||||
More details about keywords and values
play_mode:
You can specify one of three modes:
| sequential | |
| The media is broadcast in the order it appears in the playlist file. When the last media file is done playing, the broadcast stops. | |
| sequential_looped | |
| The media is broadcast in the order it appears in the playlist file. When the last media file is done playing, the playlist repeats in the same order. | |
| weighted_random | |
| The media is broadcast in random order using the specified weights to determine how often an item plays. |
destination_ip_address:
The default value is the IP address of the computer that has PlaylistBroadcaster and Darwin Streaming Server installed. You can also specify the IP address of another computer running Darwin Streaming Server (unicast) or a multicast address.
destination_base_port:
The base port number for the broadcast must be an even number. If you do not specify a port number, the default port (5004) is used.
Each track of the media you broadcast requires two ports. If the media contains more than one track (for example, video and sound), PlaylistBroadcaster uses the destination base port as the starting port number, then assigns (in ascending order) port numbers to other tracks automatically.
IMPORTANT: Each track of every broadcast you play simultaneously must use a different port number. If you stream more than one broadcast of multitrack media from your Darwin Streaming Server, be sure to assign destination base ports so that tracks do not play on the same port.
For example, if you use the default destination base port for a broadcast in which the media has three tracks (video, audio, and text), then the broadcast will use ports 5004 through 5009 (two for each track). If you want to broadcast another stream, then you should set the destination base port of the second stream to at least 5010.
recent_movies_list_size:
You can specify this only if the play mode is weighted_random. By default this value is zero (0), so that all the media files play randomly based only on the weight you have assigned to each one.
Be sure to set this value to a number less than the number of media files in the playlist. If you set it to a number equal to or greater than the number of media files, the broadcast will play each media file once then stop.
sdp_file:
You must specify a Session Description Protocol (SDP) file. The SDP file must be in the media directory you set up for Darwin Streaming Server. If the SDP file you specify doesn't exist in the location, PlaylistBroadcaster creates one.
IMPORTANT: If you stop a broadcast and change the broadcast description file, be sure to delete the SDP file from the media directory before you restart the broadcast. Otherwise PlaylistBroadcaster won't create a new SDP file, and your changes won't take effect.
sdp_reference_movie:
The complete or relative pathname of the reference movie, which can be one of the media files you are broadcasting. PlaylistBroadcaster uses the reference movie to create an SDP file.
logging:
If you enable logging, PlaylistBroadcaster records information about the broadcast in the log file, including error messages.
log_file:
If you enable logging but do not specify a log file, then PlaylistBroadcaster creates a log file with the name of the broadcast description file followed by ".log" in the same directory as the broadcast description file.

