Streaming Flash Video with open-source software

Flash video has several advantages over other formats, especially the fact that the Flash plugin comes pre-installed on most browsers. For this reason I’ve been looking at using streaming Flash video in sites which must support a wide variety of browsers and platforms.

However, until recently, the cost of licensing the Flash Media Server software has been prohibitive. An article on Forbes.com notes that the cost for streaming Flash video is sometimes more expensive than it is worth. Fortunately, there is now an open source alternative to Flash Media Server: “Red5, which is not only free but does more than Adobe’s Flash Media Server Software. In fact it does more than several Adobe server products put together.

Red5 is an open source Flash Server written in Java that supports streaming audio and video, recording client video streams, remote shared objects (a flash feature that allows collaborative multi-user applications), live stream publishing (webcasting) and much more.

Starting out with simple streaming using the Red5 server:

  1. First go to Red5 Downloads Page and download the latest version for your server platform.
  2. A good tutorial on installing Red5 on Windows is available here. To get to the correct article, find the navigation bar at the bottom of the page, and click to page 2. Click on the button for Red5 Flash Media Server.
  3. Find the file “red5.properties”. On my server it is at:
    /serverRoot/Red5/conf/red5.properties

    Change the http.host line to read:

    http.host = your.server.com

    # HTTP
    http.host = your.server.com
    http.port = 5080
    # RTMP
    rtmp.host = your.server.com
    rtmp.port = 1935
    rtmp.event_threads_core=16
    rtmp.event_threads_max=32
    # event threads queue: -1 unbounded, 0 direct (no queue), n bounded queue
    rtmp.event_threads_queue=-1
    rtmp.event_threads_keepalive=60
    rtmp.send_buffer_size=271360
    rtmp.receive_buffer_size=65536
    rtmp.ping_interval=5000
    rtmp.max_inactivity=60000
    # RTMPT
    rtmpt.host = your.server.com
    rtmpt.port = 8088
    rtmpt.ping_interval=5000
    rtmpt.max_inactivity=60000
    # Debug proxy (needs to be activated in red5-core.xml)
    proxy.source_host=0.0.0.0
    proxy.source_port=1936
    proxy.destination_host=your.server.com
    proxy.destination_port=80
    

    (note, these settings are for a server that is NOT also running a standard webserver side by side with red5. For an explanation of how to do that, see this article )
    To stream a video, just put the FLV video file into any of the streams directories. For example:

    /Red5/webapps/oneOfTheApps/streams/yourVideo.flv

    Access the stream by using a flash based video player. A simple example is available for download:

    Download example player file

    The relevant actionscript is in frame1 of the main timeline.

    Additional Resources

  4. General Flash Video information:
    Best Practices for Delivery: Flash Video
  5. Additional Information:
    Subscribe to the Red5 mailing list
  6. Another Red5 forum is located here
  7. Security:
    To see all Red5 mailing list posts on the topic of security, paste the following query into a Google search box:
    site:http://osflash.org/pipermail/red5_osflash.org/ security
  8. Performance:
    Stress test results of publishing a live stream to many clients (May 2007)

  9. Firewall and Shared IIS server issues
    How to run Red 5 on a shared IIS server on port 80