Easy access to high bandwidth internet has spawned all types of multimedia rich applications on web.
Audio video streaming is one of them. Websites like youtube.com and metacafe.com are some of the examples that employs audio-video streaming technology to deliver media rich content right in the web browser. This article aims at to explain the how to build a media server to stream your favorite video content online?
Flash in media streaming
There are multitudes of protocol currently available to stream audio video content. HTTP, RTSP, RTMP, MMS are some of the popular media streaming protocols. This article discuss about RTMP (Real Time Messaging Protocol). RTMP is proprietary protocol developed by Adobe Systems primarily used to stream media content to flash based media player. Flash has become a popular choice among the media broadcaster for the simple reason, that it is available with most of the browser today. Flash based media players are light weight and can be easily embedded as an object in web pages.
Adobe has its proprietary product called as Flash Media Streaming Server (FMS) for media streaming. FMS gives user a platform to stream their media content directly to web browser having simple embedded flash player. But the high price tag associated with Flash Media Server prohibits its use for common users.
Red5 – Open Source Flash Server
Red5 is an open source alternative to Flash Media Server (http://osflash.org/red5).
This document explains how to setup a flash server using Red5 software. You can download latest Red5 software here (http://code.google.com/p/red5/). The goal of this article to stream a video content from Red5 Flash Server to a media player.
Install the Red5 software setup-Red5-0.x.exe to default directory “C:\Program Files\red5”. We need to modify “C:\Program Files\Red5\conf\red5.properties” to configure few server parameters. Following is an example red5.properties file.
--------------------------------------------------------------------------------------------------
# Socket policy
policy.host=0.0.0.0
policy.port=843
# HTTP
http.host=192.168.0.100
http.port=8085
https.port=8443
# RTMP
# RTMP
rtmp.host=192.168.0.100
rtmp.port=1935
rtmp.event_threads_core=16
rtmp.event_threads_max=64
# event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue
rtmp.event_threads_queue=0
rtmp.event_threads_keepalive=60
rtmp.send_buffer_size=271360
rtmp.receive_buffer_size=65536
rtmp.ping_interval=1000
rtmp.max_inactivity=60000
rtmp.tcp_nodelay=true
# RTMPS
# RTMPS
rtmps.host=192.168.0.100
rtmps.port=8443
rtmps.ping_interval=5000
rtmps.max_inactivity=60000
rtmps.max_keep_alive_requests=-1
rtmps.max_threads=20
rtmps.acceptor_thread_count=2
rtmps.processor_cache=20
# RTMPS Keystore Password
rtmps.keystorepass=password
# RTMPT
# RTMPT
rtmpt.host=192.168.0.100
rtmpt.port=8088
rtmpt.ping_interval=5000
rtmpt.max_inactivity=60000
rtmpt.max_keep_alive_requests=-1
rtmpt.max_threads=20
rtmpt.acceptor_thread_count=2
rtmpt.processor_cache=20
# MRTMP
# MRTMP
mrtmp.host=192.168.0.100
mrtmp.server=localhost
mrtmp.port=9035
mrtmp.event_threads_core=4
mrtmp.event_threads_max=32
# event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue
mrtmp.event_threads_queue=0
mrtmp.event_threads_keepalive=60
mrtmp.send_buffer_size=271360
mrtmp.receive_buffer_size=65536
mrtmp.ping_interval=5000
mrtmp.max_inactivity=60000
mrtmp.tcp_nodelay=true
# Debug proxy (needs to be activated in red5-core.xml)
proxy.source_host=127.0.0.1
proxy.source_port=1936
proxy.destination_host=127.0.0.1
proxy.destination_port=1935
# JMX
jmx.rmi.port.registry=9999
jmx.rmi.port.remoteobjects=
jmx.rmi.host=192.168.0.100
jmx.rmi.ssl=false
--------------------------------------------------------------------------------------------------
Modify the host parameters to your machine IP address. Check the port parameters are same as that listed above.
HTTP port is where we can access Red5 server. Red5 server is accessed by typing http://192.168.0.100:8085 in web browser.
http.host=192.168.0.100
http.port=8085
https.port=8443
And RTMP port is where Red5 server will stream data for media clients. The media stream is accessed at rtmp://192.168.0.100:1935
rtmp.host=192.168.0.100
rtmp.port=1935
Now start the Red5 media server by typing “C:\Program Files\Red5\red5.bat” at command prompt.
If the Red5 server is started successfully it can be accessed at http://192.168.0.100:8085 in web browser.
Note: stop “sqlservr.exe” if it is running from Windows Task Manager as it uses the same 8085 port. Also you will need to open up port 8085 in windows firewall.
To test Red5 server click on “Launch a demo” and run Port Tester. The result should look like below:
The above test shows that RTMP port is properly configured.
Now copy a test flash video file in “C:\Program Files\Red5\webapps\oflaDemo\streams”. I have copied a file video.flv at the above location. This video file will be streamed on rtmp://192.168.0.100:1935/oflaDemo/video.flv by Red5 Media Server.
To view streamed media file download latest VLC player from http://www.videolan.org/vlc/
Open the network stream in VLC player as "Media->Open Network Stream.."
Provide the address of streamed media as shown below:
0 comments:
Post a Comment