Video coding method and device

By adaptively adjusting the encoding parameters based on motion complexity in video encoding, the problem of unsatisfactory encoding effect in frequent scene switching of video content is solved, and refined control of video frames in different scenes is achieved and bandwidth savings are achieved.

CN118945352AInactive Publication Date: 2024-11-12ALIPAY (HANGZHOU) INFORMATION TECH CO LTD

Patent Information

Application Number
CN202411420144.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-11
Publication Date
2024-11-12
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The existing fixed code rate factor (CRF) control mode cannot achieve refined control of video frames in each scene in video content with frequent scene switching, resulting in unsatisfactory encoding effect.

Method used

By determining the motion complexity of the video frame based on the peak signal-to-noise ratio mean, quantization parameter mean and bit number average per pixel, and adaptively adjusting the encoding parameters according to the motion complexity, encoding the next image group, thereby realizing the different scenarios Fine regulation of video frames.

Benefits of technology

The effect of video encoding is improved, especially in video content with frequent scene switching, the picture quality can be maintained, transmission bandwidth can be saved, and video data transmission costs can be reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118945352A_ABST
    Figure CN118945352A_ABST
Patent Text Reader

Abstract

One or more embodiments of the present specification provide a video encoding method and apparatus. According to the method, after one GOP in the video to be coded is coded based on the first coding parameter, the PSNR mean value, the QP mean value and the bpp mean value of the GOP are determined. And then, based on the PSNR mean value, the QP mean value and the bpp mean value of the GOP, determining the motion complexity of the GOP. Then, a second coding parameter corresponding to the next GOP is determined based on the motion complexity of the GOP; and then, carrying out coding processing on the next GOP based on the second coding parameter.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] One or more embodiments of the present specification relate to the field of coding technology, and more particularly, to a video coding method and apparatus. Background Art

[0002] With the development of information technology, video has become a major component of digital information. In order to facilitate transmission, the video needs to be compressed and encoded to make it smaller in space and with better picture quality.

[0003] The constant rate factor (CRF) control mode is a video encoding mode. The CRF control mode encodes each video frame by setting the CRF value.

[0004] However, for video content with frequent scene switching, using the CRF control mode for encoding processing cannot achieve fine-grained regulation of video frames of each scene. Therefore, it is necessary to provide a coding scheme with better regulation coding effect. Summary of the invention

[0005] In order to achieve better encoding effects, one or more embodiments of this specification provide a video encoding method and apparatus.

[0006] In a first aspect, one or more embodiments of the present specification provide a video encoding method, the method comprising: encoding a kth image group in a video to be encoded based on a first encoding parameter; the video to be encoded comprises multiple image groups, wherein k is a positive integer greater than 0; determining a peak signal-to-noise ratio mean, a quantization parameter mean and a bit-per-pixel mean of the kth image group after encoding; determining a motion complexity of the kth image group based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean; determining a second encoding parameter based on the motion complexity of the kth image group; encoding a k+1th image group based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

[0007] In a possible implementation, the motion complexity of the kth image group is determined based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean, including: when the quantization parameter mean is greater than a quantization parameter threshold, determining the motion complexity of the kth image group using a first preset rule; when the quantization parameter mean is less than or equal to the quantization parameter threshold, determining the motion complexity of the kth image group using a second preset rule; wherein the second preset rule is different from the first preset rule.

[0008] In a possible implementation, when the quantization parameter mean is greater than the quantization parameter threshold, determining the motion complexity of the k-th image group by using a first preset rule includes: when the quantization parameter mean is greater than the quantization parameter threshold, calculating the motion complexity of the k-th image group by using a first relational expression, wherein the first relational expression is:

[0009] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0010] In a possible implementation manner, when the quantization parameter mean is less than or equal to the quantization parameter threshold, determining the motion complexity of the k-th image group by using a second preset rule includes: When the quantization parameter mean is less than or equal to the quantization parameter threshold, the motion complexity of the k-th image group is calculated using a second relational expression, where the second relational expression is:

[0011] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0012] In one possible implementation, determining the second encoding parameter based on the motion complexity of the kth image group includes: determining a target threshold condition satisfied by the motion complexity of the kth image group based on a third preset rule; wherein the third prediction rule includes at least one threshold condition and encoding parameters corresponding to each of the threshold conditions, the at least one threshold condition includes the target threshold condition; and determining the second encoding parameter corresponding to the target threshold condition.

[0013] In a possible implementation, when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy the same threshold condition, the second encoding parameter is the same as the first encoding parameter; wherein the k-1-th image group is the previous image group of the k-th image group; when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy different threshold conditions, the second encoding parameter is different from the first encoding parameter.

[0014] In a possible implementation, when k is 1, the first encoding parameter is a pre-set initial encoding parameter; when k is greater than 1, the first encoding parameter is determined based on the motion complexity of the k-1th image group; wherein the k-1th image group is the previous image group of the kth image group.

[0015] In one possible implementation, encoding the k+1th image group based on the second encoding parameters includes: calculating the quantization parameter values ​​corresponding to each image frame in the k+1th image group based on the second encoding parameters; and encoding the k+1th image group based on each of the quantization parameter values.

[0016] In one possible implementation, the image group includes at least one of an I frame, a P frame and a B frame; the first encoding parameter and the second encoding parameter include a fixed bit rate factor, a first parameter corresponding to the I frame, a second parameter corresponding to the P frame and a third parameter corresponding to the B frame; wherein the first parameter is used to calculate a quantization parameter value corresponding to the I frame, the second parameter is used to calculate a quantization parameter value corresponding to the P frame, and the third parameter is used to calculate a quantization parameter value corresponding to the B frame.

[0017] In a second aspect, one or more embodiments of the present specification also provide a video encoding device, the device comprising: a first encoding module, used to encode the kth image group in the to-be-encoded video based on a first encoding parameter; the to-be-encoded video comprises multiple image groups, wherein k is a positive integer greater than 0; a first determination module, used to determine the mean peak signal-to-noise ratio, the mean quantization parameter and the mean number of bits per pixel of the kth image group after the encoding process; a second determination module, used to determine the motion complexity of the kth image group based on the mean peak signal-to-noise ratio, the mean quantization parameter and the mean number of bits per pixel; a third determination module, used to determine the second encoding parameter based on the motion complexity of the kth image group; a second encoding module, used to encode the k+1th image group based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

[0018] In a possible implementation, the second determination module is used to determine the motion complexity of the kth image group based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean, specifically: the second determination module is used to determine the motion complexity of the kth image group using a first preset rule when the quantization parameter mean is greater than a quantization parameter threshold; and to determine the motion complexity of the kth image group using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold; wherein the second preset rule is different from the first preset rule.

[0019] In a possible implementation, the second determining module is used to determine the motion complexity of the k-th image group by using a first preset rule when the quantization parameter mean is greater than the quantization parameter threshold, specifically: The second determination module is configured to calculate the motion complexity of the k-th image group using a first relational expression when the quantization parameter mean is greater than a quantization parameter threshold, wherein the first relational expression is:

[0020] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0021] In a possible implementation manner, the second determining module is used to determine the motion complexity of the kth image group by using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold, specifically: The second determination module is configured to calculate the motion complexity of the k-th image group using a second relational expression when the quantization parameter mean is less than or equal to the quantization parameter threshold, wherein the second relational expression is:

[0022] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0023] In one possible implementation, the third determination module is used to determine the second encoding parameter based on the motion complexity of the kth image group, specifically: the third determination module is used to determine the target threshold condition satisfied by the motion complexity of the kth image group based on a third preset rule; wherein the third prediction rule includes at least one threshold condition and encoding parameters corresponding to each of the threshold conditions, the at least one threshold condition includes the target threshold condition; and determine the second encoding parameter corresponding to the target threshold condition.

[0024] In a possible implementation, when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy the same threshold condition, the second encoding parameter is the same as the first encoding parameter; wherein the k-1-th image group is the previous image group of the k-th image group; when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy different threshold conditions, the second encoding parameter is different from the first encoding parameter.

[0025] In a possible implementation, when k is 1, the first encoding parameter is a pre-set initial encoding parameter; when k is greater than 1, the first encoding parameter is determined based on the motion complexity of the k-1th image group; wherein the k-1th image group is the previous image group of the kth image group.

[0026] In one possible implementation, the second encoding module is used to encode the k+1th image group based on the second encoding parameters, specifically: the second encoding module is used to calculate the quantization parameter values ​​corresponding to each image frame in the k+1th image group based on the second encoding parameters; and encode the k+1th image group based on each of the quantization parameter values.

[0027] In one possible implementation, the image group includes at least one of an I frame, a P frame and a B frame; the first encoding parameter and the second encoding parameter include a fixed bit rate factor, a first parameter corresponding to the I frame, a second parameter corresponding to the P frame and a third parameter corresponding to the B frame; wherein the first parameter is used to calculate a quantization parameter value corresponding to the I frame, the second parameter is used to calculate a quantization parameter value corresponding to the P frame, and the third parameter is used to calculate a quantization parameter value corresponding to the B frame.

[0028] In a third aspect, one or more embodiments of the present specification further provide an encoding device, comprising a memory and a processor; the memory is used to store a computer program product; the processor is used to execute the computer program product stored in the memory, and when the computer program product is executed, the video encoding method of the first aspect described above is implemented.

[0029] In a fourth aspect, one or more embodiments of the present specification further provide a computer-readable storage medium, wherein the computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed, the video encoding method of the first aspect described above is implemented.

[0030] In summary, one or more embodiments of the present specification provide a video encoding method and apparatus, in which a GOP in a video to be encoded is first encoded based on a first encoding parameter, and then the PSNR mean, QP mean, and bpp mean of the GOP are determined. Then, based on the PSNR mean, QP mean, and bpp mean of the GOP, the motion complexity of the GOP is determined. Next, based on the motion complexity of the GOP, a second encoding parameter corresponding to the next GOP is determined. After that, the next GOP is encoded based on the second encoding parameter.

[0031] In this way, before encoding the next GOP, the motion complexity of the previous GOP can be quickly evaluated based on the PSNR average, QP average and bpp average of the previous GOP. In this way, when the motion complexity of each GOP in the video to be encoded is similar, the original CRF encoding mechanism can be maintained, that is, the same encoding parameters are used to encode each GOP. In the case that the motion complexity of each GOP in the video to be encoded varies greatly, the encoding parameters of the next GOP can be adaptively adjusted based on the motion complexity of the previous GOP. In this way, for video content with frequent scene switching, fine-grained control of the video frames of each scene can be achieved, thereby improving the encoding effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] In order to more clearly illustrate the technical solutions of one or more embodiments of the present specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of one or more embodiments of the present specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0033] Figure 1 A schematic diagram of an application scenario provided for one or more embodiments of this specification; Figure 2 A schematic diagram of a video encoding method provided for one or more embodiments of this specification; Figure 3 A flowchart of another video encoding method provided for one or more embodiments of this specification; Figure 4 A structural block diagram of a video encoding device provided for one or more embodiments of this specification; Figure 5 A structural block diagram of an encoding device provided for one or more embodiments of this specification. DETAILED DESCRIPTION

[0034] One or more embodiments of the present invention are further described in detail below through the accompanying drawings and examples. Through these descriptions, the features and advantages of one or more embodiments of the present invention will become clearer and more specific.

[0035] The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration." Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments. Although various aspects of the embodiments are shown in the drawings, the drawings are not necessarily drawn to scale unless otherwise noted.

[0036] In addition, the technical features involved in different implementations of one or more embodiments of this specification described below can be combined with each other as long as they do not conflict with each other.

[0037] To facilitate understanding, the application scenarios of the technical solutions provided by one or more embodiments of this specification are first described below.

[0038] Figure 1 This is a schematic diagram of an application scenario provided by one or more embodiments of this specification. Figure 1 The application scenario shown may include a terminal 10, a network 11, and a server 12. The terminal 10 is connected to the server 12 via the network 11. The terminal 10 may be a mobile phone, a PC, a tablet computer, etc., which is not limited in one or more embodiments of this specification. The server may be a cloud server, a physical server, a local server, etc., which is not limited in one or more embodiments of this specification.

[0039] The server 12 can respond to the video playback request of the terminal 10 and send the requested video to the terminal 10. Specifically, the server 12 first performs video encoding processing on the requested video to compress the video and reduce the size of the video data, thereby saving transmission bandwidth and improving transmission efficiency. After that, the server 12 sends the video data obtained after the encoding processing to the terminal 10 through the network 11. After receiving the video data, the terminal 10 decodes the video data to play the corresponding video on the terminal 10.

[0040] In order to facilitate the understanding of the video encoding method provided by one or more embodiments of this specification, some nouns or terms involved in the video encoding process are explained as follows.

[0041] 1. Constant rate factor (CRF) control mode: CRF control mode is a video encoding mode. CRF control mode controls the quality of the video by setting a fixed CRF value. Usually, CRF is a value between 0 and 51. Among them, a lower CRF value means higher image quality and higher bit rate, and a higher CRF value means lower image quality and lower bit rate.

[0042] 2. QP: quantization step size, also known as quantization parameter. Among them, the CRF control mode is mainly achieved by dynamically adjusting the QP of each frame. Generally, the higher the QP value, the more video details are lost, the lower the video quality, but the bit rate is also small. The lower the QP value, the more video details are retained, the higher the video quality, but the bit rate is also larger.

[0043] 3. Bit rate: refers to the amount of data transmitted or stored per second, and is a key indicator for measuring the size and quality of video files. The encoding device can control the bit rate by adjusting the QP value to achieve the desired compression effect and quality.

[0044] 4. Group of picture (GOP): During the video encoding process, the entire video can be divided into at least one GOP, each of which can contain multiple video frames. Then, the encoding process is performed in units of GOP.

[0045] The video frames can be divided into I frames, P frames and B frames. Usually, the entire video can be divided into multiple GOPs using I frames as segmentation frames. Each GOP includes an I frame and non-I frames between two I frames. For example, non-I frames can include P frames and B frames.

[0046] In a possible implementation, video encoding may be implemented in the following manner: based on a preset CRF parameter, a QP allocation scheme corresponding to each GOP is calculated. Then, each GOP may be encoded based on the QP allocation scheme corresponding to each GOP.

[0047] It can be seen that in the above video encoding method, the same CRF parameters are used when encoding each GOP. In this way, for video content with frequent scene switching, since the same CRF parameters are always used during the encoding process, it is impossible to perform refined encoding processing on video frames of different scenes, which may lead to unsatisfactory encoding effects for some video content.

[0048] To solve the above technical problems, one or more embodiments of this specification provide a video encoding method, which can adaptively adjust CRF parameters according to video content, thereby achieving refined encoding processing for different video contents and ensuring that the encoding effect of each video content is ideal.

[0049] A video encoding method provided in one or more embodiments of the present specification may be applied to an encoding device. For example, the encoding device may be Figure 1 Of course, the encoding device may also be a terminal device for performing video encoding processing, and one or more embodiments of this specification do not limit this.

[0050] Figure 2 A flowchart of a video encoding method provided by one or more embodiments of this specification is shown in FIG. Figure 2 As shown, the method may include the following steps: Step S102, encoding the kth GOP in the to-be-encoded video based on the first encoding parameter; the to-be-encoded video includes multiple GOPs, where k is a positive integer greater than 0.

[0051] The encoding parameters refer to preset parameters used to calculate the QP value of each image frame in the GOP under the CRF control mode. For example, the encoding parameters may include a CRF value, a first parameter for optimizing the QP value corresponding to an I frame, a second parameter for optimizing the QP value corresponding to a P frame, and a third parameter for optimizing the QP value corresponding to a B frame.

[0052] Exemplarily, in the following method for calculating the QP value of each image frame in a GOP, the encoding parameters may include a CRF value, a C I 、Fact I 、dqp p , C P 、Fact P and dqp B , where C I and Fact I The first parameter corresponding to the I frame, dqp p , C P and Fact P The second parameter corresponding to the P frame, dqp B It is the third parameter corresponding to the B frame.

[0053] Specifically, the QP value of each image frame in the GOP can be calculated according to the following equations (1) to (6): The relationship (1) is: Relation (1) The relationship (2) is: Relation (2) The relationship (3) is: Relation (3) The functions in equations (1) and (2) are The following relationship (4) is satisfied: (a, b, x) = Relation (4) Cplx base It can be calculated using the following relationship (5): Relation (5) In the above equations (1) and (2), The following relationship (6) is satisfied: Relation (6) Among them, in the above relationship, Indicates the QP value corresponding to the I frame, .

[0054] Indicates the CRF value, C I and Fact I Indicates the first parameter corresponding to the I frame, dqp p , C P and Fact P Indicates the second parameter corresponding to the P frame, dqp B Indicates the third parameter corresponding to the B frame.

[0055] Represents the rounding function, Cplx cur-I The complexity corresponding to the current I frame, Cplx cur-P The complexity corresponding to the current P frame, Cplx base Baseline complexity. Cplx cur-I , Cplx cur-P The specific calculation method can refer to the relevant technology and will not be described in detail here.

[0056] Indicates the number of blocks in the width of the video frame, Indicates the number of blocks in the video frame height, Indicates the number of B frames in the current GOP.

[0057] (Coded Unit Tree) is a video encoding technology. For details, please refer to the related technologies and will not be described here.

[0058] It should be noted that one or more embodiments of this specification are only illustrative of the method of calculating the QP value according to the above-mentioned equations (1) to (6), and do not limit the method of calculating the QP value. In specific implementation, other methods can also be used to calculate the QP value, which are not listed here one by one.

[0059] It should be understood that for different QP value methods, the encoding parameters may be the same or different, so one or more embodiments of this specification do not limit the specific parameters included in the encoding parameters, which can be specifically determined according to the QP value method adopted.

[0060] In the video encoding method provided by one or more embodiments of this specification, the CRF value and C I 、Fact I 、dqp p , C P 、Fact P and dqp B The encoding parameters such as MPEG-4 and MPEG-5 can be adaptively adjusted based on the motion complexity of the previous GOP.

[0061] It should be noted that if the kth GOP is the first GOP in the video to be encoded, the first encoding parameter used when encoding the first GOP in the video to be encoded may be a pre-set initial encoding parameter. If the kth GOP is any GOP in the video to be encoded except the first GOP, the first encoding parameter used when encoding the kth GOP in the video to be encoded may refer to steps S104 to S108 and be determined based on the motion complexity of the k-1th GOP, wherein the k-1th GOP refers to the previous GOP of the kth GOP. For details, please refer to the subsequent introduction to steps S104 to S108, which will not be described in detail here.

[0062] Step S104, determining the mean value of the peak signal-to-noise ratio, the mean value of the quantization parameter and the mean value of the number of bits per pixel of the kth image group after the encoding process.

[0063] After encoding the kth GOP, the peak signal-to-noise ratio (PSNR), QP value, and bit per pixel (bpp) corresponding to each video frame in the kth GOP can be obtained.

[0064] Among them, PSNR can be used to represent the similarity between two images. The higher the PSNR, the closer the two images are. In video coding, the higher the PSNR of the encoded image compared to the original input image, the higher the image quality.

[0065] BPP refers to the number of bits per pixel in the video frame after encoding. A higher bpp value usually means that more bits are needed to describe each pixel to achieve higher video quality. For example, the requirements for bpp vary for different video content. For static images in static scenes, a lower bpp is usually required to achieve higher visual quality, while for dynamic images in fast-motion scenes, a higher bpp is usually required to maintain the same visual quality.

[0066] Furthermore, based on the PSNR, QP value, and bpp value corresponding to each video frame in the kth GOP, the PSNR average, QP average, and bpp average of the kth GOP may be calculated.

[0067] It should be noted that one or more embodiments of this specification do not limit the specific implementation method of determining the PSNR mean, QP mean, and bpp mean corresponding to the kth GOP. For example, after the encoding device encodes the kth GOP, the PSNR mean, QP mean, and bpp mean corresponding to the kth GOP can be automatically generated. In this way, the PSNR mean, QP mean, and bpp mean generated by the encoding device can be directly obtained in step S104.

[0068] Step S106, determining the motion complexity of the kth GOP based on the PSNR average, QP average and bpp average of the kth GOP.

[0069] Motion complexity can be understood as the degree of motion change between consecutive video frames. The greater the value of motion complexity, the greater the degree of motion change between consecutive video frames.

[0070] One or more embodiments of the present specification can quickly evaluate the motion complexity of the kth GOP based on the PSNR average, QP average, and bpp average of the kth GOP to determine the encoding parameters corresponding to the next GOP as quickly as possible.

[0071] In a possible implementation, the motion complexity of the kth GOP is determined based on the PSNR mean, QP mean and bpp mean of the kth GOP. This can be implemented in the following way: when the QP mean is greater than the quantization parameter threshold, the motion complexity of the kth GOP is determined using a first preset rule; when the QP mean is less than or equal to the quantization parameter threshold, the motion complexity of the kth GOP is determined using a second preset rule; wherein the second preset rule is different from the first preset rule.

[0072] Specifically, the complexity impact factor can be determined based on the QP mean and the quantization parameter threshold, wherein in the first preset rule, the motion complexity is inversely proportional to the complexity impact factor, the motion complexity is proportional to the PSNR mean, and the motion complexity is inversely proportional to the bpp mean. In the second preset rule, the motion complexity is proportional to the complexity impact factor, the motion complexity is proportional to the PSNR mean, and the motion complexity is inversely proportional to the bpp mean.

[0073] Exemplarily, the first preset rule includes the following first relational expression (7): Relation (7) The second preset rule includes the following second relational expression (8): Relation (8) in, represents the motion complexity of the k-th GOP, represents the PSNR mean of the kth GOP, represents the QP mean of the kth GOP, represents the bpp mean of the kth GOP, represents the quantization parameter threshold, Represents the complexity impact factor.

[0074] It should be noted that one or more embodiments of this specification define the quantization parameter threshold value. The value of is not limited, for example, You can take 29.

[0075] by Take 29 as an example. When the QP mean is greater than 29, the motion complexity of the kth GOP can be calculated using equation (7): When the QP mean is less than or equal to 29, the motion complexity of the kth GOP can be calculated using equation (8): .

[0076] Thus, since the method for calculating the computational complexity provided by the above equations (7) and (8) is simple, after the kth GOP is encoded, the motion complexity corresponding to the kth GOP can be quickly calculated.

[0077] Step S108: determining a second encoding parameter based on the motion complexity of the kth GOP.

[0078] One or more embodiments of the present specification may be pre-configured with multiple groups of encoding parameters, and each group of encoding parameters may be matched with a different motion complexity.

[0079] In a possible implementation, determining the second encoding parameter based on the motion complexity of the kth GOP can be implemented in the following manner: first, determining the target threshold condition satisfied by the motion complexity of the kth GOP based on the third preset rule. Then, determining the second encoding parameter corresponding to the target threshold condition. The third prediction rule includes at least one threshold condition and encoding parameters corresponding to each threshold condition, and the at least one threshold condition includes the target threshold condition.

[0080] Exemplarily, the third preset rule may be a mapping relationship pre-stored in the encoding device, and the mapping relationship is a mapping relationship between different motion complexities and encoding parameters. In this way, after the motion complexity of the k-th GOP is determined, the mapping relationship may be obtained. Thereafter, an encoding parameter matching the motion complexity of the k-th GOP may be searched based on the mapping relationship, and the encoding parameter may be used as the second encoding parameter.

[0081] For example, the third preset rule includes: when the motion complexity is greater than 5000, the encoding parameters are: CRF=28, dqp p =4, dqp B =8, C I =1, C P =1、Fact I =4.0、Fact P =0.2. When the motion complexity is greater than 2000 and less than or equal to 5000, the encoding parameters are: CRF=29, dqp p =4, dqp B =7, C I =2, C P =1、Fact I =4.0、Fact P =0.2. When the motion complexity is less than 2000, the encoding parameters are: CRF=30, dqp p =3, dqp B =6, C I =2, C P =2、Fact I =2.0、Fact P =0.1.

[0082] Thus, when k is greater than 1 and the motion complexity of the kth GOP and the motion complexity of the k-1th GOP meet the same threshold condition, the second encoding parameter is the same as the first encoding parameter. Taking k=2 as an example, if the motion complexity of the second GOP and the motion complexity of the first GOP are both greater than 5000, the second encoding parameter and the first encoding parameter are both CRF=28, dqp p =4, dqp B =8, CI =1, C P =1、Fact I =4.0、Fact P =0.2.

[0083] When k is greater than 1 and the motion complexity of the kth GOP and the motion complexity of the k-1th GOP meet different threshold conditions, the second encoding parameters are different from the first encoding parameters. Taking k=3 as an example, if the motion complexity of the second GOP is greater than 5000 and the motion complexity of the third GOP is less than 2000, the first encoding parameters are CRF=28, dqp p =4, dqp B =8, C I =1, C P =1、Fact I =4.0、Fact P =0.2. The second encoding parameters are CRF=30, dqp p =3, dqp B =6, C I =2, C P =2、Fact I =2.0、Fact P =0.1.

[0084] That is to say, when the motion complexity of two adjacent GOPs is similar, the same encoding parameters can be maintained, which is equivalent to using the traditional CRF control mode encoding process. When the motion complexity of two adjacent GOPs is greatly different, the adaptive encoding parameters can be selected according to the change of motion complexity.

[0085] If the video to be encoded includes video content with frequent scene switching, the difference in motion complexity between two adjacent GOPs is usually large. In this case, the encoding parameters matching the next GOP can be selected according to the change in motion complexity to achieve refined encoding processing for each video content with large differences. In addition, if the video to be encoded does not include video content with frequent scene switching, the difference in motion complexity between two adjacent GOPs is usually small. In this case, the same encoding parameters can be used for each GOP to achieve refined encoding processing for each different video content with small differences.

[0086] It should be noted that the above description is only based on the example that the third preset rule includes three threshold conditions, and does not limit the number of threshold conditions. For example, the third preset rule may include more or better threshold conditions.

[0087] Step S110 , encoding the k+1th GOP based on the second encoding parameter; the k+1th GOP is the next GOP of the kth GOP.

[0088] The second encoding parameter determined based on the kth GOP is used to perform encoding processing on the k+1th GOP.

[0089] Exemplarily, the QP values ​​corresponding to the image frames in the k+1th GOP may be calculated based on the second encoding parameter. Then, the k+1th GOP is encoded based on the QP values ​​corresponding to the image frames.

[0090] For example, the second encoding parameters include CRF value, C I 、Fact I 、dqp p , C P 、Fact P and dqp B For example, the second encoding parameter and the above equations (1) to (6) can be used to calculate the QP value corresponding to each image frame in the k+1th GOP.

[0091] It should be understood that, for each GOP in the video to be encoded, the encoding process can be performed according to the method provided in the above steps S102 to S110. The complete process of encoding the video to be encoded is exemplarily described below.

[0092] Figure 3 A flowchart of another video encoding method provided for one or more embodiments of this specification is shown as follows. Figure 3 As shown, the method may include the following steps: S202, obtaining initial encoding parameters.

[0093] S204, encoding a GOP in the video to be encoded.

[0094] For the first cycle, the input of step S204 is the initial encoding parameters, that is, the first GOP in the video to be encoded is encoded using the initial encoding parameters.

[0095] For the second cycle to the last cycle, the input of step S204 is the encoding parameter determined based on the target threshold condition in the previous cycle, that is, the encoding parameter corresponding to the target threshold condition determined in step S212 in the previous cycle is used to encode the GOP corresponding to the current cycle.

[0096] S206, obtaining the PSNR mean, QP mean and bpp mean corresponding to the GOP.

[0097] After encoding each GOP, its corresponding PSNR average, QP average and bpp average can be obtained.

[0098] S208, determining whether the encoding process of all GOPs in the video to be encoded is completed.

[0099] S210, if the encoding process of all GOPs in the video to be encoded is not completed, the motion complexity of the previous GOP is calculated based on the PSNR average, QP average and bpp average corresponding to the previous GOP. If the encoding process of all GOPs in the video to be encoded is completed, the process ends.

[0100] The video to be encoded is usually divided into multiple GOPs. During the encoding process, the GOPs can be encoded one by one in the order of the GOPs. If the last GOP to be encoded is not the last GOP, the encoding process continues for the next GOP. If the last GOP to be encoded is the last GOP, it means that the encoding process of all GOPs in the video to be encoded has been completed, and the encoding process of the video to be encoded can be terminated at this time.

[0101] Before encoding the next GOP, calculate the motion complexity of the previous GOP . Specific calculation of motion complexity Please refer to the description of step S106 for the method, which will not be repeated here.

[0102] S212, determine the motion complexity of the previous GOP The target threshold condition that is met.

[0103] like Figure 3 As shown, the target threshold condition may be any one of threshold condition 1, threshold condition 2, ..., threshold condition n. For example, the motion complexity of the previous GOP The target threshold condition satisfied is threshold condition 1.

[0104] Afterwards, the encoding parameters corresponding to the target threshold condition are used as the input of step S204, and steps S204 to S212 are executed again until the encoding process of all GOPs in the video to be encoded is completed, and then the loop ends.

[0105] For example: For the first GOP, the initial encoding parameters are used to encode it. Then, the PSNR mean, QP mean and bpp mean corresponding to the first GOP are obtained. Then, the motion complexity of the first GOP is calculated using the PSNR mean, QP mean and bpp mean corresponding to the first GOP. Then, determine the motion complexity of the first GOP The target threshold condition is met. The motion complexity of the first GOP is Taking threshold condition 1 as an example, the encoding parameters corresponding to threshold condition 1 are used to encode the second GOP. Then, the motion complexity of the second GOP is calculated using the PSNR mean, QP mean, and bpp mean corresponding to the second GOP. Then, determine the motion complexity of the second GOP The target threshold condition is met. The motion complexity of the second GOP is Taking the threshold condition 2 that is satisfied as an example, the third GOP is encoded using the encoding parameters corresponding to the threshold condition 2. In this way, the encoding process is performed one by one on each GOP in the video to be encoded according to the above process until the encoding process of the last GOP is completed.

[0106] It should be noted that the specific implementation of steps S202 to S212 can refer to the description of steps S102 to S110, which will not be repeated here.

[0107] In summary, the video encoding method provided by one or more embodiments of the present specification determines the PSNR mean, QP mean and bpp mean of a GOP in a video to be encoded based on a first encoding parameter. Then, the motion complexity of the GOP is determined based on the PSNR mean, QP mean and bpp mean of the GOP. Next, the second encoding parameter corresponding to the next GOP is determined based on the motion complexity of the GOP. After that, the next GOP is encoded based on the second encoding parameter.

[0108] In this way, before encoding the next GOP, the motion complexity of the previous GOP can be quickly evaluated based on the PSNR average, QP average and bpp average of the previous GOP. In this way, when the motion complexity of each GOP in the video to be encoded is similar, the original CRF encoding mechanism can be maintained, that is, the same encoding parameters are used to encode each GOP. In the case that the motion complexity of each GOP in the video to be encoded varies greatly, the encoding parameters of the next GOP can be adaptively adjusted based on the motion complexity of the previous GOP. In this way, for video content with frequent scene switching, fine-grained control of the video frames of each scene can be achieved.

[0109] In addition, by using the video encoding method provided by one or more embodiments of this specification to encode video content with frequent scene switching, the bit rate with the same image quality can be reduced by 1.03%, which can save 1.03% of the video data transmission bandwidth cost.

[0110] It can be understood that the above embodiments are only examples and can be modified in actual implementation. Those skilled in the art can understand that the modification methods of the above embodiments without creative labor fall within the protection scope of one or more embodiments of this specification and will not be repeated in the embodiments.

[0111] Based on the same inventive concept, one or more embodiments of the present specification also provide a video encoding device. Since the principle of solving the problem by the video encoding device is similar to that of the aforementioned video encoding method, the implementation of the video encoding device can refer to the implementation of the aforementioned video encoding method, and the repeated parts will not be repeated.

[0112] See also Figure 4 , Figure 4 This is a structural block diagram of a video encoding device provided by one or more embodiments of this specification. Figure 4 As shown, the video encoding device 300 may include: a first encoding module 301, a first determining module 302, a second determining module 303, a third determining module 304, and a second encoding module 305. The first encoding module 301 can be used to encode the kth image group in the video to be encoded based on the first encoding parameter; the video to be encoded includes multiple image groups, wherein k is a positive integer greater than 0.

[0113] The first determination module 302 may be configured to determine a mean value of a peak signal-to-noise ratio, a mean value of a quantization parameter, and a mean value of bits per pixel of the k-th image group after encoding.

[0114] The second determination module 303 may be configured to determine the motion complexity of the kth image group based on the mean value of the peak signal-to-noise ratio, the mean value of the quantization parameter and the mean value of the number of bits per pixel.

[0115] The third determination module 304 may be configured to determine a second encoding parameter based on the motion complexity of the kth image group.

[0116] The second encoding module 305 may be configured to perform encoding processing on the k+1th image group based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

[0117] In a possible implementation, the second determination module 303 is used to determine the motion complexity of the kth image group based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean, specifically: the second determination module 303 is used to determine the motion complexity of the kth image group using a first preset rule when the quantization parameter mean is greater than a quantization parameter threshold; and to determine the motion complexity of the kth image group using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold; wherein the second preset rule is different from the first preset rule.

[0118] In a possible implementation, the second determination module 303 is configured to determine the motion complexity of the k-th image group by using a first preset rule when the quantization parameter mean is greater than the quantization parameter threshold, specifically: The second determination module 303 is configured to calculate the motion complexity of the k-th image group using a first relational expression when the quantization parameter mean is greater than a quantization parameter threshold, wherein the first relational expression is:

[0119] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0120] In a possible implementation, the second determination module 303 is configured to determine the motion complexity of the k-th image group by using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold, specifically: The second determination module 303 is configured to calculate the motion complexity of the k-th image group using a second relational expression when the quantization parameter mean is less than or equal to the quantization parameter threshold, wherein the second relational expression is:

[0121] in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

[0122] In one possible implementation, the third determination module 304 is used to determine the second encoding parameter based on the motion complexity of the kth image group, specifically: the third determination module 304 is used to determine the target threshold condition satisfied by the motion complexity of the kth image group based on a third preset rule; wherein the third prediction rule includes at least one threshold condition, and encoding parameters corresponding to each of the threshold conditions, the at least one threshold condition includes the target threshold condition; and determine the second encoding parameter corresponding to the target threshold condition.

[0123] In a possible implementation, when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy the same threshold condition, the second encoding parameter is the same as the first encoding parameter; wherein the k-1-th image group is the previous image group of the k-th image group; when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy different threshold conditions, the second encoding parameter is different from the first encoding parameter.

[0124] In a possible implementation, when k is 1, the first encoding parameter is a pre-set initial encoding parameter; when k is greater than 1, the first encoding parameter is determined based on the motion complexity of the k-1th image group; wherein the k-1th image group is the previous image group of the kth image group.

[0125] In one possible implementation, the second encoding module 305 is used to encode the k+1th image group based on the second encoding parameters, specifically: the second encoding module 305 is used to calculate the quantization parameter values ​​corresponding to each image frame in the k+1th image group based on the second encoding parameters; and encode the k+1th image group based on each of the quantization parameter values.

[0126] In one possible implementation, the image group includes at least one of an I frame, a P frame and a B frame; the first encoding parameter and the second encoding parameter include a fixed bit rate factor, a first parameter corresponding to the I frame, a second parameter corresponding to the P frame and a third parameter corresponding to the B frame; wherein the first parameter is used to calculate a quantization parameter value corresponding to the I frame, the second parameter is used to calculate a quantization parameter value corresponding to the P frame, and the third parameter is used to calculate a quantization parameter value corresponding to the B frame.

[0127] See also Figure 5 , Figure 5 This is a structural block diagram of a coding device provided in one or more embodiments of this specification. Figure 5As shown, the encoding device 400 may include a processor 401 and a memory 402; the memory 402 may be coupled to the processor 401. It is worth noting that the Figure 5 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.

[0128] In a possible implementation, the functions of the video encoding apparatus 300 may be integrated into the processor 401. The processor 401 may be configured to perform the following operations: Performing encoding processing on the kth group of pictures in the video to be encoded based on the first encoding parameter; the video to be encoded includes multiple groups of pictures, wherein k is a positive integer greater than 0; Determining a mean value of a peak signal-to-noise ratio, a mean value of a quantization parameter, and a mean value of bits per pixel of the k-th image group after encoding; Determining a motion complexity of the kth image group based on the mean peak signal-to-noise ratio, the mean quantization parameter, and the mean number of bits per pixel; Determining a second encoding parameter based on the motion complexity of the kth group of pictures; The k+1th image group is encoded based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

[0129] In another possible implementation, the video encoding device 300 may be configured separately from the processor 401 . For example, the video encoding device 300 may be configured as a chip connected to the processor 401 , and video encoding is implemented under the control of the processor 401 .

[0130] In addition, in some optional implementations, the encoding device 400 may also include: a communication module, an input unit, an audio processor, a display, a power supply, etc. It is worth noting that the encoding device 400 does not necessarily include Figure 5 In addition, the encoding device 400 may also include Figure 5 For components not shown, reference may be made to the prior art.

[0131] In some optional implementations, the processor 401, sometimes also referred to as a controller or operation control, may include a microprocessor or other processor device and / or logic device, which receives input and controls the operation of various components of the encoding device 400.

[0132] The memory 402 may be, for example, a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The memory 402 may store the above-mentioned information related to the video encoding device 300, and may also store a program for executing the related information. The processor 401 may execute the program stored in the memory 402 to implement information storage or processing.

[0133] The input unit can provide input to the processor 401. The input unit is, for example, a key or a touch input device. The power supply can be used to provide power to the encoding device 400. The display can be used to display display objects such as images and text. The display can be, for example, an LCD display, but is not limited thereto.

[0134] The memory 402 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 402 may also be some other type of device. The memory 402 includes a buffer memory (sometimes referred to as a buffer). The memory 402 may include an application / function storage unit for storing application programs and function programs or processes for executing the operation of the encoding device 400 through the processor 401.

[0135] The memory 402 may also include a data storage unit for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the encoding device. The driver storage unit of the memory 402 may include various drivers for the communication function of the computer device and / or for executing other functions of the computer device (such as a messaging application, a contact book application, etc.).

[0136] The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor 401 to provide input signals and receive output signals, which may be the same as in a conventional mobile communication terminal.

[0137] Based on different communication technologies, multiple communication modules may be provided in the same computer device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) is also coupled to a speaker and a microphone via an audio processor to provide an audio output via the speaker and receive an audio input from the microphone, thereby realizing a common telecommunication function. The audio processor may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor is also coupled to the processor 401, so that recording can be performed on the machine through the microphone, and the sound stored on the machine can be played through the speaker.

[0138] One or more embodiments of the present specification also provide a computer-readable storage medium capable of implementing all the steps of the video encoding method in the above embodiment. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the video encoding method in the above embodiment are implemented. For example, when the processor executes the computer program, the following steps are implemented: Performing encoding processing on the kth group of pictures in the video to be encoded based on the first encoding parameter; the video to be encoded includes multiple groups of pictures, wherein k is a positive integer greater than 0; Determining a mean value of a peak signal-to-noise ratio, a mean value of a quantization parameter, and a mean value of bits per pixel of the k-th image group after encoding; Determining a motion complexity of the kth image group based on the mean peak signal-to-noise ratio, the mean quantization parameter, and the mean number of bits per pixel; Determining a second encoding parameter based on the motion complexity of the kth group of pictures; The k+1th image group is encoded based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

[0139] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flowcharts, more or fewer operation steps may be included based on conventional or non-creative labor. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the actual device or client product is executed, it can be executed in the order of the method shown in the embodiments or the drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0140] Those skilled in the art should understand that the embodiments of this specification may be provided as methods, devices (systems) or computer program products. Therefore, the embodiments of this specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0141] One or more embodiments of this specification are described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to one or more embodiments of this specification. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0142] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0143] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0144] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and system embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.

[0145] In this article, relational terms such as first and second, etc. are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. For those of ordinary skill in the art, the specific meaning of the above terms in one or more embodiments of this specification can be understood according to the specific circumstances.

[0146] It should be noted that, in the absence of conflict, one or more embodiments of this specification and the features in the embodiments may be combined with each other. One or more embodiments of this specification are not limited to any single aspect, nor to any single embodiment, nor to any combination and / or replacement of these aspects and / or embodiments. Moreover, each aspect and / or embodiment of one or more embodiments of this specification may be used alone or in combination with one or more other aspects and / or embodiments thereof.

[0147] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of one or more embodiments of this specification, rather than to limit them. Although one or more embodiments of this specification are described in detail with reference to the aforementioned embodiments, a person of ordinary skill in the art should understand that the technical solutions described in the aforementioned embodiments can still be modified, or some or all of the technical features therein can be replaced by equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of one or more embodiments of this specification.

[0148] One or more embodiments of this specification are described above in conjunction with optional implementation methods, but these implementation methods are only exemplary and serve only as an illustration. On this basis, multiple replacements and improvements can be made to one or more embodiments of this specification, all of which fall within the scope of protection of one or more embodiments of this specification.

Claims

1. A video encoding method, It is characterized in that The method comprises: Performing encoding processing on the kth group of pictures in the video to be encoded based on the first encoding parameter; the video to be encoded includes multiple groups of pictures, wherein k is a positive integer greater than 0; Determining a mean value of a peak signal-to-noise ratio, a mean value of a quantization parameter, and a mean value of bits per pixel of the k-th image group after encoding; Determining a motion complexity of the kth image group based on the mean peak signal-to-noise ratio, the mean quantization parameter, and the mean number of bits per pixel; Determining a second encoding parameter based on the motion complexity of the kth group of pictures; The k+1th image group is encoded based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

2. The method according to claim 1, It is characterized in that The determining the motion complexity of the kth image group based on the peak signal-to-noise ratio mean, the quantization parameter mean, and the bit-per-pixel mean includes: In a case where the quantization parameter mean is greater than the quantization parameter threshold, determining the motion complexity of the kth image group by using a first preset rule; When the quantization parameter mean is less than or equal to the quantization parameter threshold, the motion complexity of the kth image group is determined using a second preset rule; wherein the second preset rule is different from the first preset rule.

3. The method according to claim 2, It is characterized in that The determining the motion complexity of the k-th image group by using a first preset rule when the quantization parameter mean is greater than the quantization parameter threshold comprises: When the quantization parameter mean is greater than the quantization parameter threshold, the motion complexity of the k-th image group is calculated using a first relational expression, where the first relational expression is: in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

4. The method according to claim 2 or 3, It is characterized in that The determining the motion complexity of the k-th image group by using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold comprises: When the quantization parameter mean is less than or equal to the quantization parameter threshold, the motion complexity of the k-th image group is calculated using a second relational expression, where the second relational expression is: in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

5. The method according to claim 1, It is characterized in that The determining the second encoding parameter based on the motion complexity of the k-th group of pictures comprises: Determining a target threshold condition satisfied by the motion complexity of the k-th image group based on a third preset rule; wherein the third prediction rule includes at least one threshold condition and encoding parameters corresponding to each of the threshold conditions, and the at least one threshold condition includes the target threshold condition; A second encoding parameter corresponding to the target threshold condition is determined.

6. The method according to claim 5, It is characterized in that When k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group meet the same threshold condition, the second encoding parameter is the same as the first encoding parameter; wherein the k-1-th image group is a previous image group of the k-th image group; When k is greater than 1 and the motion complexity of the kth image group and the motion complexity of the k-1th image group satisfy different threshold conditions, the second encoding parameter is different from the first encoding parameter.

7. The method according to claim 1, It is characterized in that When k is 1, the first encoding parameter is a preset initial encoding parameter; In the case that k is greater than 1, the first encoding parameter is determined based on the motion complexity of the k-1th image group; wherein the k-1th image group is the previous image group of the kth image group.

8. The method according to claim 1, It is characterized in that The encoding process of the k+1th group of pictures based on the second encoding parameter includes: Calculate the quantization parameter value corresponding to each image frame in the k+1th image group based on the second encoding parameter; The k+1th image group is encoded based on the quantization parameter values.

9. The method according to claim 1, It is characterized in that The image group includes at least one of an I frame, a P frame and a B frame; the first encoding parameter and the second encoding parameter include a fixed bit rate factor, a first parameter corresponding to the I frame, a second parameter corresponding to the P frame and a third parameter corresponding to the B frame; wherein the first parameter is used to calculate a quantization parameter value corresponding to the I frame, the second parameter is used to calculate a quantization parameter value corresponding to the P frame, and the third parameter is used to calculate a quantization parameter value corresponding to the B frame.

10. A video encoding device, It is characterized in that The device comprises: A first encoding module, configured to perform encoding processing on a k-th group of pictures in a to-be-encoded video based on a first encoding parameter; the to-be-encoded video includes a plurality of groups of pictures, wherein k is a positive integer greater than 0; A first determination module is used to determine a peak signal-to-noise ratio mean value, a quantization parameter mean value, and a bit-per-pixel mean value of the k-th image group after encoding; A second determination module is used to determine the motion complexity of the kth image group based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean; A third determination module, configured to determine a second encoding parameter based on the motion complexity of the kth image group; The second encoding module is used to perform encoding processing on the k+1th image group based on the second encoding parameter; the k+1th image group is the next image group of the kth image group.

11. The device according to claim 10, It is characterized in that The second determination module is used to determine the motion complexity of the k-th image group based on the peak signal-to-noise ratio mean, the quantization parameter mean and the bit-per-pixel mean, specifically: The second determination module is used to determine the motion complexity of the kth image group using a first preset rule when the quantization parameter mean is greater than the quantization parameter threshold; and to determine the motion complexity of the kth image group using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold; wherein the second preset rule is different from the first preset rule.

12. The device according to claim 11, It is characterized in that The second determination module is used to determine the motion complexity of the k-th image group using a first preset rule when the quantization parameter mean is greater than the quantization parameter threshold, specifically: The second determination module is configured to calculate the motion complexity of the k-th image group using a first relational expression when the quantization parameter mean is greater than a quantization parameter threshold, wherein the first relational expression is: in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

13. The device according to claim 11 or 12, It is characterized in that The second determination module is used to determine the motion complexity of the k-th image group using a second preset rule when the quantization parameter mean is less than or equal to the quantization parameter threshold, specifically: The second determination module is configured to calculate the motion complexity of the k-th image group using a second relational expression when the quantization parameter mean is less than or equal to the quantization parameter threshold, wherein the second relational expression is: in, represents the motion complexity of the k-th image group, represents the mean value of the peak signal-to-noise ratio, represents the mean value of the quantization parameter, represents the mean number of bits per pixel, represents the quantization parameter threshold.

14. The device according to claim 10, It is characterized in that The third determination module is used to determine the second encoding parameter based on the motion complexity of the k-th image group, specifically: The third determination module is used to determine the target threshold condition satisfied by the motion complexity of the kth image group based on a third preset rule; wherein the third prediction rule includes at least one threshold condition and encoding parameters corresponding to each of the threshold conditions, and the at least one threshold condition includes the target threshold condition; and determine the second encoding parameter corresponding to the target threshold condition.

15. The device according to claim 14, It is characterized in that When k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy the same threshold condition, the second encoding parameter is the same as the first encoding parameter; wherein the k-1-th image group is the previous image group of the k-th image group; when k is greater than 1 and the motion complexity of the k-th image group and the motion complexity of the k-1-th image group satisfy different threshold conditions, the second encoding parameter is different from the first encoding parameter.

16. The device according to claim 10, It is characterized in that When k is 1, the first encoding parameter is a pre-set initial encoding parameter; when k is greater than 1, the first encoding parameter is determined based on the motion complexity of the k-1th image group; wherein the k-1th image group is the previous image group of the kth image group.

17. The device according to claim 10, It is characterized in that The second encoding module is used to perform encoding processing on the k+1th image group based on the second encoding parameter, specifically: The second encoding module is used to calculate the quantization parameter value corresponding to each image frame in the k+1th image group based on the second encoding parameter; and perform encoding processing on the k+1th image group based on each of the quantization parameter values.

18. The device according to claim 10, It is characterized in that The image group includes at least one of an I frame, a P frame and a B frame; the first encoding parameter and the second encoding parameter include a fixed bit rate factor, a first parameter corresponding to the I frame, a second parameter corresponding to the P frame and a third parameter corresponding to the B frame; wherein the first parameter is used to calculate a quantization parameter value corresponding to the I frame, the second parameter is used to calculate a quantization parameter value corresponding to the P frame, and the third parameter is used to calculate a quantization parameter value corresponding to the B frame.

19. A coding device, It is characterized in that The encoding device comprises: A memory for storing a computer program product; A processor is used to execute a computer program product stored in the memory, and when the computer program product is executed, the method described in any one of claims 1 to 9 is implemented.

20. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer program instructions, which, when executed, implement the method described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Model based rate control for predictive video encoder

    CN101194518A

  • Method for confirming initial quantization step in code rate control

    CN101605250A

  • Video coding and compressing method

    CN102427529A

  • Multi-view video rate control method based on exactly perceptible distortion

    CN103096079A

  • Image encoding device, captured image recording system, capture device, image encoding method, and image encoding program

    CN104685871A

Cited By

  • Airport monitoring video transmission method and device, storage medium and electronic equipment

    CN119854508A