Today i’m going to discuss how to setup your own streaming server over the web very cost effectively and also a Player which can play your streams
Red5 is the best Opensource Streaming server available over the web and you can quickly download it’s installation and run it to setup your streaming server
Installation
If you are first time user of Red5, start the server by clicking “red5.bat”
Once that is done goto Home page
Here is the link for default home page http://localhost:5080
Red5 is by default configured on port 5080 ( It comes with embedded tomcat)
Now click on install link and install oflvDemo (Application using flash installer red5 provides)
RTMPT Configuration
Verify if you have “rtmpt.server” bean configured in your “conf/red5-core.xml”
If not present copy the following code
<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>
The above code enables RTMPT Plugin into your Red5 server. This is required in most cases where you want to start streaming over the web where all ports other than port 80 are blocked
RTMPT is RTMP protocol over HTTP
By default if you just want to test on local machine you wont need this RTMPT setup
Now lets have our Webserver proxy to this Red5. The webserver i chose here is Apache Http Server
Verify if you have mod_proxy module enabled in Apache httpd.conf
If not enable it
Now add the following configuration to apache to make it as proxy to red5
ProxyPass /demos http://localhost:5080/demos
ProxyPassReverse /demos http://localhost:5080/demos
ProxyPass /open http://localhost:8088/open
ProxyPassReverse /open http://localhost:8088/open
ProxyPass /send http://localhost:8088/send
ProxyPassReverse /send http://localhost:8088/send
ProxyPass /idle http://localhost:8088/idle
ProxyPassReverse /idle http://localhost:8088/idle
ProxyPass /close http://localhost:8088/close
ProxyPassReverse /close http://localhost:8088/close
ProxyPass /fcs http://localhost:8088/fcs
ProxyPassReverse /fcs http://localhost:8088/fcs
The above configuration create proxy for demos where olfvDemo is hosted as well as RTMPT connection requests that are listening on port 8088 (Default RTMPT ) port for red5
Dont forget to restart server’s once you change configurations.
Player setup
Flowplayer is best opensource flash Player which is available over the web. You can download it from web or you can checkout the one which is configured for red5 from
https://linkwithweb.googlecode.com/svn/trunk/Player
Below is the code that is to written as configuration to run a Stream from olfvDemo(Red5 application)
<!-- include flowplayer JavaScript file that does Flash embedding and provides the Flowplayer API. --> <script type="text/javascript" src="flowplayer-3.2.6.min.js"></script> <!-- this A tag is where your Flowplayer will be placed. it can be anywhere --> <a href="http://pseudo01.hddn.com/vod/demo.flowplayervod/flowplayer-700.flv" style="display:block;width:620px;height:530px" id="player"> </a> <!-- this will install flowplayer inside previous A- tag. --> <script> flowplayer("player", "../flowplayer-3.2.7.swf",{ clip: { url: 'toystory3.flv', // configure clip to use influxis as our provider, it uses our rtmp plugin provider: 'northalley' }, allowfullscreen : true, // streaming plugins are configured under the plugins node plugins: { // here is our rtpm plugin configuration northalley: { url: '../flowplayer.rtmp-3.2.3.swf', // netConnectionUrl defines where the streams are found netConnectionUrl:'rtmpt://localhost:8088/oflaDemo' } } }); </script>
We have donwloaded RTMP plugin to run RTMP streams.
Njoy publishing your streams for freeeee
Awesome, thanks!
Thanks for the great tutorial
Getting close to resolved it!
I am able to run red5 but I get the following error
Anybody have any idea why?
I would be truly appreciated.
[root@user dist]# ./red5.sh > restart.log &
[1] 3073
[root@user dist]# Exception in thread “Launcher:/__MACOSX” org.springframework.beans.factory.BeanDefinitionStoreException: Could not resolve bean definition resource pattern [/WEB-INF/red5-*.xml]; nested exception is java.io.FileNotFoundException: ServletContext resource [/WEB-INF/] cannot be resolved to URL because it does not exist
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:190)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:124)
at org.springframework.web.context.support.XmlWebApplicationContext.loadBeanDefinitions(XmlWebApplicationContext.java:92)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.red5.server.tomcat.TomcatLoader$1.run(TomcatLoader.java:558)
Caused by: java.io.FileNotFoundException: ServletContext resource [/WEB-INF/] cannot be resolved to URL because it does not exist
at org.springframework.web.context.support.ServletContextResource.getURL(ServletContextResource.java:130)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.isJarResource(PathMatchingResourcePatternResolver.java:406)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.findPathMatchingResources(PathMatchingResourcePatternResolver.java:338)
at org.springframework.core.io.support.PathMatchingResourcePatternResolver.getResources(PathMatchingResourcePatternResolver.java:276)
at org.springframework.context.support.AbstractApplicationContext.getResources(AbstractApplicationContext.java:1018)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:177)
… 7 more
Does this work with ip cameras? My ip cams provide an rtsp URL.
Well, In flow player how do i set up streme name NAME:streme1234566 to flow player settings
i setup the rtmp link but what about streame name or channel name in flow player so i can see braodcaster…. that is where i got stuck
[…] Repost: Red5 Server RTMPT with Apache as Webserver and Flowplayer Configuration […]
Hello,
its not working, flowplayer display the following message :
201 unable to load stream or clip file connection failed clip “[clip] ‘toystory3-p6.flv'”
what should be changed in index.html ?
please and thank you in advance.
ps: I have a functional Red5 server and oflademo works very well.
try to change toystory3-p6.flv to toystory3-p6. also if you testing on laptop or your home pc, go to router and make sure port forward configuration is good. if you point port 5080 in your conf/red5.properties , in router you should do External Port=5080 and Internal Port=5080 and your home ip. For example my home ip is 192.168.1.14 … hope it helps
sorry change toystory3-p6.flv to toystory3-p6 (with no .flv)
Hi, how to public to the internet? I obviously cannot have there localhost address. Thank you