Search code examples
httpstreamingred5rtmp

Is it safe to stream HD video?


To be able to record and play back audio instantly on my website, I've set up Red5 and FLV Audio Recorder. Now, I'm going to implement a video solution as well.

The problem with streaming (HD) video is that it doesn't work if your internet connection is too slow. I want to let the majority of users be able to watch my videos. Can I use the Red5-server, or do I have to use HTTP to ensure that everyone can watch it flawlessly?


Solution

  • Well, if you use for example jwPlayer, you could set up a RTMP stream, as you probably already know since you asked this question.

    If you use this code:

    <div id='mediaplayer'></div>
    
    <script type="text/javascript">
      jwplayer('mediaplayer').setup({
        'flashplayer': 'player.swf',
        'width': '720',
        'height': '306',
        'playlist': [
            {
               'title': 'Just add a title here...',
               'provder': 'rtmp',
               'image': 'Add a image to show before the video is started.',
               'duration': 'X seconds'
               'streamer': 'rtmp://server.com/dir',
               'plugins': {
                 'qualitymonitor-2': {}
                } // This will give different charts so that you can see what's going on behind the scenes!
    
               'levels': [
                  { bitrate:"2920", width:"1920", file:"videos/sintel-1920.mp4" },
                  { bitrate:"2080", width:"1280", file:"videos/sintel-1280.mp4" },
                  { bitrate:"2080", width:"720", file:"videos/sintel-720.mp4" },
                  { bitrate:"650", width:"480", file:"videos/sintel-480.mp4" },
                  { bitrate:"420", width:"320", file:"videos/sintel-320.mp4" }
               ]
            }
        ]
      });
    </script>
    

    you can provide the end-user with many different versions of the same video, with different bit rates, thus you can use a higher quality one if you have enough internet speed. (If you have 20mbit/s as a client, and a screen width of 400 px, you will get the last file in the example code, even though you have the internet to get the topmost. This is because you as a client will not see any difference anyway.)

    You can also use less of your hosting bandwidth, because if you use a small screen, you don't stream a high quality, since the end-user doesn't see any difference anyway.

    This is a good way to do it, because it will give your users the best experience, while you stay better protected against "robbery" of your videos!

    Please add a comment if you wonder about something!