| 1 | Instructions how to compile and use C++ RTMP Server (a.k.a crtmpserver) |
|---|
| 2 | |
|---|
| 3 | Requirements: |
|---|
| 4 | * GCC and other C++ tools |
|---|
| 5 | * SVN |
|---|
| 6 | * libdl, libssl, libcrypto |
|---|
| 7 | (make sure you have the "devel" packages of libdl, ssl and crypto installed prior to compiling) |
|---|
| 8 | |
|---|
| 9 | In order to get the source code, issue the following command: |
|---|
| 10 | |
|---|
| 11 | svn co --username anonymous https://svn.rtmpd.com/crtmpserver/trunk crtmpserver |
|---|
| 12 | When it asks for password, hit Enter key |
|---|
| 13 | |
|---|
| 14 | Compile the package. Do the following steps: |
|---|
| 15 | |
|---|
| 16 | cd crtmpserver/builders/cmake |
|---|
| 17 | cmake . |
|---|
| 18 | |
|---|
| 19 | (this step will create all the Makefile's that are required. If some package is missing, the cmake will complain) |
|---|
| 20 | |
|---|
| 21 | make |
|---|
| 22 | |
|---|
| 23 | The compilation procedure should be finished within few minutes. |
|---|
| 24 | |
|---|
| 25 | After you compiled the package, it's time to test it. Run the following command: |
|---|
| 26 | |
|---|
| 27 | ./crtmpserver/crtmpserver crtmpserver/crtmpserver.lua |
|---|
| 28 | |
|---|
| 29 | If everything goes well, you'll get on your console a table with IP's, ports, protocols, and application names |
|---|
| 30 | If you see this table, then crtmpserver is working. |
|---|
| 31 | |
|---|
| 32 | Lets test it the server. Follow these simple steps: |
|---|
| 33 | |
|---|
| 34 | * Download a simple FLV or MP4 file. You can dowload a sample file from here: http://www.mediacollege.com/adobe/flash/video/tutorial/example-flv.html |
|---|
| 35 | * Place the file you downloaded into the crtmpserver/media folder |
|---|
| 36 | * Download an FLV player. For this example, we'll use JW Player. Get it here: http://www.longtailvideo.com/players/jw-flv-player |
|---|
| 37 | * Extract the JW Player to a directory which is accessible through your web server |
|---|
| 38 | * Go to the extracted directory and create an HTML file which will include the player and play the file. Here's an example: |
|---|
| 39 | |
|---|
| 40 | <html> |
|---|
| 41 | <body> |
|---|
| 42 | <script type='text/javascript' src='swfobject.js'></script> |
|---|
| 43 | |
|---|
| 44 | <div id='mediaspace'>This text will be replaced</div> |
|---|
| 45 | |
|---|
| 46 | <script type='text/javascript'> |
|---|
| 47 | var so = new SWFObject('player.swf','mpl','640','360','9'); |
|---|
| 48 | so.addParam('allowfullscreen','true'); |
|---|
| 49 | so.addParam('allowscriptaccess','always'); |
|---|
| 50 | so.addParam('wmode','opaque'); |
|---|
| 51 | so.addVariable('file','file-download'); |
|---|
| 52 | so.addVariable('streamer','rtmp://127.0.0.1/flvplayback/'); |
|---|
| 53 | so.write('mediaspace'); |
|---|
| 54 | </script> |
|---|
| 55 | </body> |
|---|
| 56 | </html> |
|---|
| 57 | |
|---|
| 58 | * Change the 127.0.0.1 to either the IP of your crtmpserver or simply use a hostname of your machine |
|---|
| 59 | * Replace file-download with the actual filename of your sample you download. Remeber to omit the .flv if it's an FLV file |
|---|
| 60 | * Open a web browser and point it to to the web server IP/Hostname and the directory you installed the player |
|---|
| 61 | (example: http://127.0.0.1/player) |
|---|
| 62 | * You should see a player. Click the play button and the video should be played. |
|---|
| 63 | |
|---|
| 64 | If you see the video, then everything works well. |
|---|
| 65 | |
|---|
| 66 | Installing crtmpserver: |
|---|
| 67 | |
|---|
| 68 | * Go to the directory crtmpserver/cmake |
|---|
| 69 | * Run the following command: cmake -DCRTMPSERVER_INSTALL_PREFIX=<path> (for example /usr/local/crtmpserver) |
|---|
| 70 | * After previous command done start build project with command: make |
|---|
| 71 | * After build comlete run command: make install |
|---|
| 72 | * After install you has installed crtmpserver in <path>(in our case /usr/local/crtmpserver) |
|---|
| 73 | * Now you can start crtmpserver with command: |
|---|
| 74 | sudo <path>/sbin/crtmpserver --uid=<UID> <path>/etc/crtmpserver.lua |
|---|
| 75 | in our case: |
|---|
| 76 | sudo /usr/local/crtmpserver/sbin/crtmpserver --uid=<UID> /usr/local/crtmpserver/etc/crtmpserver.lua |
|---|
| 77 | |
|---|
| 78 | Also look into builders/packing directory. There are several OS specific builders. |
|---|
| 79 | * in directory "debian" builder for Debian, also can be used for Ubuntu and other distributions based on debian |
|---|
| 80 | * in directory "freebsd" builder(port) for FreeBSD |
|---|
| 81 | |
|---|
| 82 | crtmpserver settings |
|---|
| 83 | * All crtmpserver settings are located in a detailed file calle: crtmpserver.lua |
|---|
| 84 | |
|---|
| 85 | Support/Help: |
|---|
| 86 | If you're lookingo for assistance with crtmpserver, feel free to join us at: |
|---|
| 87 | http://groups.google.com/group/c-rtmp-server |
|---|
| 88 | |
|---|
| 89 | Credits: |
|---|
| 90 | * crtmpserver written by: Gavriloaie Eugen-Andrei |
|---|
| 91 | * Documentation (this file): Hetz Ben Hamo, Andriy Beregovenko |
|---|
| 92 | * TinyXML: Lee Thomason |
|---|
| 93 | * lua: Roberto Ierusalimschy, Waldemar Celes, Luiz Henrique de Figueiredo |
|---|
| 94 | * Performance: Vlad Galu |
|---|
| 95 | * Protocols: Mircea Danila Dumitrescu |
|---|