CodeBlocks

Sunday 12 May 2013

x264 Settings Comparison - Reference and BFrames

So its been a while since my last post, its quite difficult to find time for everything these days. So in this post im going to cover Reference frames, BFrames fast/optimal, since these don't influence quality and only compression, there is no need for screenshots.

Reference Frames
Default - 3
Controls the size of the DPB(Decoded Picture Buffer). Values range from 0-16. This is the number of previous frames each P-frame can use as a reference. 

Using more refernece frames increases memory usage and cpu load during playback, caused by having all the decoded reference frames in memory during playback. This can cause mobile devices or players to be unable to playback the video.

B-Frames
Default - 3 Fast
Sets the maximum number of consecutive B-Frames. B-Frames are capable of using motion prediction of future frames, this can lead to a significant compression gain.

Two different method to determine B-Frames, Fast and Optimal.

Reference Frames Compression

Futurama SD



Filesize Speed over reference frames
Performance compared to Medium

Reel Steel SD

Filesize speed over reference frames

Performance compared to Medium

Reel Steel HD

Filesize, Speed over reference frames

Performance compared to medium


It seems like animation benefits more from extra reference frames, than the live action, however the compression gained tapers off very quickly and appear to bottom out at around 8 reference frames. Interestingly the performance loss also tapers out.


B-Frames

Futurama SD


Fast Method
Optimal
Fast Method
Optimal
 

Reel Steel SD

Fast


Optimal
Fast
Optimal


Reel Steel HD

Fast
Optimal
Fast
Optimal

B-Fast method seems to have a near consistent speed regardless of the number of B-Frames and B-Optimal seems to slow down at a constant rate, however optimal performs much better at compression than fast with about 6% more compression, with only 5% speed impact.

Conclusion

Whilst the number of reference frames does improve performance it can cause other playback issues in memory and speed and the compression gained is not that significant. A safe value is 3, more than that and the compression gained for speed lost is large.

In BFrames we saw that optimal does a far better job at compression than Fast, but at a slower rate at around beyond 4 BFrames both start looses compression with some even doing worse at high values than lower ones. Also at 4 BFrames optimal is only marginally slower than Fast but provides about 6% extra compression

Recommended

Reference Frames : 3-5
B-Frames: Optimal : 3