X264 encoder option analysis (x264 codec strong and weak points) 2

Source: Internet
Author: User

The previous article briefly translated the x264 option (encoding option, which is later called the English name) analysis report of x264 codec strong and weak points. The previous part is relatively basic, and the subsequent content is much more complicated. This article continues with the content of the previous article and briefly records the following content.

In the previous article, the preset of x264 is analyzed using the method of "colored cloud map. The advantage of the "color cloud image" method is that it is clear that different options have different values on the video quality and encoding speed. However, the analysis of "colored cloud images" has limitations. The key lies in that the option on x264 can only be qualitative for analysis, rather than quantitative analysis. If you want to quantitatively draw a chart, you also need several methods described below.

The methods described below can be used to quantitatively analyze the x264 option. Draw charts based on different situations.

 

Lambda preset Analysis

Encoding speed and quality are important for video encoders. However, these two factors are too different, so it is difficult to compare them. If the speed and quality of a preset are higher than those of another preset, we can say that the previous preset is better. However, if one preset is faster than the other, but the quality is lower than the other preset, how can we compare it? In extreme cases, we can use subjective methods for comparison. For example, if preset a is twice faster than preset B, but the bit rate is 0.1% higher, we can say that preset a is better than preset B. To quantitatively study the above problem, we introduce the parameter λ to represent the ratio between the expected encoding time and the expected quality.

λ = the expected encoding time is better/the expected quality is better

A larger λ indicates that the desired speed is more important than the quality. (If λ is infinite, it only pursues the fastest speed, and the quality is insignificant ). The smaller λ means the opposite.

We will analyze the data in the following ways:

1. Calculate the λ Value of all presets.

2. Select "preset of the first 10%" based on the λ Value ".

3. Select different λ values to get their "preset of the first 10%", and finally obtain the experiment results.

Note that the following figure shows the steps of the experiment.


Select Lambda

One of the difficulties in this experiment is the value of λ. The value process is not described in detail. Finally, multiple λ values of 0.01-7 are selected. A larger λ indicates that the speed is more important than the quality (If λ is infinite, it is expected that the speed is the fastest and the quality does not matter ). The smaller λ means the opposite.

 

Select "preset of the first 10%" based on the λ Value"

There are many mathematical methods, which are tedious to describe, and you have not gone into depth. I would like to understand the method of selecting "preset OF THE FIRST 10%" and briefly describe it.

The purpose of filtering is to find a part of the preset with better speed and quality. As analyzed previously, the more on the left of the experiment result graph, the faster its preset is. The more it is located below, the better its preset quality is. Therefore, the preset at the bottom left is the best. The key issue is to select the points at the bottom left. The following formula is used in the experiment:

M = λ T + q

This is a common linear function. The slope is λ, the horizontal coordinate T is relative time, the vertical coordinate m is relative bit rate, and the intercept Q is an indefinite number. In this way, when a λ is selected, a straight line with a fixed slope and changeable intercept is determined (the pink and blue lines in the middle ). Let's assume that the intercept of this line is gradually increased from 0. When it hits the first point, it is the preset with the optimal λ Value (because it is the closest to the bottom left, such as the red star point ). Then the linear intercept continues to increase, and more points will be encountered. Until 10% of the total points are obtained (the light blue point in the middle ). At this point, all vertices encountered in a straight line can be listed as "preset of the first 10%" under the λ ".


The following figure lists the distribution of the "first 10% preset" points under different λ conditions. The smaller the λ, the more points are distributed below the chart (for example, λ = 0.01, λ = 0.02 ). Representing the expectation of better encoding quality. The larger the λ, the more points are distributed on the left side of the chart (for example, λ = 7 ). Indicates that the encoding time is expected to be better.




The final analysis is to analyze the above "preset of the first 10%" points. Other points not listed in the upper-right corner of the chart are not included in the data analysis scope of this experiment. We can see that the data in this experiment mainly analyzes the points at the bottom left of the graph table (that is, the preset with better performance). Different λ are used for different analysis points.

Lab results

The final analysis conclusions are as follows. For each option, you can get a result chart with the X coordinate of λ (Q/T in the figure). A larger value indicates a better time (that is, a faster speed ), the smaller the value, it indicates that the expected quality is better (the quality is better, and the length of time does not matter). The vertical coordinate is the percentage, representing the proportion occupied by each option value.









The final analysis results of each option are shown in the following table.


The final analysis result is shown in the following table. The following table lists the values of λ in different ranges (the smaller the value, the higher the quality requirement; the larger the value, the higher the speed requirement; of course, the table also contains the corresponding time and bitrate) values that are most suitable for each option.



Preset Analysis of distance convex hull (convex hull)

The "Lambda preset analysis" method described in the previous chapter focuses on the analysis of the preset at the bottom left of the experiment data chart. These presets belong to the "good" preset. Either high quality, fast speed, or high quality and speed. The preset Analysis of distance convex hull introduced in this chapter is very different from that in the previous chapter. This chapter measures all presets. The general idea is to divide the preset into presets of different "quality": the preset close to the convex bag (in the lower left) is "excellent"; the preset is far from the convex bag (in the upper right corner) the preset belongs to the "poor ". Finally, the distribution of the values of each option under the "quality" of different presets is obtained.

PS: convex hull can be understood as an envelope


The algorithm is not detailed. Let's talk about the charts in the experiment. Based on the distance between each preset and the convex packet in the experiment result chart, different presets are divided into different categories. Preset of 1-10, 11-20, 21-30, 31-40, 41-50, 51-60 are listed and marked as different colors. The green point is the preset that is not in these categories.



The preset of 62-70, 71-80, 81-90, 91-100,101-110,111-120 categories are listed and marked as different colors.


Lists the number of vertices of different types. We can see that the number of vertices in the next few categories is slightly smaller.


The final analysis conclusions are shown in. Each option corresponds to a chart. The X-axis is the class defined based on the distance from the convex hull as described above. The Y-axis is the proportion of different option values.

 







The final analysis results of each option are shown in the following table.


Analysis of Different Video Sequences

The main purpose of this section is to verify the rationality of the method described above. The method described above only uses one test video sequence. In the actual environment, the video content is diverse. Therefore, it is necessary to determine that the method proposed in this report also applies to other videos. Otherwise, the study in this report will be meaningless. The following lists the experimental results of three standard test video sequences: "bus", "news", and "Stefan ". A simple description of the meaning of a table: Each chart corresponds to the experimental results of a test video sequence. In addition to the experimental results of the test video sequence, the other two test video sequences are located on the convex hull and marked in different colors.

As a result, even though the video content is different, the points on the convex hull are close to an envelope. That is to say, the "best preset" is not affected by the video content (of course, there is still a little bit, but the degree is not big ).





This report uses the "bus" test video sequence experiment results.


Summary

This report uses four methods to analyze the x264 option:

1. Use convex hull to analyze the optimal option.

2. Use the "color Cloud Chart" to analyze the option. This method is simple and intuitive, but cannot be accurately quantified.

3. Use Lambda parameters to analyze option. This method can analyze the trade-off between the speed and quality of option.

4. Use the option for Convex packet distance analysis. This method can analyze the options of "good" and "bad.


X264 encoder option analysis (x264 codec strong and weak points) 2

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.