If you’re a large media organization that publishes a lot of Video on Demand (VOD) content you may want to read the below post on how to save more than 30% in VOD bandwidth bills without compromising the quality of your videos or the degrading the user experience.
Objective – Save bandwidth costs on VOD without any changing the video itself
Current mechanism –
This is how all the existing flash based video players play out the VOD content – when the user starts playing out a video, the player starts downloading the entire video in the background. This happens irrespective of the fact whether the user is going to watch the entire video or not. With high speed internet connectivity these days, the time taken to download the video is usually much faster than the playout time of the video.
For e.g. say a user is watching a 2 minute video clip which could easily be 20 MB plus depending on the encoding quality and FPS. As the video starts playing, the player starts downloading the rest of the 20 MB video in the background What if the user moves on to another page or website after watching only half of the video?
There are two problems with the current approach –
- Wasted bandwidth – As you can guess, in the above example if the user only watched half of the video then the bandwidth is wasted downloading the entire clip. This is wasted bandwidth both for the content provider as well as the user. They’re both being charged for the bytes transferred.
- Blocked server connection – as the video player is downloading the rest of the video in the background, it results in a blocked server-side connection until the video is fully downloaded.
Proposed mechanism –
Summary – Change the flash player to fetch the video in segments instead of downloading it all in one go.
Say when the user starts playing the 2 minute video, only the next 30 seconds worth of video is pre-fetched. As the user approaches the 15 second viewing mark, the next 15 seconds worth of video is downloaded. A new 15 second video segment is fetched every time the user finishes watching the current 15 second segment. Every time the video player needs to fetch the video, it establishes a new connection and releases it once the segment is downloaded.
In the above mentioned approach, the video is downloaded in chunks depending on how much the user has watched and not all at once.
There are two advantages with the proposed approach –
- Reduction of wasted bandwidth – Say if the user watches only 1 minute of the video, the downloaded part of the video would be for approximately 1 min, 15 seconds – 12 MB. A saving of 8 MB from the previous scenario. That’s a 40% saving in bandwidth consumed both for the user as well as the video hosting provider.
- Better scalability – every time the video player needs to fetch a segment, it makes a new connection to the server which is released as soon as the segment is downloaded. This mechanism ensures that a connection to the server is not blocked until the entire video is downloaded. This is akin to a connection pool mechanism which frees up the server to serve other connections.
One of the key assumptions in the above approach is that a user may not watch the full length of the video. The saved bandwidth comes from the part of the video that the user abandons or doesn’t watch. As a part of an experiment, I had instrumented the video player for one of our properties to find out whether people watch VODs in the entirety or abandon them midway. On one of our high traffic properties we found that almost a third of the users don’t end up watching the video till the very end.
Actual live results –
I have been lucky enough to try out this theory on heavy-traffic sites. The results have been fantastic. No user complaints about the video experience, and we’ve ended up saving over 30% costs via reduced bandwidth bills. Want to see the video live in action, check it out here on Moneycontrol videos. You’ll notice the experience is pretty seamless.
This is purely a client side solution (and so easy to implement) without you having to change anything on the server-side or in the video itself. It’s been tested and works fine with both Akamai and Tata/Bitgravity CDNs. The approach works for both FLVs as well as (hinted) MP4 video files.
ps: Would you like to know how to modify or write a flash video player that would download videos in segments or chunks instead of the entire thing at once? Let me know via the comments. If I get enough requests, I’ll write up a post explaining various approaches on how to do it. Else, I’ll assume you are a smart bunch that knows how to do it.