Red5 installation guide (RTMP & RTMPT)

来源:互联网 发布:日本女生皮肤好 知乎 编辑:程序博客网 时间:2024/06/15 23:50

Introduction:

Red5 is an Open Source Flash Server written in Java that supports:

  • Streaming Video (FLV, F4V, MP4, 3GP)
  • Streaming Audio (MP3, F4A, M4A, AAC)
  • Recording Client Streams (FLV and AVC+AAC in FLV container)
  • Shared Objects
  • Live Stream Publishing
  • Remoting
  • Protocols: RTMP, RTMPT, RTMPS, and RTMPE

 

Media server setup steps:

1.       Download red5 from: http://code.google.com/p/red5/

2.       Download JDK from:  http://www.oracle.com/technetwork/java/javase/downloads/index.html

3.       Install JDK and deploy the “JAVA_HOME” environment variable.

Add

=====================================================================

CLASSPATH:

.;%%JAVA_HOME%\bin;JAVA_HOME%\bin\dt.jar;%JAVA_HOME%\bin\tools.jar

JAVA_HOME:

C:\Program Files (x86)\Java\jdk1.6.0_10-Your JAVA installation path.

======================================================================

Edit

PATH:

Add “%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin;” at the beginning.

======================================================================

4.       Install Red5 and set ports for HTTP,RTMP and RTMPT

 

5.       Start red5

6.       Testing
Copy one testing file to “webapps\oflaDemo\streams”, Open testing page: http://localhost:5080/.




7.       Click [HERE]in testing page, and select [oflaDemo]

test the media file you added just now, make sure the file can be played normally.


8.        Copy your media files to oflaDemo\streams folder. And you can access these media files by: rtmp://localhost/oflaDemo/XXX.flv.

9.       How to support RTMPT prococal:

 

RTMP is default protocol in red5it’s opened by default, but rtmp has limited in some network environment.

Connect Method: nc.connect( "rtmp://x.x.x.x:port/myapp");

 

RTMPT protocol is wrap the RTMP HTTP protocolCan penetrate the firewall.

Connect Method : nc.connect( "rtmpt://x.x.x.x:port/myapp");

 

RTMPS agreement using HTTPS security connection

Connect Method : nc.connect( "rtmps://x.x.x.x:port/myapp");

 

Below is the way to open rtmpt:

 

In “conf/red5-core.xml”,delete comments of bean on the description of rtmpt.server.

 

Before Update

<!-- RTMPT -->

<!--

    <bean id="rtmpt.server" class="org.red5.server.tomcat.rtmpt.RTMPTLoader" init-method="init" lazy-init="true">

   

       <property name="webappFolder" value="${red5.root}/webapps" />

      

       <property name="connector">

           <bean class="org.apache.catalina.connector.Connector">

              <constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />  

              <property name="port"><value>${rtmpt.port}</value></property>

              <property name="enableLookups"><value>false</value></property>

           </bean>

       </property>

 

 

       <property name="connectionProperties">

           <map>

              <entry key="maxKeepAliveRequests" value="${rtmpt.max_keep_alive_requests}"/>

              <entry key="useExecutor" value="true"/>

              <entry key="maxThreads" value="${rtmpt.max_threads}"/>

              <entry key="acceptorThreadCount" value="${rtmpt.acceptor_thread_count}"/>

              <entry key="processorCache" value="${rtmpt.processor_cache}"/>

           </map>

       </property>

      

       <property name="host">

           <bean class="org.apache.catalina.core.StandardHost">

              <property name="name" value="${rtmpt.host}" />

              <property name="unpackWARs" value="false" />

              <property name="autoDeploy" value="false" />

              <property name="xmlValidation" value="false" />

              <property name="xmlNamespaceAware" value="false" />

           </bean>      

       </property>      

 

 

    </bean>

-->

 

 

After Update:

 

 

 

<!-- RTMPT -->

 

 

    <bean id="rtmpt.server" class="org.red5.server.tomcat.rtmpt.RTMPTLoader" init-method="init" lazy-init="true">

 

   

       <property name="webappFolder" value="${red5.root}/webapps" />

 

      

       <property name="connector">

 

           <bean class="org.apache.catalina.connector.Connector">

 

              <constructor-arg type="java.lang.String" value="org.apache.coyote.http11.Http11NioProtocol" />  

 

              <property name="port"><value>${rtmpt.port}</value></property>

 

              <property name="enableLookups"><value>false</value></property>

 

           </bean>

       </property>

 

 

       <property name="connectionProperties">

 

           <map>

              <entry key="maxKeepAliveRequests" value="${rtmpt.max_keep_alive_requests}"/>

 

              <entry key="useExecutor" value="true"/>

 

               <entry key="maxThreads" value="${rtmpt.max_threads}"/>

 

              <entry key="acceptorThreadCount" value="${rtmpt.acceptor_thread_count}"/>

 

              <entry key="processorCache" value="${rtmpt.processor_cache}"/>

 

           </map>

       </property>

      

       <property name="host">

 

           <bean class="org.apache.catalina.core.StandardHost">

 

              <property name="name" value="${rtmpt.host}" />

 

              <property name="unpackWARs" value="false" />

 

              <property name="autoDeploy" value="false" />

 

              <property name="xmlValidation" value="false" />

 

              <property name="xmlNamespaceAware" value="false" />

 

           </bean>      

       </property>      

     </bean>

 

So you can access the media files by RTMPT protocol:

rtmpt://Localhost:8088/oflaDemo/XXX.flv