In times of high bandwidth utilization, you may wish to temporarily restrict the bitrates that are available in a streaming manifest to provide your customers a better streaming experience. Typically when encoding video with Azure Media Services, multiple streams with different bitrates are created. This allows clients with different connection speeds to select the most appropriate bandwidth for playback. Under normal circumstances this provides the best streaming experience for most clients. However, to reduce the bitrates offered you can use filters to temporarily limit the bandwidth that clients select for streaming.
There are several different features that filters provide when you need to restrict delivery during streaming. These include the ability to change the start and end times of a video, deliver only specific language tracks, etc. Also, filters can be applied to individual assets or globally. A global filter applies to the entire account. The feature that can be used to reduce bandwidth is the bitrate option. You can use the Azure CLI along with JSON to create a filter. The allowed bitrates can be set using a simple range. Note that you will need to make sure that the video assets you are applying this filter to have bitrate streams within the range you are specifying in this JSON.
There are several methods of creating a filter for Media Services including the Azure CLI, the .Net SDK, and PowerShell. One of the easiest is to use the ‘Try It’ option from within the Media Services REST documentation at https://docs.microsoft.com/rest/api/media/accountfilters/createorupdate. Navigate to this page, and beside the example PUT URL for creating a filter, click on Try It.
You will need to sign in to your Azure subscription if you’ve not already done so. Specify values for the subscriptionId, resourceGroupName, and accountName parameters for your Media Services account. Next define the name of your filter by specifying a value for the filterName parameter. The default value for the api-version parameter can be left as is and you do not need to add any additional parameters or headers. Finally, paste the JSON below into the Body section of the form. This JSON will restrict the bitrate to 3 Mbps via the line: "value": "0-3000000". If you need to increase or decrease the maximum bitrate, you can adjust this value.
Since the filter is globally available for the entire Media Services account, any manifest URL request can use this same filter parameter.
In addition to reducing the bandwidths available to clients, you can increase the resources that are available for streaming. There are two types of Media Services streaming endpoints. Premium streaming endpoints are suitable for advanced workloads and providing dedicated and scalable bandwidth capacity. The steps to scale premium endpoints are in https://docs.microsoft.com/azure/media-services/previous/media-services-portal-scale-streaming-endpo.... If you are using a standard streaming endpoint, it is a good idea to switch to a premium streaming endpoint prior to a large event so that you can scale without interruption.
During high demand events, you can monitor the streaming endpoint with diagnostic logging to best know, if you need to scale the premium streaming endpoint streaming units up or down based on the current load. Keep in mind that it can take a few minutes for additional streaming units to come online.