Video coding method and device, equipment, storage medium and program product

By detecting the still state of the video frame and the proportion of skin area and adjusting the settings of video encoding, the problem of blurring or distortion of the video encoding is solved, and the encoding rate is saved and encoding efficiency is improved without losing video quality.

CN119450059APending Publication Date: 2025-02-14BIGO TECH PTE LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411421206.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-12
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

The prior art directly reduces the configuration code rate or frame rate of video encoding, resulting in the video losing more detailed information during the compression process, making the video picture blurred or distorted, affecting the user's video viewing experience.

Method used

By detecting whether the video frame does not contain a face area and the frame rate is greater than the set threshold, determine whether the video frame within the preset time is a still frame, and calculate the proportion of the skin area, and the stationary frame is based on the gradually increasing minimum quantization parameter value. The video frames are encoded.

Benefits of technology

Save video encoding rate without losing subjective video quality, improve coding efficiency, and optimize user video viewing experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119450059A_ABST
    Figure CN119450059A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a video coding method and device, equipment, a storage medium and a program product, and the method comprises the steps: obtaining a to-be-coded video frame sequence and a corresponding video frame rate, and enabling the video frame sequence to comprise video frames; in the process of encoding the video frames, under the condition that it is detected that the currently encoded video frame does not contain a face region and the video frame rate is greater than a set frame rate threshold, determining whether a to-be-evaluated video frame within a preset duration after the currently encoded video frame is a static frame, and calculating the proportion of a skin region in the to-be-evaluated video frame; and when the to-be-evaluated video frame is a static frame and the proportion of the skin area is in a preset threshold interval, coding the video frame detected as the static frame after the to-be-evaluated video frame based on the gradually increasing minimum quantization parameter value. According to the scheme, the video coding rate is saved under the condition that the subjective video quality is hardly lost, the coding efficiency is improved, and the video watching experience of a user is optimized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of video processing technology, and in particular to a video encoding method, apparatus, device, storage medium, and program product. Background Art

[0002] With the rapid development of Internet technology, the way of disseminating information through video is becoming more and more widespread, such as live video, video conferencing, short videos, etc. Since video content occupies a high bandwidth, the large amount of data transmitted during video transmission may cause freezes or interruptions in the video playback of the user terminal, affecting the user's viewing experience.

[0003] In the related technology, by directly reducing the configured bit rate or frame rate of video encoding, the amount of video data can be reduced to achieve the purpose of saving video bit rate, but it will cause the video to lose more detail information during the compression process, making the video picture blurred or distorted, which has a great impact on the subjective video quality and reduces the video viewing experience, which needs to be improved. Summary of the invention

[0004] The embodiments of the present application provide a video encoding method, apparatus, device, storage medium and program product, which solve the problem in the related art that the configured bit rate or frame rate of video encoding is directly reduced, resulting in the loss of more detail information in the video compression process, making the video picture blurred or distorted, which will have a significant impact on the subjective video quality and reduce the video viewing experience. The method saves the video encoding bit rate with almost no loss of subjective video quality, improves the encoding efficiency, and optimizes the user's video viewing experience.

[0005] In a first aspect, an embodiment of the present application provides a video encoding method, the method comprising:

[0006] Obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames;

[0007] In the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculate the proportion of the skin area in the video frame to be evaluated;

[0008] When the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frames detected as still frames after the video frame to be evaluated are encoded based on the gradually increasing minimum quantization parameter value.

[0009] In a second aspect, an embodiment of the present application further provides a video encoding device, the device comprising:

[0010] An acquisition module, configured to acquire a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames;

[0011] A calculation module is configured to, in the process of encoding the video frame, determine whether a video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, and calculate the proportion of the skin area in the video frame to be evaluated;

[0012] The encoding module is configured to encode the video frames detected as still frames after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range.

[0013] In a third aspect, an embodiment of the present application further provides a video encoding device, the device comprising:

[0014] one or more processors;

[0015] a storage device configured to store one or more programs,

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the video encoding method described in the embodiment of the present application.

[0017] In a fourth aspect, an embodiment of the present application further provides a non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the video encoding method described in the embodiment of the present application when executed by a computer processor.

[0018] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device executes the video encoding method described in the embodiment of the present application.

[0019] In an embodiment of the present application, a video frame sequence to be encoded and a corresponding video frame rate are obtained, wherein the video frame sequence includes video frames; in the process of encoding the video frames, when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, it is determined whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and the proportion of the skin area in the video frame to be evaluated is calculated; when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frame detected as a still frame after the video frame to be evaluated is encoded based on a gradually increasing minimum quantization parameter value. In the above scheme, by setting the video frame rate greater than the set frame rate threshold and detecting that the currently encoded video frame does not contain a face area as the start condition for detecting a still frame, it is possible to avoid saving the encoding bit rate of low frame rate videos or video frames containing areas of interest, thereby ensuring basic video quality. By calculating and determining that video frames within a preset duration are still frames and that the proportion of their skin areas is within a preset threshold range, it is possible to effectively evaluate whether subsequent video frames are in a relatively static motion state, thereby reducing the impact of adjusting the encoding settings on the quality of subsequent video frames. By encoding the video frames detected as still frames after the video frame to be evaluated based on a gradually increasing minimum quantization parameter value, it is possible to save the video encoding bit rate with almost no loss of subjective video quality, thereby improving encoding efficiency and optimizing the user's video viewing experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 A flowchart of a video encoding method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of a video encoding method including a process of adjusting a minimum quantization parameter value and an encoding mode corresponding to a video frame provided in an embodiment of the present application;

[0022] Figure 3 A flowchart of a video encoding method including a process of adjusting a minimum quantization parameter value corresponding to a video frame according to different frame types provided in an embodiment of the present application;

[0023] Figure 4 A flowchart of a video encoding method including a process of determining whether a forward prediction frame is a still frame provided in an embodiment of the present application;

[0024] Figure 5 A flowchart of a video encoding method including a process of determining whether a bidirectional prediction frame is a still frame provided in an embodiment of the present application;

[0025] Figure 6 A flowchart of a video encoding method including a process of determining whether video frames of different frame types are still frames provided in an embodiment of the present application;

[0026] Figure 7 A structural block diagram of a video encoding device provided in an embodiment of the present application;

[0027] Figure 8 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0028] The embodiments of the present application are further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than to limit the embodiments of the present application. It should also be noted that, for ease of description, only parts related to the embodiments of the present application are shown in the accompanying drawings, rather than all structures.

[0029] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0030] The video encoding method provided by the embodiment of the present application can effectively judge whether the subsequent video frames are in a relatively static motion state in the process of encoding the video frame sequence, combining whether the video frame to be evaluated within a preset duration is a static frame and the proportion of the skin area of ​​the video frame to be evaluated, thereby adjusting the encoding settings of the video frame in the static motion period, and encoding the video frame based on the adjusted encoding settings, which is conducive to ensuring the subjective video quality while saving the encoding bit rate. Relevant application scenarios may include: video conferencing, video calls, indoor and outdoor live broadcasts, and short videos. The several application scenarios listed above are only exemplary and explanatory. In practical applications, the video encoding method can also be used in video encoding in other scenarios, and the embodiment of the present application does not limit this. The video encoding method, device, equipment, storage medium and program product provided by the embodiment of the present application are intended to solve the problem that the configuration bit rate or frame rate of video encoding is directly reduced in the related technology, resulting in the loss of more detail information in the video during the compression process, making the video picture blurred or distorted, which will have a greater impact on the subjective video quality and reduce the viewing experience of the video.

[0031] In the video encoding method provided in the embodiment of the present application, the executor of each step can be a computer device, which refers to any electronic device with data calculation, processing and storage capabilities, such as mobile phones, PCs (Personal Computers), tablet computers and other terminal devices, and can also be servers and other devices, which are not limited in the embodiment of the present application.

[0032] Figure 1 A flowchart of a video encoding method provided in an embodiment of the present application. Figure 1 As shown, the following steps are included:

[0033] Step S101 : obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0034] The video frame sequence may be composed of a plurality of video frames in a continuous order, and the plurality of video frames may include one or more of key frames, forward prediction frames, and bidirectional prediction frames. The video frame rate may be the number of display frames per second set when the video frame sequence is input, for example, 24 frames / second, 48 frames / second, etc.

[0035] Step S102: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculate the proportion of the skin area in the video frame to be evaluated.

[0036] Among them, since the face area is one of the more prominent and important contents in the video frame, it is also an area of ​​interest that the audience is more likely to pay attention to. The face area contains rich details, such as facial features, expressions, skin color, etc. These details have an important impact on the subjective quality of the video. Therefore, it is necessary to avoid saving the encoding bit rate of the face area and ensure the encoding quality of the face area, so as not to affect the overall viewing experience of the audience. Therefore, while encoding the video frames in the video frame sequence frame by frame, the video frames can be detected based on a preset face detection algorithm, and whether the video frame contains a face area is used as one of the restriction conditions for whether to adjust the encoding settings later. If the video frame contains a face area, it can be considered that the subsequent video frame is likely to contain a face area. The still frame detection of the subsequent video frame and the calculation of the proportion of the skin area are not performed temporarily, and there is no need to adjust the relevant encoding settings. If the video frame does not contain a face area, it can be considered that the subsequent video frame is unlikely to contain a face area. It can be combined with the video frame rate to determine whether to perform the still frame detection of the subsequent video frame and the calculation of the proportion of the skin area to determine whether to adjust the encoding settings to save the encoding bit rate.

[0037] In addition, the video frame rate is also one of the limiting conditions for whether to make subsequent adjustments to the encoding settings. If the video frame rate set when inputting the video frame sequence is small, it can be considered that the video itself has a low level of smoothness and content quality, and the required encoding bit rate is small. Therefore, performing encoding setting adjustments to save the encoding bit rate may further reduce the subjective video quality and affect the user's video viewing experience. Therefore, the video frame rate can be compared with the set frame rate threshold. The frame rate threshold can be used as the minimum reference frame rate to limit the subsequent encoding setting adjustments to save the encoding bit rate. For example, the frame rate threshold can be set to 16 frames per second. When it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, the still frame detection and skin area ratio calculation of the subsequent video frames can be continued to determine whether to make encoding setting adjustments to save the encoding bit rate.

[0038] In order to accurately identify the static motion period in the video frame sequence, it is possible to continuously detect whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a static frame, for example, the preset time length can be 2s. Among them, the static frame can be a video frame in which the video content has little change relative to the previous video frame and is in a relatively static state. If the video frames to be evaluated within the preset time length are all static frames, it can be regarded that the subsequent video frames have entered the static motion period. In one embodiment, it is possible to determine whether the video frame is a static frame based on the statistical information of the number of coding blocks in which the skip mode is applied and the coding cost information of the coding blocks in the video frames to be evaluated within the preset time length after the currently encoded video frame. In one embodiment, it is possible to determine whether the video frame to be evaluated is a static frame based on the frame type and predictive coding information corresponding to the video frame to be evaluated within the preset time length after the currently encoded video frame, and effectively combine the frame content characteristics corresponding to different frame types, and the predictive coding information reflecting the change of frame content to perform static frame judgment.

[0039] Optionally, the video frame to be evaluated within the preset duration may include one or more of a key frame, a forward prediction frame, and a bidirectional prediction frame. In one embodiment, if the video frame to be evaluated is a key frame, one or more of the row-level intra-frame cost, column-level intra-frame cost, and motion vector information of the key frame may be selected for reference, and combined with the relevant prediction coding information of the previous most recent forward prediction frame, to determine whether the key frame is a still frame. In one embodiment, if the video frame to be evaluated is a forward prediction frame, one or more of the row-level inter-frame cost, column-level inter-frame cost, and motion vector information of the forward prediction frame may be selected for reference, to determine whether the forward prediction frame is a still frame. In one embodiment, if the video frame to be evaluated is a bidirectional prediction frame, one or more of the row-level inter-frame cost, column-level inter-frame cost, and motion vector information of the forward prediction frame may be selected for reference, and combined with the relevant prediction coding information of the previous most recent forward prediction frame, to determine whether the bidirectional prediction frame is a still frame.

[0040] In addition, in addition to determining whether the video frame to be evaluated within the preset duration is a still frame to determine whether the subsequent video frame enters the still motion period, it is also necessary to determine whether the video frame to be evaluated contains more portrait areas by calculating the proportion of the skin area in the video frame to be evaluated. Since the portrait area can also be regarded as an area of ​​interest that the audience pays more attention to, if the proportion of the skin area in the video frame to be evaluated is high, it can be regarded as that there are more portrait areas in the video frame to be evaluated, and the adjustment of the encoding setting to save the encoding bit rate has a greater impact on the subjective video quality; if the proportion of the skin area in the video frame to be evaluated is low, it can be regarded as that there are fewer portrait areas in the video frame to be evaluated, and the adjustment of the encoding setting to save the encoding bit rate has a smaller impact on the subjective video quality. In one embodiment, the video frame to be evaluated can be subjected to skin detection based on a preset skin detection algorithm, the skin area in the video frame to be evaluated can be determined, and the skin area size can be divided by the size of the whole frame area of ​​the video frame to be evaluated to obtain the proportion of the skin area. In one embodiment, a certain video frame before the end of the preset duration can be selected to calculate the proportion of the skin area. In one embodiment, multiple video frames within the preset duration can be selected to calculate the proportion of the skin area, and the average value thereof can be taken as the final proportion result.

[0041] Step S103: when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, encoding the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value.

[0042] Among them, if the video frame to be evaluated is a still frame, and the proportion of the skin area is in a preset threshold interval, for example, the threshold interval can be 5%-15%, it can be regarded as the subsequent video frame entering the still motion period, and the video frame involves less human content, and the encoding setting adjustment that saves the encoding bit rate can be performed, which has little impact on the subjective video quality, which is conducive to ensuring the audience's video perception. After the video frame to be evaluated of the preset length, the continuous multiple video frames detected as still frames can be regarded as being in the still motion period, and the multiple video frames are encoded based on the gradually increasing minimum quantization parameter value, so as to avoid the sudden increase of the minimum quantization parameter value causing obvious video quality switching and affecting the user's perception. Among them, the minimum quantization parameter value is the minimum limit value of the quantization parameter of the encoded video frame. The quantization parameter value is a parameter reflecting the degree of data compression in the video encoding process. The smaller the quantization parameter value, the finer the quantization and the higher the image quality, but the larger the amount of data generated. The larger the quantization parameter value, the coarser the quantization and the lower the image quality, but the compression ratio is higher and the required amount of data is smaller. Therefore, by increasing the set minimum quantization parameter value, the quantization parameter value of the video frame can be maintained at a higher level, and the quantization parameter value corresponding to the video frame can be increased to a certain extent, thereby achieving the purpose of saving bit rate.

[0043] In one embodiment, when the video frame to be evaluated is a still frame within a preset time length and the proportion of the skin area is within a preset threshold range, the minimum quantization parameter value is increased by a preset value for the video frame detected as a still frame after the video frame to be evaluated in sequence according to the frame sequence, and the corresponding video frame detected as a still frame is encoded based on the increased minimum quantization parameter value. Among them, the minimum quantization parameter value can be set with an initial value, and the frame sequence can be the encoding order of the video frame detected as a still frame after the video frame to be evaluated. Before encoding the video frame, the minimum quantization parameter value can be increased by a preset value according to the frame sequence, and then the corresponding encoding is performed. For example, the initial value of the minimum quantization parameter value is 0, the minimum quantization parameter value corresponding to the first frame is 1, which is equivalent to increasing by 1 on the basis of the initial value, the minimum quantization parameter value corresponding to the second frame is 2, which is equivalent to increasing by 1 on the basis of the minimum quantization parameter value corresponding to the first frame, the minimum quantization parameter value corresponding to the third frame is 3, and so on. Of course, an upper limit value for the increase of the minimum quantization parameter value can also be set. During the encoding process of a video frame detected as a still frame after a preset duration, if the gradually increasing minimum quantization parameter value has reached the upper limit value, the minimum quantization parameter value will no longer be increased, and the upper limit value will be maintained for encoding the video frame to avoid a significant decrease in subjective video quality. In one embodiment, a specific video frame can be selected according to the frame type or encoding order of the video frame, and the minimum quantization parameter value continues to be increased before the specific video frame is encoded, and other video frames remain the same as the previous video frame. In one embodiment, after adjusting the minimum quantization parameter values ​​of a plurality of consecutive video frames detected as still frames after a preset duration, if the video frame is detected as a non-still frame, the minimum quantization parameter value is restored to the initial value.

[0044] In the above, by obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames; in the process of encoding the video frames, when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, it is determined whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and the proportion of the skin area in the video frame to be evaluated is calculated; when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frame detected as a still frame after the video frame to be evaluated is encoded based on a gradually increasing minimum quantization parameter value. In the above scheme, by setting the video frame rate greater than the set frame rate threshold and detecting that the currently encoded video frame does not contain a face area as the start condition for detecting a still frame, it is possible to avoid saving the encoding bit rate of low frame rate videos or video frames containing areas of interest, thereby ensuring basic video quality. By calculating and determining that video frames within a preset duration are still frames and that the proportion of their skin areas is within a preset threshold range, it is possible to effectively evaluate whether subsequent video frames are in a relatively static motion state, thereby reducing the impact of adjusting the encoding settings on the quality of subsequent video frames. By encoding the video frames detected as still frames after the video frame to be evaluated based on a gradually increasing minimum quantization parameter value, it is possible to save the video encoding bit rate with almost no loss of subjective video quality, thereby improving encoding efficiency and optimizing the user's video viewing experience.

[0045] Figure 2 A flowchart of a video encoding method including a process of adjusting the minimum quantization parameter value and encoding mode corresponding to a video frame provided in an embodiment of the present application. Figure 2 As shown, the following steps are included:

[0046] Step S201: Obtain a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0047] Step S202: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculate the proportion of the skin area in the video frame to be evaluated.

[0048] Step S203: when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, encoding the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value.

[0049] Step S204: when the video frame to be evaluated is a still frame and the proportion of the skin area is less than the lower threshold of the threshold interval, based on the gradually increasing minimum quantization parameter value and the pre-assigned skip mode, encode the video frame detected as a still frame after the video frame to be evaluated.

[0050] Wherein, if the video frame to be evaluated is a still frame, and the proportion of the skin area is less than the lower limit threshold of the threshold interval, for example, the threshold interval can be 5%-15%, then the proportion of the skin area is less than 5%, which can be regarded as the subsequent video frame entering the still motion period, and the video frame involves almost no human content. On the basis of gradually increasing the minimum quantization parameter value, the use of the skip mode can be added, which has little impact on the subjective video quality, and can also improve the coding efficiency and save the coding bit rate. Wherein, the pre-allocation method of the skip mode can be allocated to the video frame in the specific minimum image group MiniGOP detected as a still frame after the video frame to be evaluated, or allocated to the video frame at a specific position according to a preset rule. Wherein, the skip mode can be a predefined coding mode in the video coding standard, for example, the Skip mode defined in the HEVC coding standard. In one embodiment, according to the coding order of the video frame detected as a still frame after the video frame to be evaluated, the even frame or the odd frame can be selected to use the skip mode, for example, the first frame, the third frame, the fifth frame, etc. In one embodiment, the forward prediction frame and its subsequent bidirectional prediction frame at an even or odd coding position may be selected to use a skip mode according to the coding order and frame type of the video frame detected as a still frame after the video frame to be evaluated, for example, the first forward prediction frame and its subsequent bidirectional prediction frame, the third forward prediction frame and its subsequent bidirectional prediction frame, the fifth forward prediction frame and its subsequent bidirectional prediction frame, and so on. In one embodiment, since the skip mode is used for the forward prediction frame and its subsequent bidirectional prediction frame, most of the video frames in the minimum image group in the video frame sequence will be kept the same. In the case where the minimum image group is large, it may cause obvious playback jams. Therefore, it can be set that the skip mode can only be used for this part of the video frames when the number of bidirectional prediction frames subsequent to the forward prediction frame is less than or equal to 3, so as not to affect the video viewing experience.

[0051] As mentioned above, when the video frame to be evaluated is a still frame and the proportion of the skin area is less than the lower limit threshold of the threshold interval, the use of skip mode is added to the video frame detected as a still frame after the video frame to be evaluated. This can further improve the encoding efficiency and save the encoding bit rate while almost no loss of the subjective quality of the video.

[0052] Figure 3 A flowchart of a video encoding method including a process of adjusting the minimum quantization parameter value corresponding to a video frame according to different frame types is provided in an embodiment of the present application. Figure 3As shown, the following steps are included:

[0053] Step S301: Obtain a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0054] Step S302: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculate the proportion of the skin area in the video frame to be evaluated.

[0055] Step S303: When the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, for the forward prediction frame detected as a still frame after the video frame to be evaluated, the minimum quantization parameter value is increased by a preset value in sequence according to the encoding order of the forward prediction frame after the video frame to be evaluated, and the corresponding forward prediction frame is encoded based on the increased minimum quantization parameter value.

[0056] Step S304: When the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, for the key frames and bidirectional prediction frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter value is set to be the same as the minimum quantization parameter value corresponding to the previous forward prediction frame, and the key frames and bidirectional prediction frames are encoded based on the set minimum quantization parameter value.

[0057] Among them, the forward prediction frame detected as a still frame after the video frame to be evaluated can be set as the increment node of the minimum quantization parameter value, while the key frame and the bidirectional prediction frame keep the same minimum quantization parameter value as the previous forward prediction frame. For example, the initial value of the minimum quantization parameter value is 0, the minimum quantization parameter value corresponding to the first forward prediction frame is 1, which is equivalent to increasing by 1 on the basis of the initial value, and the minimum quantization parameter values ​​corresponding to the subsequent key frames and bidirectional prediction frames are 1, and the minimum quantization parameter value corresponding to the second forward prediction frame is 2, which is equivalent to increasing by 1 on the basis of the minimum quantization parameter value corresponding to the first forward prediction frame, and the minimum quantization parameter values ​​corresponding to the subsequent key frames and bidirectional prediction frames are 2, and the minimum quantization parameter value corresponding to the third forward prediction frame is 3, and so on. Of course, the upper limit value of the increase of the minimum quantization parameter value can also be set, for example, the upper limit value is 21, then after a forward prediction frame increases to 21, the minimum quantization parameter value of the subsequent video frames will no longer increase, and the upper limit value is maintained for encoding the video frame to avoid a significant decrease in subjective video quality.

[0058] As described above, by setting the forward prediction frame detected as a still frame after the video frame to be evaluated as an increasing node of the minimum quantization parameter value, and the key frame and the bidirectional prediction frame are set to the same minimum quantization parameter value as the previous forward prediction frame, the video quality switching can be smoother, ensuring the smooth viewing experience of the video.

[0059] Figure 4 A flowchart of a video encoding method including a process of determining whether a forward prediction frame is a still frame is provided in an embodiment of the present application. Figure 4 As shown, the following steps are included:

[0060] Step S401: Obtain a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0061] Step S402: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, based on the frame type and prediction coding information corresponding to the video frame to be evaluated within a preset time length after the currently encoded video frame, and in the case that the video frame to be evaluated is a forward prediction frame, the first maximum row-level inter-frame cost is determined based on the inter-frame cost information of the coding unit in the video frame to be evaluated.

[0062] For example, inter-frame cost information and motion vector information of a coding unit in a forward prediction frame may be shown in the following Table 1:

[0063] Table 1. Inter-frame cost and motion vector of intra-frame coding unit

[0064]

[0065] Among them, the forward prediction frame is divided into m rows and n columns. The inter-frame cost of the coding unit located at the 1st row and the 1st column is recorded as inter-cost-00, and the motion vector is recorded as MV-00. The inter-frame cost of the coding unit located at the 1st row and the 2nd column is recorded as inter-cost-01, and the motion vector is recorded as MV-01, and so on.

[0066] In one embodiment, the calculation process of the first maximum row-level inter-frame cost is specifically as follows: the inter-frame costs corresponding to the coding units of each row in the forward prediction frame are added to obtain multiple row-level inter-frame costs, the multiple row-level inter-frame costs are compared in size, and the row-level inter-frame cost with the largest value is determined as the first maximum row-level inter-frame cost. Optionally, the first few row-level inter-frame costs with the largest values ​​can be averaged, and the calculation result is determined as the first maximum row-level inter-frame cost.

[0067] Step S403: When the first maximum row-level inter-frame cost is less than or equal to the first preset cost threshold, determine the video frame to be evaluated as a still frame.

[0068] The first preset cost threshold may be a fixed threshold or a threshold determined based on the number of columns of the forward prediction frame. Optionally, the first preset cost threshold may be expressed as n×TH1 STILL , where n is the number of columns of the coding unit, TH1 STILL is a fixed threshold, so that it can adapt to the difference in inter-frame costs of different resolutions and encoding configurations, and more accurately set the preset cost threshold adapted to specific application scenarios. If the first maximum row-level inter-frame cost is less than or equal to the first preset cost threshold, it can be regarded as the first maximum row-level inter-frame cost of the forward prediction frame is relatively small, and the change in the corresponding row with the reference frame is very small, and it can be regarded as a static frame.

[0069] Step S404: when the first maximum row-level inter-frame cost is greater than the first preset cost threshold, count the number of first units of coding units that meet the preset motion amplitude condition in the video frame to be evaluated.

[0070] Among them, if the first maximum line-level inter-frame cost is greater than the first preset cost threshold, it can be regarded that the first maximum line-level inter-frame cost of the forward prediction frame is relatively large, and there is a certain change in the corresponding line with the reference frame. It is necessary to further combine whether the forward prediction frame has a certain degree of motion amplitude for fine judgment. In one embodiment, satisfying the preset motion amplitude condition includes: the component length of the motion vector of the coding unit in the horizontal axis direction and the vertical axis direction is greater than or equal to the preset length threshold, the inter-frame cost of the coding unit is greater than the preset cost threshold, and the product of the vector length of the motion vector of the coding unit and the inter-frame cost is greater than the preset numerical threshold. Therefore, the coding unit that meets the preset motion amplitude condition can be regarded as having a relatively large motion amplitude. By counting the number of coding units that meet the preset motion amplitude condition in the forward prediction frame, it can be determined whether there are more local motion areas in the whole frame, and then determine whether the forward prediction frame is a still frame. Step S405, when the number of first units is less than the preset number threshold, the video frame to be evaluated is determined as a still frame.

[0071] If the number of the first units is less than a preset number threshold, it can be considered that most of the areas in the forward prediction frame are stationary motion areas, and thus the forward prediction frame can be determined as a stationary frame.

[0072] Step S406, calculating the proportion of the skin area in the video frame to be evaluated;

[0073] Step S407: when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, encoding the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value.

[0074] As described above, based on the comparison result of the maximum row-level inter-frame cost of the forward prediction frame and the preset cost threshold, the relative change degree of the forward prediction frame and the reference frame can be preliminarily judged, and whether the forward prediction frame is a still frame can be effectively determined. By adding the number statistics of coding units that meet the preset motion amplitude conditions when the first maximum row-level inter-frame cost is greater than the first preset cost threshold, the judgment of whether there are many motion areas in the forward prediction frame can be refined, and whether the forward prediction frame is a still frame can be judged more accurately, thereby improving the detection accuracy of still frames.

[0075] Figure 5 A flowchart of a video encoding method including a process of determining whether a bidirectional prediction frame is a still frame is provided in an embodiment of the present application. Figure 5 As shown, the following steps are included:

[0076] Step S501: Obtain a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0077] Step S502: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than the set frame rate threshold, based on the frame type and prediction coding information corresponding to the video frame to be evaluated within a preset time length after the currently encoded video frame, and in the case that the video frame to be evaluated is a bidirectional prediction frame, the second maximum row-level inter-frame cost is determined based on the inter-frame cost information of the coding unit in the video frame to be evaluated.

[0078] In one embodiment, the calculation process of the second maximum row-level inter-frame cost is specifically as follows: the inter-frame costs corresponding to the coding units of each row in the bidirectional prediction frame are added to obtain multiple row-level inter-frame costs, the multiple row-level inter-frame costs are compared in size, and the row-level inter-frame cost with the largest value is determined as the second maximum row-level inter-frame cost. Optionally, the first few row-level inter-frame costs with the largest values ​​can be averaged, and the calculation result is determined as the second maximum row-level inter-frame cost.

[0079] Step S503, when the second maximum row-level inter-frame cost is less than or equal to the second preset cost threshold, or when the second maximum row-level inter-frame cost is less than or equal to the maximum row-level inter-frame cost of the previous forward prediction frame, determine the video frame to be evaluated as a still frame.

[0080] The second preset cost threshold may be a fixed threshold or a threshold determined based on the number of columns of the bidirectional prediction frame. Optionally, the second preset cost threshold may be set to be the same as the first preset cost threshold, expressed as n×TH1 STILL , where n is the number of columns of the coding unit, TH1 STILLIt is a fixed threshold, thereby being able to adapt to the difference in inter-frame costs of different resolutions and encoding configurations, and more accurately setting the preset cost threshold that is suitable for specific application scenarios. If the second maximum row-level inter-frame cost is less than or equal to the second preset cost threshold, it can be regarded as the second maximum row-level inter-frame cost of the bidirectional prediction frame being relatively small, and the change in the corresponding row compared with the reference frame is very small, and it can be regarded as a still frame. In addition, the second maximum row-level inter-frame cost can be compared with the maximum row-level inter-frame cost of the previous forward prediction frame. If the second maximum row-level inter-frame cost is less than or equal to the maximum row-level inter-frame cost of the previous forward prediction frame, it can be regarded as the change in the corresponding row of the bidirectional prediction frame relative to the previous video frame being very small, and it can also be regarded as a still frame.

[0081] Step S504: When the second maximum row-level inter-frame cost is greater than the second preset cost threshold and the second maximum row-level inter-frame cost is greater than the maximum row-level inter-frame cost of the previous forward prediction frame, count the second unit number of the coding units that meet the preset motion amplitude condition in the video frame to be evaluated.

[0082] Among them, if the second maximum line-level inter-frame cost is greater than the second preset cost threshold, it can be regarded that the second maximum line-level inter-frame cost of the forward prediction frame is relatively large, and there is a certain change in the corresponding line with the reference frame, or, if the second maximum line-level inter-frame cost is greater than the maximum line-level inter-frame cost of the previous forward prediction frame, it can be regarded that there is a certain change in the corresponding line between the forward prediction frame and the previous video frame, and it is necessary to further combine whether there is a certain degree of motion amplitude in the bidirectional prediction frame for fine judgment. The specific preset amplitude conditions can refer to the relevant description in the aforementioned embodiment, which will not be repeated here. Therefore, the encoding unit that meets the preset motion amplitude condition can be regarded as having a relatively large motion amplitude. By counting the number of encoding units that meet the preset motion amplitude condition in the bidirectional prediction frame, it can be determined whether there are more local motion areas in the entire frame, and then determine whether the bidirectional prediction frame is a still frame.

[0083] Step S505: When the number of second units is less than a preset number threshold, the video frame to be evaluated is determined to be a still frame.

[0084] If the number of the first units is less than a preset number threshold, it can be considered that most of the areas in the forward prediction frame are stationary motion areas, and thus the bidirectional prediction frame can be determined as a stationary frame.

[0085] Step S506: Calculate the proportion of the skin area in the video frame to be evaluated.

[0086] Step S507: when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, encoding the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value.

[0087] As described above, based on the maximum row-level inter-frame cost of the bidirectional prediction frame and the preset cost threshold, the relative change degree of the bidirectional prediction frame and the reference frame can be preliminarily judged, and whether the bidirectional prediction frame is a still frame can be effectively determined. Alternatively, based on the comparison result of the maximum row-level inter-frame cost and the maximum row-level inter-frame cost of the previous forward prediction frame, the relative change degree of the bidirectional prediction frame and the previous video frame can be preliminarily judged, and whether the bidirectional prediction frame is a still frame can be effectively determined. When the second maximum row-level inter-frame cost is greater than the second preset cost threshold and the second maximum row-level inter-frame cost is greater than the maximum row-level inter-frame cost of the previous forward prediction frame, the number of coding units that meet the preset motion amplitude condition is added to count, and the judgment of whether there are more motion areas in the bidirectional prediction frame can be refined, and whether the bidirectional prediction frame is a still frame can be more accurately judged, thereby improving the detection accuracy of still frames.

[0088] Figure 6 A flowchart of a video encoding method including a process of determining whether video frames of different frame types are still frames is provided in an embodiment of the present application. Figure 6 As shown, the following steps are included:

[0089] Step S601: Obtain a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames.

[0090] Step S602: During the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, the frame type and prediction coding information corresponding to the video frame to be evaluated within a preset time length after the currently encoded video frame are obtained.

[0091] The video frames to be evaluated within the preset time length include one or more of key frames, forward prediction frames and bidirectional prediction frames.

[0092] Step S603: When the video frame to be evaluated is a forward prediction frame, determine a first maximum row-level inter-frame cost according to inter-frame cost information of coding units in the video frame to be evaluated.

[0093] Step S604: When the first maximum row-level inter-frame cost is less than or equal to the first preset cost threshold, the video frame to be evaluated is determined to be a still frame.

[0094] Step S605: When the video frame to be evaluated is a bidirectional prediction frame, determine a second maximum row-level inter-frame cost according to the inter-frame cost information of the coding units in the video frame to be evaluated.

[0095] Step S606: When the second maximum row-level inter-frame cost is less than or equal to the second preset cost threshold, or when the second maximum row-level inter-frame cost is less than or equal to the maximum row-level inter-frame cost of the previous forward prediction frame, the video frame to be evaluated is determined as a still frame.

[0096] Step S607: When the video frame to be evaluated is a key frame, determine the maximum row-level intra-frame cost according to the intra-frame cost information of the coding units in the video frame to be evaluated.

[0097] For example, the intra-frame cost information of the coding unit in the key frame may be as shown in Table 2 below:

[0098] Table 2. Intra-frame cost of intra-frame coding unit

[0099]

[0100] The forward prediction frame is divided into m rows and n columns, the intra-frame cost of the coding unit located at the 1st row and the 1st column is recorded as inter-cost-00, the inter-frame cost of the coding unit located at the 1st row and the 2nd column is recorded as inter-cost-01, and so on.

[0101] In one embodiment, the calculation process of the maximum row-level intra-frame cost is specifically as follows: the intra-frame costs corresponding to the coding units of each row in the key frame are added together to obtain multiple row-level intra-frame costs, the multiple row-level intra-frame costs are compared in size, and the row-level intra-frame cost with the largest value is determined as the maximum row-level intra-frame cost. Optionally, the first few row-level intra-frame costs with the largest values ​​can be averaged, and the calculation result is determined as the maximum row-level intra-frame cost.

[0102] Step S608: When the previous forward prediction frame of the video frame to be evaluated is a still frame, and the difference between the maximum row-level intra-frame cost and the maximum row-level intra-frame cost of the previous forward prediction frame is less than or equal to a preset ratio relative to the maximum row-level intra-frame cost of the previous forward prediction frame, the video frame to be evaluated is determined to be a still frame.

[0103] Among them, if the previous forward prediction frame is a still frame, and the difference between the maximum row-level intra-frame cost and the maximum row-level intra-frame cost of the previous forward prediction frame, relative to the maximum row-level intra-frame cost of the previous forward prediction frame, is less than or equal to a preset ratio, for example, the preset ratio can be 0.05, it can be regarded that the maximum row-level intra-frame cost of the key frame is similar to or smaller than the maximum row-level intra-frame cost of the previous forward prediction frame, and the key frame has a smaller change amplitude in the corresponding row than the previous video frame, and can be regarded as a still frame.

[0104] Step S609: Calculate the proportion of the skin area in the video frame to be evaluated.

[0105] Step S610: When the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frame detected as a still frame after the video frame to be evaluated is encoded based on the gradually increasing minimum quantization parameter value.

[0106] As described above, corresponding methods for determining still frames are set for video frames of different frame types, which effectively refer to the prediction coding information corresponding to each frame type, combine the set threshold conditions and the relevant prediction coding information of the previous video frame, accurately detect whether the video frame to be evaluated is a still frame, and effectively monitor whether the still frame in the video frame sequence enters the still motion period.

[0107] In one embodiment, the video encoding method provided in the embodiment of the present application is applied to encode a video frame sequence containing 100 frames, and the frame rate corresponding to the video frame sequence is 24 frames per second. The specific encoding process is described in conjunction with Table 3 provided below:

[0108] Table 3. Coding optimization information of video frame sequence

[0109]

[0110]

[0111] Among them, O indicates that the threshold condition is met, X indicates that the threshold condition is not met, I frame is a key frame, P frame is a forward prediction frame, and B frame is a bidirectional prediction frame.

[0112] Among them, if the set frame rate threshold is 16 frames / second, the preset duration is 2s, the frame rate corresponding to the video frame sequence is 24 frames / second, and it is detected that frame 0 does not contain a face area, frame 0 is processed according to normal encoding, and the maximum row-level inter-frame cost of frame 1 meets the set threshold condition, then frame 1 is detected as a still frame, until frame 44 is also detected as a still frame, and the calculated skin area ratio of frame 44 is less than the lower limit threshold of the set threshold interval, and then until frame 49 is also detected as a still frame, it can be determined that the video frames within 2s are all still frames. Combined with the threshold comparison result of the skin area ratio of frame 44, the minimum quantization parameter value of subsequent video frames can be gradually increased and some video frames can be allocated to use skip mode. Therefore, frame 49 is the first forward prediction frame, and the minimum quantization parameter value can be increased by 1 based on the initial value of the minimum quantization parameter value, and all coding units in frame 49 are set to skip mode. From frame 50 to frame 52, the minimum quantization parameter value is kept the same as the minimum quantization parameter value of the previous forward prediction frame, and all coding units in these frames are set to skip mode. Frame 53 is the second forward prediction frame, and the minimum quantization parameter value can only be increased by 1, and the skip mode is not used. From frame 54 to frame 56, the minimum quantization parameter value is kept the same as the minimum quantization parameter value of the previous forward prediction frame, and the skip mode is also not used. Frame 57 is the third forward prediction frame, and the minimum quantization parameter value can be increased by 1, and all coding units in frame 57 are set to skip mode. And so on, for frames 58 to 95 that are continuously detected as still frames, continue to repeat the above encoding setting adjustment process. Until it is detected that frame 96 does not meet the set threshold condition for being judged as a still frame, the minimum quantization parameter value is restored to the initial value and the normal encoding process is followed.

[0113] Figure 7 This is a structural block diagram of a video encoding device provided in an embodiment of the present application. The device is configured to execute the video encoding method provided in the above embodiment and has the corresponding functional modules and beneficial effects of the execution method. Figure 7 As shown, the device comprises:

[0114] An acquisition module 101 is configured to acquire a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames;

[0115] The calculation module 102 is configured to, during the process of encoding the video frame, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, and calculate the proportion of the skin area in the video frame to be evaluated;

[0116] The encoding module 103 is configured to encode the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range.

[0117] In the above, by obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames; in the process of encoding the video frames, when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, it is determined whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and the proportion of the skin area in the video frame to be evaluated is calculated; when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frame detected as a still frame after the video frame to be evaluated is encoded based on a gradually increasing minimum quantization parameter value. In the above scheme, by setting the video frame rate greater than the set frame rate threshold and detecting that the currently encoded video frame does not contain a face area as the start condition for detecting a still frame, it is possible to avoid saving the encoding bit rate of low frame rate videos or video frames containing areas of interest, thereby ensuring basic video quality. By calculating and determining that video frames within a preset duration are still frames and that the proportion of their skin areas is within a preset threshold range, it is possible to effectively evaluate whether subsequent video frames are in a relatively static motion state, thereby reducing the impact of adjusting the encoding settings on the quality of subsequent video frames. By encoding the video frames detected as still frames after the video frame to be evaluated based on a gradually increasing minimum quantization parameter value, it is possible to save the video encoding bit rate with almost no loss of subjective video quality, thereby improving encoding efficiency and optimizing the user's video viewing experience.

[0118] In a possible embodiment, the computing module 102 is further configured to:

[0119] It is determined whether the video frame to be evaluated is a still frame according to the frame type and predictive coding information corresponding to the video frame to be evaluated within a preset time length after the currently encoded video frame.

[0120] In a possible embodiment, a second encoding module is further included, configured as follows:

[0121] When the video frame to be evaluated is a still frame and the proportion of the skin area is less than the lower threshold of the threshold interval, the video frame detected as a still frame after the video frame to be evaluated is encoded based on the gradually increasing minimum quantization parameter value and the pre-assigned skip mode.

[0122] In a possible embodiment, the encoding module 103 is further configured to:

[0123] For video frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter value is increased by a preset value in sequence according to the frame order, and the corresponding video frames detected as still frames are encoded based on the increased minimum quantization parameter value.

[0124] In a possible embodiment, the encoding module 103 is further configured to:

[0125] For the forward prediction frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter values ​​are sequentially increased by a preset value according to the encoding order of the forward prediction frames after the video frame to be evaluated, and the corresponding forward prediction frames are encoded based on the increased minimum quantization parameter values;

[0126] For key frames and bidirectional prediction frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter value is set to be the same as the minimum quantization parameter value corresponding to the previous forward prediction frame, and the key frames and bidirectional prediction frames are encoded based on the set minimum quantization parameter value.

[0127] In a possible embodiment, the prediction coding information includes inter-frame cost information, and the coding module 103 is further configured to:

[0128] In the case where the video frame to be evaluated is a forward prediction frame, determining a first maximum row-level inter-frame cost according to inter-frame cost information of coding units in the video frame to be evaluated;

[0129] When the first maximum row-level inter-frame cost is less than or equal to the first preset cost threshold, the video frame to be evaluated is determined to be a still frame.

[0130] In a possible embodiment, the encoding module 103 is further configured to:

[0131] When the first maximum row-level inter-frame cost is greater than a first preset cost threshold, counting the number of first units of coding units that meet a preset motion amplitude condition in the video frame to be evaluated;

[0132] When the number of the first units is less than a preset number threshold, the video frame to be evaluated is determined to be a still frame.

[0133] In a possible embodiment, satisfying the preset motion amplitude condition includes:

[0134] The component lengths of the motion vector of the coding unit in the horizontal and vertical directions are greater than or equal to a preset length threshold, the inter-frame cost of the coding unit is greater than a preset cost threshold, and the product of the vector length of the motion vector of the coding unit and the inter-frame cost is greater than a preset numerical threshold.

[0135] In a possible embodiment, the prediction coding information includes inter-frame cost information, and the coding module 103 is further configured to:

[0136] In the case where the video frame to be evaluated is a bidirectional prediction frame, determining a second maximum row-level inter-frame cost according to inter-frame cost information of coding units in the video frame to be evaluated;

[0137] When the second maximum row-level inter-frame cost is less than or equal to the second preset cost threshold, or when the second maximum row-level inter-frame cost is less than or equal to the maximum row-level inter-frame cost of the previous forward prediction frame, the video frame to be evaluated is determined to be a still frame.

[0138] In a possible embodiment, the encoding module 103 is further configured to:

[0139] When the second maximum row-level inter-frame cost is greater than the second preset cost threshold, and the second maximum row-level inter-frame cost is greater than the maximum row-level inter-frame cost of the previous forward prediction frame, counting the number of second units of the coding unit that meets the preset motion amplitude condition in the video frame to be evaluated;

[0140] When the number of the second units is less than the preset number threshold, the video frame to be evaluated is determined to be a still frame.

[0141] In a possible embodiment, the prediction coding information includes intra-frame cost information, and the coding module 103 is further configured to:

[0142] When the video frame to be evaluated is a key frame, determining a maximum row-level intra-frame cost according to intra-frame cost information of coding units in the video frame to be evaluated;

[0143] When the previous forward prediction frame of the video frame to be evaluated is a still frame, and the difference between the maximum row-level intra-frame cost and the maximum row-level intra-frame cost of the previous forward prediction frame is less than or equal to a preset ratio relative to the maximum row-level intra-frame cost of the previous forward prediction frame, the video frame to be evaluated is determined to be a still frame.

[0144] Figure 8 A schematic diagram of the structure of a video encoding device provided in an embodiment of the present application is shown in FIG. Figure 8 As shown, the device includes a processor 201, a memory 202, an input device 203 and an output device 204; the number of processors 201 in the device can be one or more. Figure 8 A processor 201 is taken as an example; the processor 201, memory 202, input device 203 and output device 204 in the device can be connected by a bus or other means. Figure 8The example of connecting through a bus is taken. The memory 202, as a computer-readable storage medium, can be configured to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the video encoding method in the embodiment of the present application. The processor 201 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 202, that is, implements the above-mentioned video encoding method. The input device 203 can be configured to receive input digital or character information, and generate key signal input related to user settings and function control of the device. The output device 204 may include a display device such as a display screen.

[0145] An embodiment of the present application also provides a non-volatile storage medium containing computer executable instructions, which, when executed by a computer processor, is configured to execute a video encoding method described in the above embodiment, which includes: obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames; in the process of encoding the video frames, when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, determining whether a video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculating the proportion of the skin area in the video frame to be evaluated; when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, encoding the video frame detected as a still frame after the video frame to be evaluated based on a gradually increasing minimum quantization parameter value.

[0146] It is worth noting that in the embodiment of the above-mentioned video encoding device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not configured to limit the protection scope of the embodiments of the present application.

[0147] In some possible implementations, various aspects of the method provided in the present application may also be implemented in the form of a program product, which includes a program code. When the program product is run on a computer device, the program code is configured to enable the computer device to execute the steps of the method according to various exemplary embodiments of the present application described above in this specification. For example, the computer device may execute the video encoding method described in the embodiment of the present application. The program product may be implemented in any combination of one or more readable media.

Claims

1. A video encoding method, characterized in that: include: Obtaining a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames; In the process of encoding the video frame, if it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, determine whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame, and calculate the proportion of the skin area in the video frame to be evaluated; When the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range, the video frames detected as still frames after the video frame to be evaluated are encoded based on the gradually increasing minimum quantization parameter value.

2. The video encoding method according to claim 1, characterized in that The determining whether the video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame includes: It is determined whether the video frame to be evaluated is a still frame according to the frame type and predictive coding information corresponding to the video frame to be evaluated within a preset time length after the currently encoded video frame.

3. The video encoding method according to claim 1, characterized in that: After calculating the proportion of the skin area in the video frame to be evaluated, the method further includes: When the video frame to be evaluated is a still frame and the proportion of the skin area is less than the lower threshold of the threshold interval, based on the gradually increasing minimum quantization parameter value and the pre-assigned skip mode, the video frame detected as a still frame after the video frame to be evaluated is encoded.

4. The video encoding method according to claim 1, characterized in that: The encoding of the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value comprises: For the video frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter value is increased by a preset value in sequence according to the frame order, and the corresponding video frames detected as still frames are encoded based on the increased minimum quantization parameter value.

5. The video encoding method according to claim 1, characterized in that: The encoding of the video frame detected as a still frame after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value comprises: For the forward prediction frames detected as still frames after the video frame to be evaluated, the minimum quantization parameter values ​​are sequentially increased by a preset value according to the encoding order of the forward prediction frames after the video frame to be evaluated, and the corresponding forward prediction frames are encoded based on the increased minimum quantization parameter values; For key frames and bidirectional prediction frames detected as still frames after the video frame to be evaluated, after setting the minimum quantization parameter value to be the same as the minimum quantization parameter value corresponding to the previous forward prediction frame, the key frames and the bidirectional prediction frames are encoded based on the set minimum quantization parameter value.

6. The video encoding method according to claim 2, characterized in that: The predictive coding information includes inter-frame cost information, and the determining whether the to-be-evaluated video frame is a still frame includes: In a case where the video frame to be evaluated is a forward prediction frame, determining a first maximum row-level inter-frame cost according to inter-frame cost information of coding units in the video frame to be evaluated; When the first maximum row-level inter-frame cost is less than or equal to a first preset cost threshold, the to-be-evaluated video frame is determined to be a still frame.

7. The video encoding method according to claim 6, characterized in that: Also includes: When the first maximum row-level inter-frame cost is greater than the first preset cost threshold, counting the number of first units of coding units that meet a preset motion amplitude condition in the video frame to be evaluated; When the number of the first units is less than a preset number threshold, the to-be-evaluated video frame is determined to be a still frame.

8. The video encoding method according to claim 7, characterized in that: The predetermined motion amplitude condition is met, including: The component lengths of the motion vector of the coding unit in the horizontal and vertical directions are greater than or equal to a preset length threshold, the inter-frame cost of the coding unit is greater than a preset cost threshold, and the product of the vector length of the motion vector of the coding unit and the inter-frame cost is greater than a preset numerical threshold.

9. The video encoding method according to claim 2, characterized in that: The predictive coding information includes inter-frame cost information, and the determining whether the to-be-evaluated video frame is a still frame includes: In a case where the video frame to be evaluated is a bidirectional prediction frame, determining a second maximum row-level inter-frame cost according to inter-frame cost information of coding units in the video frame to be evaluated; When the second maximum row-level inter-frame cost is less than or equal to a second preset cost threshold, or when the second maximum row-level inter-frame cost is less than or equal to the maximum row-level inter-frame cost of a previous forward prediction frame, the video frame to be evaluated is determined to be a still frame.

10. The video encoding method according to claim 9, characterized in that: Also includes: When the second maximum row-level inter-frame cost is greater than the second preset cost threshold, and the second maximum row-level inter-frame cost is greater than the maximum row-level inter-frame cost of the previous forward prediction frame, counting the number of second units of the coding units that meet the preset motion amplitude condition in the video frame to be evaluated; When the number of the second units is less than a preset number threshold, the to-be-evaluated video frame is determined to be a still frame.

11. The video encoding method according to claim 2, characterized in that: The predictive coding information includes intra-frame cost information, and the determining whether the to-be-evaluated video frame is a still frame includes: In the case where the video frame to be evaluated is a key frame, determining a maximum row-level intra-frame cost according to intra-frame cost information of coding units in the video frame to be evaluated; When the previous forward prediction frame of the video frame to be evaluated is a still frame, and the difference between the maximum row-level intra-frame cost and the maximum row-level intra-frame cost of the previous forward prediction frame is less than or equal to a preset ratio relative to the maximum row-level intra-frame cost of the previous forward prediction frame, the video frame to be evaluated is determined to be a still frame.

12. A video encoding device, characterized in that: include: An acquisition module, configured to acquire a video frame sequence to be encoded and a corresponding video frame rate, wherein the video frame sequence includes video frames; A calculation module is configured to, in the process of encoding the video frame, determine whether a video frame to be evaluated within a preset time length after the currently encoded video frame is a still frame when it is detected that the currently encoded video frame does not contain a face area and the video frame rate is greater than a set frame rate threshold, and calculate the proportion of the skin area in the video frame to be evaluated; The encoding module is configured to encode the video frames detected as still frames after the video frame to be evaluated based on the gradually increasing minimum quantization parameter value when the video frame to be evaluated is a still frame and the proportion of the skin area is within a preset threshold range.

13. A video encoding device, the device comprising: one or more processors; A storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the video encoding method described in any one of claims 1-11.

14. A non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to perform the video encoding method according to any one of claims 1 to 11 when executed by a computer processor.

15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the video encoding method according to any one of claims 1 to 11 is implemented.