About Products Support FAQ Blog

HEVC codec comparison from Moscow State University. How to improve results

image

 

  By Olga Krovyakova - modified October 6, 2023, created April 3, 2019.

 

TRY ZOND 265 FREE

 

In October 2015 the Graphics & Media Lab Video Group of the Computer Science Department of Moscow State University (CS MSU Graphics & Media Lab) issued another codec comparative review, this time including several HEVC format codecs.

 

The starting point to this research was us noticing the difference in presets for AVC and HEVC tests. For AVC, an unmodified fast profile with a single GOP was used, whereas a modified profile with several GOP was employed for HEVC testing. Besides, the x264 coder showed better results than x265 on fast transcoding in SSIM/bitrate correlation diagrams regardless of encoding speed – for “Apple Tree”, the only file described in the open report. A question arose immediately: what if these or some other evident options could change the picture?

The report compares presets but doesn’t recommend any related improvements. In this article, we conducted a similar review and developed recommendations for modifying the x265 encoder presets. For the video sequence identical to the one analyzed in the free version of the report, our suggested changes of encoding parameters help to increase compression efficiency, and rehabilitate the x265 coder on report diagram building.

The modified presets do not have any claims to universality, since testing on multiple video sequences is beyond the scope of this research. However, they can be recommended as a point of departure for seeking opportunities to improve x265 encoding efficiency.

 

About the project

The task of video encoding in the process of multimedia processing, be it transmission, cutting, editing or storage, is omnipresent in application/service development and configuration in the course of operation. Due to a large quantity of popular video codecs available, often of the same type, it’s not easy to pick the best one and then apply the right settings. It’s most likely that these considerations have encouraged the ongoing video comparison project started and operated by the Lab of Computer Graphics and Multimedia of CMC MSU in the years 2000. In October 2015 they issued a codec comparative report that enrolled several HEVC format codecs and other codecs under active development. x264 was chosen as the model compressor in their report. One of other interesting compressors mentioned therein was x265. It's this format that will comprise the main subject of our study.

The tool for analysis is SolveigMM Zond 265, a HEVC/H.265 and AVC/H.264 analyzer.

image

The methodology of codec comparison and parameter selection


Let’s describe the methodology. The comparison is conducted based on these criteria: bitrate – quality (SSIM, PSNR) – performance. The methodology for comparing the correlation of bitrate/metric quality (see point C4) is as follows.
We select several bitrate values (for example, 7 values: 1, 2, 4, 6, 8, 10 and 12 Mbps), and calculate all necessary quality metrics for each codec.

We place the output values on the diagram: quality metric (horizontal axis) – bitrate (vertical axis).

  1. We make a linear interpolation.
  2. We select a maximal range where all diagrams are defined, and detect areas under all diagrams therein.
  3. As aquality measure of a specific codec (or preset) we take the relation of its area to the area of the model codec. The smaller the value received, the more effective the codec.

As a model, we select x265 with the preset chosen in the report (table 1). The report uses a previous version of the compressor that can be found here: x265 1.5+460-ac85c775620f. However, the latest version doesn’t bring along any radical changes.
The used compressor presets are indicated in table 1 (for the desktop platform).

Table 1. Settings of the x265 compressor in MSU HEVC Video Codec Comparison report.
 
Ripping x265 -p veryslow --bitrate %BITRATE_KBPS% %SOURCE_FILE% -o %TARGET_FILE% --input-res %WIDTH%x%HEIGHT% --fps %FPS%
Universal encoding x265 -p medium --bitrate %BITRATE_KBPS% %SOURCE_FILE% -o %TARGET_FILE% --input-res %WIDTH%x%HEIGHT% --fps %FPS%
Fast transcoding x265 -p ultrafast --ref 3 --bitrate %BITRATE_KBPS% %SOURCE_FILE% -o %TARGET_FILE% --input-res %WIDTH%x%HEIGHT% --fps %FPS%
 

To suggest preset modification recommendations, we conduct a test of all preset-forming settings to evaluate their individual impact on quality and performance. Here's the action plan:

  1. We code the file changing every preset parameter: from fast transcoding to the universal, from the universal to ripping, while saving the coding time.
  2. We calculate the quality measure (in the same way as area above) and referential coding time (the minimal value of FPS coding for the file "preset-modified parameter" relative to all selected bitrate values).
  3. From the table consisting of a changeable parameter, quality measure and minimal FPS, we choose the parameters that can be used to improve the presets.


We limit ourselves to the presets for universal encoding and ripping (table 2), unlocking the parameters "-p medium" and "-p ultrafast". We also add two more that were omitted in the report: "--keyint -1 --tune ssim". We supplement the presets with the mentioned parameters for fast and universal transcoding, respectively.

Table 2. Parameters – candidates for modification of the MSU HEVC Video Codec Comparison report presets.

 
Universal encoding --rc-lookahead 20 --scenecut 40 --ctu 64 --min-cu-size 8 --bframes 4 --b-adapt 2 --subme 1 --me hex --early-skip --sao --signhide --weightp --rd 3 --aq-strength 1.0 --aq-mode 1 --cutree --no-fast-intra
"Ripping" --weightb --amp --rect --rc-lookahead 40 --bframes 8 --tu-inter-depth 3 --tu-intra-depth 3 --rd 6 --rdoq 2 --psy-rdoq 1.0 --subme 4 --max-merge 4 --me star --ref 5 --b-intra --lookahead-slices 0

 

Testing


There is no download link available for the test sequence "Apple Tree" (pic. 1) used in the free version of the report. We’ll choose a similar one using its key feature – close-up, a large quantity of small details. For example "big_buck_bunny_1080p_h264.mov", the interval of 338 frames from second 24:

ffmpeg -i big_buck_bunny_1080p_h264.mov -ss 00:00:24 -frames:v 338 -c:v rawvideo -pix_fmt yuv420p sample.yuv

image

Pic. 1. Characteristics of the sequence "Apple Tree"

In order to realize three steps of the plan above and save time copying out the necessary figures from the Zond 265 interface, it’s convenient to use the command line operation feature (table 3):


zond265_x64 %COMPRESSED_FILE% -iref %REFERENCE_420P_FILE% -nowait -report t=quality,statstream qm=SSIM o=%TARGET_CSV_FILE%


You can view the list of all parameters and their full description at the Zond 265 page.

Table 3. Parameters of theZond 265 command line required for script compilation.

Parameter Description
-iref Setting the reference YUV file
-report Indicating the Zond 265 operation mode in the command line
t=quality,statstream Generation of two reports selected: quality and video stream statistics.
qm=SSIM Quality metric for calculation
o Path to the report file in CSV format
-nowait Pause-free. Zond 265 automatically navigates from file to file without delay.
 

Here are two scripts for Python 2.7: one for encoding 266 files (20 settings for the first, 18 settings for the second preset, for 7 bitrate values: 1, 2, 4, 6, 8, 10, 12 Mbps), the other for compiling a report in CSV format (the file – the relation of FPS encoding to the model configuration – the relation of SSIM metric to the model configuration). 

As you can see in the report tables for the file fragment "big_buck_bunny_1080p_h264.mov" (tables 5 and 6), configurations can be modified, for example, as it’s indicated in table 4. Just a reminder, for better results the "Quality Measure" value should be less than unity, and the "Relative Coding Time" value – greater then unity.

The test has been performed using the following hardware configuration: Intel Core i7-2600@3.4 GHz, 16 GB RAM. The greatest quality improvement for configuring fast encoding is rendered by the "--min-cu-size 8" parameter, in case of universal encoding it’s the"--rdoq-level 2" parameter (however, it slows down encoding the most).

Table 4. Modifying the presets of the MSU HEVC Video Codec Comparison report for improving encoding efficiency with the same encoding speed.

Fast transcoding x265 -p ultrafast --ref 3 --rc-lookahead 20 --min-cu-size 8 --bframes 4 --early-skip --cutree --tune ssim --bitrate %BITRATE_KBPS% %SOURCE_FILE% -o %TARGET_FILE% --input-res %WIDTH%x%HEIGHT% --fps %FPS%
Universal encoding x265 -p medium --weightb --bframes 8 --tu-intra-depth 3 --psy-rdoq 1.0 --b-intra --lookahead-slices 0 --tune ssim --bitrate %BITRATE_KBPS% %SOURCE_FILE% -o %TARGET_FILE% --input-res %WIDTH%x%HEIGHT% --fps %FPS%
 
 
Table 5. The report on modifying the preset of fast transcoding
image

Table 6. The report on modifying the preset of universal encoding.

image
You can easily check whether the options were selected correctly by launching the encoding script with modified presets (table 7).
 
Table 7. Encoding efficiency using modified presets in relation to the presets of the MSU HEVC Video Codec Comparison report.
 
Configuration Quality measure Relative encoding time
Fast transcoding (model) 1 1
Fast transcoding (modified)  0.69  0.97
Universal transcoding (model)  1  1
Universal transcoding (modified)  0.85  0.94
 

Let’s evaluate the impact of options modification  – in Zond 265 we open the file encoded with the modified preset in fast transcoding mode for the bitrate of 8 Mbps and compare it with the file encoded with the unmodified preset. The size of the largest encoding unit remains unchanged and equals 32x32 (field "--ctu 32"). However, the size of the minimal unit lowers from 16 to 8 (field "--min-cu-size 8"). It is this parameter that delivered the greatest quality improvement. The number of B-frames increased from 3 to 4 (field "—bframes"), however the maximal number of reference frames (field "--ref 4") increased as well. The field "SSIM" marks two maximal values for the diagrams SSIM/PSNR for three components: brightness (Luma) and two color components (Cb, Cr). Their values increased from 0.9623-0.9966 to 0.9771-0.9991. The remaining additional parameters (--rc-lookahead 20 --early-skip --cutree) influence the encoding algorithm but not the type of output video, this is reflected in coding speed mainly (see table 5). It’s worth mentioning that the picture of the decoded frame has visually changed – encoding artefacts are not displayed anymore.

 
image

Pic. 2. Screenshot of a Zond 265 file encoded using the modified fast encoding configuration

You can equally check the parameters of the encoded file with a modified и unmodified universal encoding preset (pic. 3). The size of minimal TU partitions hasn’t changed and remains equal to 4x4 (field "--tu-intra-depth 3"), the number of B-frames has also remained unchanged and equals 3 (field "--bframes 3"). SSIM increased from 0.9789-0.9994 to 0.9811-0.9992. Compared to the quick transcoding configuration, the size of the maximal unit has increased and now equals 64x64 (field "--ctu 64"), the SAO filter has been added (field "--sao").

image

Pic. 3. Screenshot of the Zond 265 file encoded using modified universal encoding configuration

As a result of the testing performed, we suggest a list of options for improving encoding efficiency (improvement of SSIM metric value with the same bitrate and coding speed) for the fast and universal encoding configurations. Using suggested changes for the file with a large quantity of small details, the value of integral "quality measure" of the MSU HEVC Video Codec Comparison report improved by 31% on fast transcoding, and by 15% on the universal transcoding, with an insignificant change of encoding speed. Since the testing was made separately for each option, in practice it only makes sense to pick several convenient options rather than the whole suggested list.

References

  1. HEVC Video Codecs Comparison
  2. Blender Foundation | www.blender.org
  3. Zond 265 home page

 

TRY ZOND 265 FREE

 

 

 About the author

imageOlga Krovyakova is the Technical Support Manager in Solveig Multimedia since 2010.

She is the author of many text and video guidelines of company's products: Video Splitter, HyperCam, WMP Trimmer Plugin, AVI Trimmer+ and TriMP4.

She works with programs every day and therefore knows very well how they work. Сontact Olga via support@solveigmm.com if you have any questions. She will gladly assist you!