Video Compression

VideoNerd

There are two main approaches to adapt bitrate:

1) Stream Thinning – removal non-reference frames

2) Bitrate Adaptation via Downscaling of input frames (or dynamic resolution methods)

 

Stream Thinning

Stream thinning (also called Bitrate Peeling or Frame Skipping) is a method to drop frames from the stream (in order to reduce bandwidth for example due to network congestion). The stream thinning method is simple and can be performed by Middle Boxes (e.g. a gateway), since neither deep parsing nor re-encoding required.

However, removal of encoded frames can incur so called drift errors and visual degradation. 

Example of drift errors due to removal of used for reference frame (drift errors are circled, the pictures are taken from the paper “Bit Rate Transcoding of H.264 Encoded Movies by Dropping Frames in the Compressed Domain” by Spyridon K. Kapotas et al., 2010)

 

Bitrate Adaptation via Downscaling (Dynamic Resolution)

if network bandwidth is lowered then one of methods is downscale of input frames, encode the downscaled frames, transmit with lower rate to a client. On the client’s side the stream is decoded and up-scaled (the upscaling is necessary, since the aspect ratio is commonly not preserved in downscaled images):

 

Note: In the paper  “Improving Streaming Quality and Bitrate Efficiency with Dynamic Resolution Selection” by Xavier Ducloux et al.  the method of Dynamic Resolution Selection is proposed and elaborated. Choosing correct per-scene resolution can save bandwidth without compromising visual quality:

 

For each scene different resolutions are checked and the minimal resolution passing a visually lossless barrier is chosen.  Basing on well-known empirical fact – around scene changes the visibility of visual distortions are reduced. Therefore the change of resolution at scene cuts apparently would not inflict visual quality flickering effect.

The above Dynamic Resolution method is not suited well for live video applications due to multiple iterations to find optimal resolution. 

However, the authors uses Machine Learning to find optimal resolution for each scene without iterations, this solution is tailored for live applications:

 

How to Drop Frames without Causing Visual Degradation?    

Answer:  Remove frames which are not used for reference.

Indeed, if unused for reference frame (usually B-frame) is discarded from the stream then no drift error is produced (because non-reference frame is not used for prediction of next pictures and its removal obviously does not impact on next pictures). It’s worth mentioning that video artifacts like stuttering might be observed (under some circumstances even if a single frame is dropped).

On the other hand, if used for reference frame is discarded from the stream, then drift errors are generated. The errors tend to accumulate and to cause video quality degradation until next IDR frame (or intra-refresh sequence) received to clean up the impairments. Even if drift errors are non-perceptible at the beginning they tend to be quickly accumulated and get very perceptible and annoying after a number of frames.

Thus, stream thinning techniques are based on removal of unused for reference frames in order to avoid drift errors.

For example, let’s consider the following GOP structure: IPbPb… (here ‘b’ denotes unused for reference B frame). If the stream has such GOP structure then we can drop safety any B-frame without causing a drift error. Consequently, the bitrate is significantly reduced as well as the frame rate.

Under some circumstances we can drop even “used for reference frames”. E.g. if such used for reference frame at the end of a GOP, i.e. it is immediately followed by IDR frame.

For H.264/AVC and H.265/HEVC the parameter  nal_ref_idc in NALU header signals whether current frame is used for reference or not. Therefore Stream Thinning technique can be easily implemented at middle boxes in the network (neither deep parsing nor re-encoding is required).

 

Conclusion

Advantage of Stream Thinning:

  • Stream thinning technique is simple and can be executed without stream parsing and re-encoding, only checking NAL headers is required to know whether frame is used for reference or not.

Disadvantages of Stream Thinning:

  • Stuttering might be observed due to drops of frames
  • Maximal bitrate reduction depends on GOP structure (roughly speaking on the percentage of non-reference frames in GOP). It’s not uncommon that target bitrate reduction (without drift errors) can’t be achieved due to small percentage of non-reference frames or even absence of non-reference frames .

Illustration: Computer generated content is characterized with very small B-frames. For example, in IPbPb GOP structure, non-reference B-frames are 3x-4x smaller than surrounding P-frames. For such streams the maximal bitrate reduction by means of non-reference B-frame dropping is about 25%-30%.

In worst scenario the stream can’t be lack of non-reference frames at all (e.g. IPPPP GOP structure where each frame is used for reference). In such case Stream Peeling technique is irrelevant or incurs drift errors.

 

Use Case of Stream Thinning

Low-Delay with non-reference B-frames:

P1 and P2 are P-frames since they have only single reference (IDR).

B3,B4,B5 and B6 are general B-frames, they have two references and prediction can be bi-directional or uni-directional.

Removal of P1, B3 and B5 will not incur drift errors since these frames are not used for reference.

 

Stream thinning is closely related to temporal scaling, the following example shows how hierarchical GOP structure can be used for bandwidth adaptation:

IP frames constitute the basic layer – 15 fps

Addition of yellow B frames constitute 30 fps

Addition of green B frames constitute 60 fps

Thus, if you remove the green B-frames you reduce the frame rate (and the bandwidth respectively) from 60fps to 30fps.

 

However B-frames are not used in low-delay applications (due to reordering), the following example shows how to construct GOP with hierarchical P-frames:

16 Responses

  1. You really make it seem so easy together with your presentation but I in finding this topic to be actually one thing which I believe I’d never understand. It sort of feels too complicated and very huge for me. I’m having a look forward for your subsequent submit, I will attempt to get the grasp of it!

  2. I have been exploring for a little for any high quality articles or blog posts in this sort of area . Exploring in Yahoo I finally stumbled upon this web site. Reading this info So i am happy to show that I have a very excellent uncanny feeling I found out just what I needed. I so much surely will make certain to don¦t overlook this web site and give it a glance on a relentless basis.

  3. I’m impressed, I must say. Seldom do I come across a blog that’s both educative and entertaining, and without a doubt, you have hit the nail on the head. The problem is something not enough people are speaking intelligently about. I’m very happy I stumbled across this during my search for something regarding this.

  4. I’m extremely impressed with your writing skills as well as with the layout on your weblog. Is this a paid theme or did you customize it yourself? Anyway keep up the nice quality writing, it’s rare to see a great blog like this one today..

  5. Hiya very cool site!! Guy .. Excellent .. Amazing .. I’ll bookmark your site and take the feeds additionally?KI’m satisfied to seek out a lot of helpful info here within the publish, we’d like work out extra techniques in this regard, thank you for sharing. . . . . .

  6. I’ll immediately grab your rss feed as I can’t find your e-mail subscription link or e-newsletter service. Do you’ve any? Please let me know in order that I could subscribe. Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *