THEO Blog

Encoding for Cost Efficient Streaming

Our previous blog post, Basics of Video Encoding: Everything You Need to Know, we discussed the different aspects of encoding and the different video codecs that are currently being used, or are looking to be adopted in the industry. In this post, we will focus on key ways to stream online video efficiently by optimising video encoding.

Creating a cost efficient online video streaming infrastructure, without sacrificing the final quality of experience, can present challenges. When looking at which part of your video infrastructure to focus on, encoding is crucial for cost efficiency, and the codec that’s used should be determined by the alignment with the use case.

For example, for one stream audio could be the most important (i.e. concert or musical event), where as in other situations you will need to optimise for stream quality, higher frame rates or the available bandwidth, such as in fast motion movies like sporting events compared to video content containing static landscape webcams.

 

It’s important to remember that efficiency in codecs immediately leads to smaller file sizes. For example, if a video codec claims that it is 50% more efficient than another codec, it simply means that file sizes are 50% smaller.

The compression of the file undergoes a lossy process, or the removal of irrelevant information that is related to the file or video. As explored in the previous blog post, this compression is done through motion compensation, macroblocking, chroma subsampling, and for audio, quantization is used. When the video file is played back, it is played as an approximation of the original. The more information that is removed from the file during compression, the worse the quality of the final stream will be - so there has to be a happy medium.

To find a balance, there are a set of recommended encoding configurations for the video settings, video bitrate, frame rate audio settings and audio bitrate. The frame rate is described as the speed of which the frames of the video are shown. The higher the frame rate, the smoother the video, and likewise the slower the speed, the more disjointed and choppy the video is viewed in playback. Audio bitrate will vary depending on use case, but it is important to remember that if the end viewer is having trouble hearing the stream when they need to, there’s a higher chance they’ll abandon the stream all together. The video bitrate can be the more challenging aspect to predict with the use case and the quality. If Adaptive Bitrate (ABR) is used, the bitrate will configure based on the factors in play and what bitrate it can support. 

The video and audio codecs which are recommended by our THEO experts for an efficient stream are:

  • Video: H.264 in Baseline Profile, Main Profile or High Profile. We advise against the usage of B-frames, as this requires the entire chunk to be available before playback can start. It is important to take into account that not all platforms will be able to play back the High profile. When setting up encoding profiles, keep in mind the platforms you intend to support.

  • Audio: AAC-LC or HE-AAC. It is however important to use the same codec for all audio tracks. Using the same sampling frequency and bitrate is not required, but deviating from this might result in audible changes between streams. Also, when using HE-AAC it is highly recommended to state this in the stream's CODEC-attribute.

With regards to packaging, both raw-audio files (.aac, .mp3, ...) and MPEG Transport Streams can be used. For video, it is recommended to add a full IDR frame (keyframe) at the start of each video chunk.

The following configurations for adaptive streams have proven to work well on most content. Keep in mind some content can be displayed better when tweaking these parameters:

Encoding cost efficient blog visual-02

 

If you have any questions about configuring your codecs for the best stream for your use case, contact our THEO experts.

CONTACT US

 

Subscribe by email