Version 4.6 of the JW Player introduces a server-independent mechanism for bitrate switching. You can now provide the player with multiple versions of a video, letting it select the version that best match a visitor's screen size and bandwidth. Visitors with a broadband connection can watch the HD version of your video, while visitors with a dialup connection will get a low-quality (but smooth playing) version served. Bitrate switching is a one-size-fits-all solution that requires no action from the visitor.
The JW Player has a very basic, pragmatic implementation of bitrate switching:
The number of switching moments depends on the streaming type used:
The big advantage of dynamic streaming is that no re-buffering of the stream is required. Therefore it is the only streaming type that offers bitrate switching in the middle of playback. With all other streaming types, the player only switches levels at a moment the user is already interfering with playback himself (resizing the player or seeking in the stream).
Stream switching for RTMP based upon bandwidth only works if the server implements a checkBandwidth call. This is default in FMS 3.0+, and trivial to setup with Wowza. If there's no checkBandwidth handler, streams will be switched solely based upon the available display width.
Here is a player that offers a bitrate switching example for every streaming type. The little plugin on top of the video (the Quality Monitor plugin) shows the current display width, the current bandwidth and the currently playing level. While testing, you'll see that the progressive download example only switches on startup and that the RTMP/HTTP examples need a little rebuffering after every switch.
You'll also note it takes the FMS3.5 example about 10 seconds to update the stream every time a switch is performed. This is as expected: the server first needs to wait for the next keyframe in the video to anticipate the switch and then for the second keyframe in the video to actually perform the switch.
Every example in this player uses four different transcodes of the Elephant's Dream video, ranging from Youtube quality to just below 720p HD:
All four versions are MP4 files with H264/AAC, whereby the baseline encoding profile of H264 is used. An advantage of this profile over the - better - main or high profiles is that it needs less CPU for decoding. CPU stress is still something to keep in mind, since the JW Player does not take it along as part of the bitrate switching mechanism.
Moving to the actual setup, it is good to know that video exported by any encoding software will work with bitrate switching. There's no alignment of keyframes or other special requirements. Both FLV and MP4 are supported. You are free to select the number of quality levels to use (3 to 5 recommended), and the bitrate of these levels (200kbps to 2000kbps recommended).
No specific flashvars are needed to setup bitrate switching. All neccessary data is placed in the XML playlist, which can be assigned to the player with the file flashvar. Here is an example XML with just a single video, played as a regular progressive download:
<rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" >
<channel>
<item>
<title>Progressive download</title>
<link>http://www.bigbuckbunny.org/</link>
<description>Big Buck Bunny is a short animated film by the Blender Institute.</description>
<media:group>
<media:content bitrate="1500" url="http://bitsontherun.com/videos/Qvxp3Jnv-486.mp4" width="1080" />
<media:content bitrate="1100" url="http://bitsontherun.com/videos/Qvxp3Jnv-485.mp4" width="720"/>
<media:content bitrate="700" url="http://bitsontherun.com/videos/Qvxp3Jnv-484.mp4" width="480" />
<media:content bitrate="400" url="http://bitsontherun.com/videos/Qvxp3Jnv-483.mp4" width="320" />
</media:group>
</item>
</channel>
</rss>
Once the player sees multiple media:content entries, it'll automatically enable bitrate switching. Note that:
If you use a streaming server, you can add the familiar jwplayer:streamer and jwplayer:type entries to the playlist. For example, here is:
For more playlist-related info, check the playlists section of the formats wiki page.
Download the world's most popular open source player. It supports FLV, MP3, MP4 & AAC; it's Plugin-extensible; and it's fully integrated with our AdSolution. No wonder it's #1.
Earn money with ads from LongTail's AdSolution. Watch our demos and sign up now!
Use the JW Setup Wizard to quickly customize the JW Player™ without any writing code. Simply pick your player and our Wizard will do the rest.