I. What is red5?
Similar to Macromedia's FMS, Red5 provides a Java-based open source streaming media server for Flash-based streaming media services. It is compiled and written in Java and uses RTMP as the streaming media transmission protocol, which is fully compatible with FMS. It provides streaming FLV and MP3 files. The real-time recording client streams FLV files, shared objects, real-time video playback, Remoting, and other functions. After the FMS is replaced with Red5, the client can run normally without any changes.
II. red5 installation
1, download address: http://www.red5.org/downloads/red5/1_0_1/
2. Install java 1.6
# Yum install java-1.6.0-openjdk java-1.6.0-openjdk-devel
3. Install red5
# Tar zxvf red5-1.0.1.tar.gz
# Music red5-server-1.0/usr/local/red5
# Cd/usr/local/red5
#./Red5.sh
The centos 6.5 system is used, and the installation is correct.
4. Create a red5 startup script
The code is as follows: |
Copy code |
[Root @ localhost red5-server-1.0] # cat/etc/init. d/red5 #! /Bin/bash # For RedHat and cousins: # Chkconfig: 2345 85 # Description: Red5 flash streaming server # Processname: red5 # Created By: Sohail Riaz (sohaileo@gmail.com) PROG = red5 RED5_HOME =/usr/local/red5 DAEMON = $ RED5_HOME/$ PROG. sh PIDFILE =/var/run/$ PROG. pid # Source function library ./Etc/rc. d/init. d/functions [-R/etc/sysconfig/red5] &./etc/sysconfig/red5 RETVAL = 0 Case "$1" in Start) Echo-n $ "Starting $ PROG :" Cd $ RED5_HOME $ DAEMON>/dev/null 2>/dev/null & RETVAL =$? If [$ RETVAL-eq 0]; then Echo $! > $ PIDFILE Touch/var/lock/subsys/$ PROG Fi [$ RETVAL-eq 0] & success $ "$ PROG startup" | failure $ "$ PROG startup" Echo ;; Stop) Echo-n $ "Shutting down $ PROG :" Killproc-p $ PIDFILE RETVAL =$? Echo [$ RETVAL-eq 0] & rm-f/var/lock/subsys/$ PROG ;; Restart) $0 stop $0 start ;; Status) Status $ PROG-p $ PIDFILE RETVAL =$? ;; *) Echo $ "Usage: $0 {start | stop | restart | status }" RETVAL = 1 Esac Exit $ RETVAL |
III. Test the red5 streaming media server
1. Publish a streaming media
We can set up Adobe flash media encoder and input rtmp: // ip address/live in FML, starting with stream name, such as 111.
We can also use the release tool provided by red5 to publish a stream.
A) open http: // localhost: 5080/demos/publisher.html
B) connect to the red5 streaming media server
Connect to the red5 streaming media server
If 19: 56: 05: 873-NetConnection. Connect. Success appears on the right side, red5 is started normally and can be connected.
C) release a red5 stream.
Create a red5 stream
Why do we choose audio instead of video? The computer has no camera. Click start to display the following content:
Red5 flash authorization
Select allow and click Publish. If 20: 04: 23: 836-Publish-NetStream. Publish. Start appears on the right side, the publishing stream is successful.
2. Use swfobject for multi-point connection and test
Add the following code: so. addVariable ('file', 'rtmp: // localhost/live/123 ');
Rtmp: // localhost/live streaming media server. 111 is the name of a stream.
When I speak, everyone else can hear it.