Tech Support Posted February 7, 2017 Share Posted February 7, 2017 For a video site most of the bandwidth is being used for serving videos. In many cases you will have a limited channel like 100mbit or 1000mbit, so you will not save any money by saving bandwidth, however there are several cases when saving bandwidth can make great benefit for you: When your channel is fully loaded with serving videos, your site may become unresponsive for some users and you may get SEO penalty. One solution is to buy a new server or extend bandwidth limit, but you can save this money with KVS by trying to limit video streaming speed. When you are using CDN, in most cases you pay for the maximum bandwidth peak. You can save some money by paying less if your maximum peak becomes less. Why limiting streaming speed can save your bandwidth? Many users do not watch videos in full length, they may skip up and down to different fragments. However if their internet speed is high, they can download full video at a max speed shortly even if they didn't watch most of it. With a speed limit you will reduce % of downloaded bandwidth by each user and finally you will get some cut in your global bandwidth usage. KVS provides 2 way to limit video streaming speed: Limit speed to fixed bitrate. This is not a good solution, since it can be inaccurate in many cases - since video bitrate is often dynamic and you won't know the exact bitrate to limit. Limit speed to dynamic bitrate with a multiplier. This option is much better as it will make sure different speed limits for videos of different bitrates and you don't need to investigate the average bitrate of your videos. However, there is one important issue which you should know about streaming MP4 files. Each MP4 file has a metadata atom in the beginning (MOOV atom). This atom contains keyframes from video file and can take up to 4MB depending on video duration and geometry. Player needs to download this atom before it can start playing videos. Therefore if you limit download speed, your videos will start playing with a big delay. However Nginx provides a way to fix that, we will describe this later. NOTE: limiting streaming speed is only possible with serving videos with Nginx or CDN. In case of CDN the implementation of speed limit is fully dependent on your CDN provider (BTW some CDNs are not interested in doing this for an obvious reason). KVS will pass speed limit info to the CDN integration script, which may or may not use it - but this is not KVS issue. How to configure download speed limit In KVS you can configure download speed limit per each video format separately. Go to Settings -> Video formats and for each video format you can set speed limit: Global speed limit: Dynamic bitrate x 1.2 (we recommend multipliers from 1.1 to 1.5) You can set other options under Speed limitation section as needed. For example you can give your premium or active members unlimited download speed. You can also limit speed for visitors from certain countries only, so that you main audience is not affected. In order to define list of countries you want to limit please take a look at Stats -> Countries for reference. 1 Quote Link to comment Share on other sites More sharing options...
RafaelSkign Posted March 7, 2017 Share Posted March 7, 2017 How to save bandwidth with KVS tube script What is up with the Store. Â*The last 2 days when I go to Buy the full tutorial it tells me something is wrong? Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 8, 2017 Author Share Posted March 8, 2017 What is up with the Store. Â*The last 2 days when I go to Buy the full tutorial it tells me something is wrong? I'm not sure what store you are talking about? You do not need to buy any tutorial here, they should be available publicly. Quote Link to comment Share on other sites More sharing options...
Guest xvids Posted March 11, 2017 Share Posted March 11, 2017 Hi KVS Team, Thanks for the nice tutorial...:cool: I have added the rule in Nginx config limit_rate_after 4m; with 4MB because I think some on website have HD and Full videos But I'm little bit confuse this line./ as you said (we recommend multipliers from 1.1 to 1.5) Please suggest me which number is good for HD and Full videos Global speed limit: Dynamic bitrate x 1.2 (we recommend multipliers from 1.1 to 1.5) Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 12, 2017 Author Share Posted March 12, 2017 Please suggest me which number is good for HD and Full videos It doesn't matter which video size or duration you have. Normally you should allow bitrate multiplier as 1.0, since you want player to buffer only video fragment which is being playing at the moment. However in many cases bitrate is not constant, it varies for different video fragments. So setting 1.0 will most likely be not accurate and users will experience interruptions in playback. That's why you need to configure value higher than 1.0 to ensure video is buffered little bit faster than it is played. You can test online by putting 1.2 and see how fast the buffer will become longer than played part. If you set 1.5 buffering will be even more faster and you will save less traffic. Basically 1.2 should be enough. Quote Link to comment Share on other sites More sharing options...
Matyko42 Posted March 29, 2021 Share Posted March 29, 2021 Hi, I've just heard this limitation can significantly increase the server load. What do you think? Maybe there should be a 2021 edition of this tutorial - not sure if the 'game' changed That Much though... Quote Link to comment Share on other sites More sharing options...
Tech Support Posted March 30, 2021 Author Share Posted March 30, 2021 10 hours ago, Matyko42 said: I've just heard this limitation can significantly increase the server load. Nope, never heard of anything like this. 10 hours ago, Matyko42 said: Maybe there should be a 2021 edition of this tutorial - not sure if the 'game' changed That Much though... Yes, the game changed by HLS adaptive streaming, but KVS still doesn't support that. We will change this article after finalizing HLS support in KVS. 2 Quote Link to comment Share on other sites More sharing options...
mongoose657 Posted July 17, 2021 Share Posted July 17, 2021 With the dynamic bitrate multiplier for speed limits, is the configuration with "limit_rate_after" on nginx still required? Does this mean the bitrate multiplier speed limit will start working after the "limit_rate_after" value from the nginx config? Quote Link to comment Share on other sites More sharing options...
Tech Support Posted July 17, 2021 Author Share Posted July 17, 2021 Yes limit_rate_after is still required for MP4 files. It doesn't matter if you use dynamic or fixed bitrate. The purpose of using limit_rate_after is to allow metadata of MP4 file being downloaded as quickly as possible, otherwise video playback will be started slowly. 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.