Switching bitrates in RTMP

Today I have fixed an issue with RTMP bitrate switch for VOD streams. With JWPlayer version 6 it’s possible to choose RTMP bitrate while playing stream in a way similar to youtube. I’ll provide a small tutorial here how to set up this on your system.

smil

In latest master I have updated JWPlayer to version 6. This version supports the following config format.


<script type="text/javascript" src="/jwplayer/jwplayer.js"></script></pre>
<div id="container">Loading the player ...</div>
<script type="text/javascript">
        jwplayer("container").setup({
        sources:[
            {
                file:"/sintel.smil"
            }
        ],
        ga: {},
        autostart: true,
        width: 640,
        height: 480,
        primary: 'flash'
});
</script>

This configuration refers smil file setting different bitrates/qualities for the same video. Here’s an example of sintel.smil

<smil>
<head>
<meta base="rtmp://localhost/vod/" />
</head>
<body>
<switch>
<video src="mp4:sintel-120p.mp4" height="120" />
<video src="mp4:sintel-240p.mp4" height="240" />
<video src="mp4:sintel-480p.mp4" height="480" />
</switch>
</body>
</smil>

Mp4 files for different bitrates can be created from the source sintel.mp4 with the following ffmpeg calls

ffmpeg -i sintel.mp4 -c:v libx264 -c:a copy -s 640x480 sintel-480p.mp4
ffmpeg -i sintel.mp4 -c:v libx264 -c:a copy -s 320x240 sintel-240p.mp4
ffmpeg -i sintel.mp4 -c:v libx264 -c:a copy -s 160x120 sintel-120p.mp4

The error fixed in 0.9.12 is nginx crash when switching stream quality in case VOD file is accessed remotely with http.

Thanks to fjyaniez for the report and config examples.

Advertisements
  1. #1 by fjyaniez on March 20, 2013 - 3:42 pm

    Thank you for your effort, nginx-rtmp-module is awesome 🙂

  2. #2 by David on May 10, 2013 - 9:48 pm

    Hi, flowplayer sollutions? not working, i think there is server problem. thx

    http://flowplayer.blacktrash.org/test/koukni.html

    • #3 by rarut on May 12, 2013 - 3:44 pm

      I didn’t test that with flowplayer. I will do that when I have time. Thanks.

  3. #4 by David on May 24, 2013 - 12:30 pm

    any news? Thank you. David

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: