Video processing method and device, computer device, storage medium and program product
By acquiring video attribute features and matching encoding offset parameters, the encoding quantization processing of video frames is optimized, solving the problem of balancing bitrate and quality in video encoding and improving the experience quality for video consumers.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECHNOLOGY (SHENZHEN) CO LTD
- Filing Date
- 2022-02-11
- Publication Date
- 2026-05-19
AI Technical Summary
Existing video encoding technologies struggle to effectively balance video bitrate, video presentation quality, and QoE during the encoding process, resulting in a poor user experience for video consumers.
By acquiring the video attribute features of the target video, determining the matching encoding offset parameters, estimating and adjusting the quantization parameters, and optimizing the encoding and quantization parameters of the video frames to adapt to different video attributes and network environments.
While meeting the target bandwidth, improve video encoding quality to achieve the best balance between video presentation quality and QoE index on the video consumer side, thereby enhancing the video viewing experience.
Smart Images

Figure CN116634151B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and more particularly to the field of video coding technology, specifically to a video processing method, apparatus, computer equipment, storage medium, and program product. Background Technology
[0002] Currently, video coding technology is widely used in video services such as video conferencing, video-on-demand, and live video streaming. Encoding video using this technology can save storage space and improve transmission efficiency. Bitrate control is a crucial aspect of video coding, achieved by adjusting the quantizer parameter (QP) during the encoding process. Using a suitable QP ensures that the encoded video bitrate meets the target bandwidth while achieving an optimal balance between video presentation quality and QoE (Quality of Experience) for the consumer, thus improving the overall video coding effect. Therefore, determining the optimal quantizer parameter (QP) for video coding has become a current research hotspot. Summary of the Invention
[0003] This application provides a video processing method, apparatus, computer equipment, storage medium, and program product that can specifically determine encoding quantization parameters for video encoding.
[0004] On one hand, embodiments of this application provide a video processing method, which includes:
[0005] The process involves: acquiring the target video frame to be encoded from the target video; obtaining the video attribute features of the target video and determining the encoding offset parameters that match the video attribute features; estimating the quantization parameters of the target video frame based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame; adjusting the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame; and encoding the target video frame based on the encoded quantization parameters of the target video frame.
[0006] Accordingly, embodiments of this application provide a video processing apparatus, which includes:
[0007] The acquisition unit is used to acquire the target video frame to be encoded from the target video; and to acquire the video attribute features of the target video.
[0008] The processing unit is used to determine the coding offset parameters that match the video attribute features; estimate the quantization parameters of the target video frame based on the coding offset parameters to obtain the initial quantization parameters of the target video frame; adjust the initial quantization parameters of the target video frame to obtain the coding quantization parameters of the target video frame; and perform coding processing on the target video frame based on the coding quantization parameters of the target video frame.
[0009] In one implementation, the video attribute features include one or more of the following: resolution information of the target video, video type information of the target video, bitrate information of the target video, and playback effect reference information of the target video; wherein, the encoding offset parameters matched with different video attribute features are different.
[0010] In one implementation, the processing unit, when determining the encoding offset parameter that matches the video attribute features, specifically performs the following steps:
[0011] In the parameter matching relationship, the attribute feature indication information that matches the video attribute feature is determined. The parameter matching relationship includes multiple attribute feature indication information and a reference offset parameter corresponding to each attribute feature indication information. The reference offset parameter corresponding to the matching attribute feature indication information is determined as the encoding offset parameter that matches the video attribute feature.
[0012] In one implementation, the target video frame is a keyframe type; the processing unit, used to estimate the quantization parameters of the target video frame based on the coding offset parameters, specifically performs the following steps to obtain the initial quantization parameters of the target video frame:
[0013] Based on the coding offset parameters, the coding quantization parameters of the specified type of encoded video frames among the N encoded video frames of the target video are mapped to obtain the offset quantization parameters of the specified type of encoded video frames, where N is a positive integer. Based on the offset quantization parameters of the specified type of encoded video frames and the coding quantization parameters of other types of encoded video frames among the N encoded video frames, the statistical parameters of the N encoded video frames are determined. Other types of encoded video frames refer to: other encoded video frames among the N encoded video frames besides the specified type of encoded video frames. Based on the statistical parameters of the N encoded video frames and the number of N encoded video frames, the initial quantization parameters of the target video frame are determined.
[0014] In one implementation, the encoding offset parameter includes a first encoding offset parameter and a second encoding offset parameter; the processing unit, used to perform parameter mapping processing on the encoding quantization parameters of a specified type of encoded video frames among N encoded video frames of the target video according to the encoding offset parameter, specifically performs the following steps when obtaining the offset quantization parameter of the specified type of encoded video frames:
[0015] If the specified type is a keyframe type, then the encoding quantization parameters of the encoded video frames of the keyframe type are mapped according to the first encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the keyframe type; if the specified type is a bidirectional difference frame type, then the encoding quantization parameters of the encoded video frames of the bidirectional difference frame type are mapped according to the second encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the bidirectional difference frame type.
[0016] In one implementation, the target video frame is a bidirectional difference frame type; the processing unit, used to estimate the quantization parameters of the target video frame based on the coding offset parameters, specifically performs the following steps to obtain the initial quantization parameters of the target video frame:
[0017] In the target video, a reference video frame is determined. If there is only one reference video frame, its reference quantization parameter is used as the initial quantization parameter of the target video frame. If there are M reference video frames, the complexity parameter of each of the M reference video frames is obtained, and the reference quantization parameters of the M reference video frames are weighted and summed according to their complexity parameters to obtain the initial quantization parameter of the target video frame, where M is an integer greater than 1. The reference quantization parameter of a specified type of reference video frame is obtained by mapping the encoded quantization parameter of the specified type of reference video frame to the encoded quantization parameter based on the encoded offset parameter. The reference quantization parameter of other types of reference video frames is the encoded quantization parameter of those other types. Other types of reference video frames refer to all reference video frames other than those of the specified type.
[0018] In one implementation, the processing unit is further configured to perform the following steps:
[0019] Type detection is performed on the target video frame; if the target video frame is a keyframe type or a bidirectional difference frame type, the step of obtaining the video attribute features of the target video and determining the encoding offset parameters that match the video attribute features is triggered; if the target video frame is a forward difference frame type, the fuzzy complexity parameter of the target video frame is obtained, and the quantization parameter of the target video frame is estimated based on the fuzzy complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame.
[0020] In one implementation, when the processing unit obtains the fuzziness complexity parameter of the target video frame, it specifically performs the following steps:
[0021] Obtain the prediction residual parameters of the target video frame; determine the fuzzy complexity parameters of the target video frame based on the cumulative complexity parameters of the N encoded video frames, the cumulative frame count of the N encoded video frames, and the prediction residual parameters of the target video frame, where N is a positive integer; where the cumulative complexity parameter is obtained by weighted accumulation of the complexity parameters of the N encoded video frames; and the cumulative frame count is obtained by weighted accumulation of the frame counts of the N encoded video frames.
[0022] In one implementation, the processing unit, when estimating the quantization parameters of the target video frame based on the fuzziness complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame, specifically performs the following steps:
[0023] The compression factor of the target video frame is obtained, and the quantization level parameter of the target video frame is determined based on the fuzziness complexity parameter of the target video frame and the compression factor. The cumulative allocation information and cumulative complexity parameter of the target video frame are obtained. The cumulative allocation information is obtained by accumulating the allocation information of the target video frame and the allocation information of N encoded video frames. The cumulative complexity parameter of the target video frame is determined based on the cumulative complexity parameters of the N encoded video frames and the prediction residual parameter of the target video frame. An optimization factor for the quantization level parameter is determined based on the cumulative allocation information and cumulative complexity parameter of the target video frame. The quantization level parameter is optimized based on the optimization factor to obtain the initial quantization parameters of the target video frame.
[0024] In one implementation, the processing unit, when adjusting the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame, specifically performs the following steps:
[0025] Based on the cumulative encoded information and cumulative allocated information of N encoded video frames in the target video, an adjustment factor for the initial quantization parameters of the target video frame is determined. The cumulative encoded information of the N encoded video frames is obtained by accumulating the encoded information of the N encoded video frames, and the cumulative allocated information of the N encoded video frames is obtained by accumulating the allocated information of the N encoded video frames, where N is a positive integer. The initial quantization parameters of the target video frame are adjusted according to the adjustment factor to obtain the encoded quantization parameters of the target video frame.
[0026] Accordingly, embodiments of this application provide a computer device, which includes a processor and a computer-readable storage medium; wherein the processor is adapted to implement a computer program, the computer-readable storage medium stores the computer program, and the computer program stored in the computer-readable storage medium is adapted to be loaded by the processor and executed by the above-described video processing method.
[0027] Accordingly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when read and executed by a processor of a computer device, causes the computer device to perform the aforementioned video processing method.
[0028] Accordingly, embodiments of this application provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the aforementioned video processing method.
[0029] In this embodiment, video attribute features of the target video can be obtained, and encoding offset parameters matching the video attribute features can be determined. Then, quantization parameters of the target video frame to be encoded in the target video can be estimated based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame. The initial quantization parameters of the target video frame can then be adjusted to obtain the encoding quantization parameters of the target video frame. Thus, the target video frame can be encoded based on the encoding quantization parameters. It can be seen that the encoding quantization parameters of the target video frame determined in this embodiment are compatible with the video attribute features of the target video. In other words, encoding quantization parameters for encoding the target video frame can be specifically determined based on the video attribute features of the target video. This allows for the optimal balance between the video presentation quality and the QoE (Quality of Experience) index at the video consumer end, while ensuring that the bitrate of the encoded video meets the target bandwidth, thereby improving the video encoding effect. Attached Figure Description
[0030] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 This is a schematic diagram illustrating the principle of bitrate control provided in an embodiment of this application;
[0032] Figure 2 This is a schematic diagram illustrating the effect of bitrate control provided in an embodiment of this application;
[0033] Figure 3 This is a schematic diagram of the architecture of a video processing system provided in an embodiment of this application;
[0034] Figure 4 This is a flowchart illustrating a video processing method provided in an embodiment of this application;
[0035] Figure 5 This is a flowchart illustrating another video processing method provided in an embodiment of this application;
[0036] Figure 6 This is a flowchart illustrating another video processing method provided in an embodiment of this application;
[0037] Figure 7a This is a statistical diagram illustrating the video bitrate distribution provided in an embodiment of this application;
[0038] Figure 7b This is a statistical diagram illustrating another video bitrate distribution provided in an embodiment of this application;
[0039] Figure 8a This is a schematic diagram illustrating the effect of a video processing method provided in an embodiment of this application;
[0040] Figure 8b This is a schematic diagram illustrating the effect of another video processing method provided in the embodiments of this application;
[0041] Figure 9 This is a schematic diagram of the structure of a video processing device provided in an embodiment of this application;
[0042] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0043] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0044] To clearly understand the technical solutions provided in the embodiments of this application, the key terms involved in the embodiments of this application are introduced here:
[0045] (1) This application relates to video. A video is a sequence of consecutive video frames. Due to the persistence of vision, when the sequence of video frames is played at a certain rate, we see a video with continuous motion. Each video frame in a video is organized in a group of pictures (GOP). A video can include multiple GOPs. Each GOP begins with an I-frame (I-frame, keyframe) and ends with the next I-frame. The first video frame in a GOP is called an Instantaneous Decoding Refresh (IDR) frame. An IDR frame is always an I-frame, but an I-frame is not necessarily an IDR frame. An IDR frame will cause the Decoded Picture Buffer (DPB, reference frame list) to be cleared, while an I-frame will not. A GOP can include multiple I-frames. Video frames encoded after the I-frames can use video frames encoded between the I-frames as motion references. A GOP can also include P-frames (PFrames, forward difference frames) and B-frames (BFrames, bidirectional difference frames). A P-frame represents the difference between the current frame and a previous I-frame (or P-frame). During decoding, the previously buffered image is overlaid with the difference defined in the current frame to generate the final image. A B-frame records the difference between the current frame and the frames before and after it. A B-frame can be used as a reference frame for other B-frames, or it can not be used as a reference frame for other B-frames.
[0046] (2) This application relates to video coding technology. Video coding technology refers to the technology of compressing video so that the file size (i.e., data volume) of the encoded video file is smaller than that of the original video file. Because the similarity between consecutive video frames in a video is extremely high, there is a large amount of redundant information within each video frame and between consecutive video frames. Therefore, before storing or transmitting the video, it is often necessary to use video coding technology to compress and encode the video to remove redundant information in the spatial, temporal, and other dimensions, so as to save storage space and improve video transmission efficiency.
[0047] Quantization is involved in video coding technology. Quantization refers to the process of approximating continuous values (or a large number of possible discrete values) in a video frame to a finite number (or a small number) of discrete values based on the QP (Quantization Point) of the video frame. QP reflects the compression of spatial details. The smaller the QP value, the finer the quantization, and most of the details in the image are preserved, resulting in higher image quality and a higher bitrate. Conversely, the larger the QP value, the more details in the image are lost, the lower the bitrate, but the more image distortion is increased, and the lower the quality. Bitrate, also known as bitstream or bit rate, refers to the amount of data used in a video per unit of time. In simpler terms, it's the sampling rate, and it's the most important part of image quality control in video encoding. The commonly used unit for bitrate is Kb / s (kilobytes per second) or Mb / s (megabytes per second). Generally speaking, at the same resolution, the higher the bitrate of a video file, the lower the compression ratio and the higher the image quality. A higher bitrate means a higher sampling rate per unit of time, a larger data stream, higher precision, and a video that is closer to the original video, resulting in better image quality and clearer picture. However, this also requires higher decoding capabilities from the playback device.
[0048] (3) The embodiments of this application involve bitrate control. The essence of bitrate control is the problem of optimal allocation of limited resources. The basic principles of bitrate control can be found in [reference needed]. Figure 1 Bitrate control refers to the allocation of bits between video frames to be encoded, taking into account factors such as video complexity, the actual number of bits generated during encoding, and buffer status (e.g., the number of bits currently remaining in the buffer). This involves adjusting the image layer QP and coding unit QP of the video frames to achieve an optimal balance between video quality and QoE (Quality of Experience) at the consumer end, while ensuring the encoded video bitrate meets the target bandwidth. For an explanation of the effects of bitrate control, please refer to [link to relevant documentation / reference]. Figure 2 The black dashed line represents the target bandwidth. Before bitrate control, the video bitrate represented by the gray solid line exceeds the target bandwidth, making the encoder unusable in practical environments. After bitrate control, the video bitrate represented by the black solid line does not exceed the target bandwidth. Here, the image layer QP refers to the QP used for quantizing video frames, and the coding unit QP refers to the QP used for quantizing the coding units of video frames. A coding unit is the basic coding unit used to encode a video frame; a coding unit can be, for example, a macroblock. Video frames need to be divided into multiple macroblocks for encoding.
[0049] Common bitrate control modes include: CRF (Constant Rate Factor) mode, which has the advantage of maintaining stable video quality while minimizing bandwidth consumption, but its disadvantage is that the exact size of the encoded file is unknown. ABR (Average Bitrate) mode prioritizes reducing the overall bitrate control error of the video, aiming to improve video compression performance while maximizing bitrate control accuracy. CBR (Constant Bitrate) mode, in contrast to VBR (Variable Bitrate) mode, has strict requirements on the peak bitrate per second during encoding and is often used in live video streaming scenarios. CQP (Constant Quantization Parameter) mode is less commonly used in business applications and is more often used in academic research. Because other modes (such as CRF, ABR, and CBR mentioned above) all adjust the QP, causing performance fluctuations, CQP mode is often used in academic research to characterize the performance tuning of a specific algorithm. VBV (Video Buffering Verifier) mode provides buffer resource allocation for CRF, ABR, and CBR modes, allowing for more rational bit allocation by the encoder compared to traditional bitrate control modes. Multi-pass encoding mode, commonly 2-pass mode, encodes a video twice, using the result of the first pass to guide the QP adjustment in the second pass, resulting in superior compression performance.
[0050] (4) The embodiments of this application involve the QoE metric. The QoE metric is one of the most important metrics for the operation and growth of business-related products. Taking video services as an example, the evaluation subject of the QoE metric is the video consumer, and the evaluation object is the video service and the network supporting the video service. The QoE metric uses specific metric values to characterize the satisfaction of video consumers with the video service or video service products (such as video software, video applications, video clients, etc.). In video services, the QoE metric may include, but is not limited to, at least one of the following: first frame duration, average viewing time of the target video, video picture quality, picture latency, and stuttering metrics (such as buffering time for stuttering sensations), etc. Among them, first frame duration refers to the time required from the start of video playback to the viewer seeing the first frame of the video; average view duration refers to the average viewing time of multiple video consumers; video quality refers to whether the video consumer can enjoy high-quality (e.g., high definition) or low-quality (e.g., low definition) video, or whether the video quality suddenly drops during viewing; buffering time refers to the time required from when the video stutters during playback to when the stuttering disappears; and screen latency refers to the time delay between an action and its appearance on the screen. For example, in live sports broadcasts, even a delay of a few seconds can cause viewers to hear cheers from neighboring apartments or see spoilers on social media before they see a goal.
[0051] In addition to QoE metrics, video service evaluation metrics can also include QoS (Quality of Service) metrics. These metrics are mainly responsible for managing services and providing service differentiation from the network perspective. Network entities handle different services according to different quality requirements. Common QoS metrics may include, but are not limited to, at least one of the following: stuttering rate, stuttering time, first frame duration, etc.
[0052] In video services, users typically use various video consumption devices (such as mobile phones, smart TVs, set-top boxes, and game consoles) to install video service products (such as video software, video clients, and video applications) to watch videos. These devices often operate in different network environments, support varying video playback conditions, and have different requirements for video presentation quality. Therefore, appropriate encoding configurations (such as QP) are needed to adapt to network environments, playback conditions, and video types, providing targeted, higher-quality, and more efficient video services. Based on this, this application proposes a video processing method that optimizes existing bitrate control schemes. This method ensures that the QP determined in the bitrate control scheme is adapted to one or more of the network environment, playback conditions, and video types in the video service. By specifically determining the QP for video encoding, it achieves an optimal balance between video presentation quality and QoE (Quality of Image) at the consumer end, while ensuring the encoded video bitrate meets the target bandwidth, thus improving the video viewing experience for users.
[0053] The following is combined Figure 3 A video processing system suitable for implementing the video processing method provided in the embodiments of this application is described. The video processing system may include a video production device (encoding end) 301 and a video consumption device (decoding end) 302. The video production device 301 and the video consumption device 302 can be directly connected via wired communication or indirectly connected via wireless communication. For any video frame to be encoded in the target video, the video production device 301 can determine a suitable QP to encode the video frame and send the encoded target video to the video consumption device 302. The video consumption device 302 can decode the encoded target video, decode multiple video frames contained in the target video, and present the decoded video frames, so that the video consumer can watch the target video through the video consumption device 302.
[0054] Among them, the video production equipment 301 can be a terminal or a server, and the video consumption device 301 can be a terminal; the terminal mentioned in the embodiments of this application can be a smartphone, tablet computer, laptop computer, desktop computer, smart speaker, smartwatch, vehicle terminal, smart TV, etc., but is not limited to these; the server mentioned in the embodiments of this application can be a server cluster or distributed system composed of multiple physical servers, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data.
[0055] The video processing method provided in this application can be applied to video service scenarios such as video conferencing, video-on-demand, and live video streaming. For example, in a video conferencing session involving session object A and session object B, the terminal used by session object A can act as a video production device, encoding the captured video containing session object A and transmitting the encoded video to the terminal used by session object B. The terminal used by session object A can also act as a video consumption device, decoding and playing the video containing session object B. The terminal used by session object B is similar to that used by session object A, functioning as both a video production device and a video consumption device. In video conferencing scenarios, determining appropriate QPs for each video frame in the video conferencing session based on the characteristics of the video conferencing service can improve the video conferencing effect and enhance the video conferencing experience for the participants. For example, in a video-on-demand (VOD) scenario, a video processing server can act as a video production device, encoding the video-on-demand (VOD) video requested by the VOD client and transmitting the encoded video to the VOD client. The terminal running the VOD client can act as a video consumption device, decoding the encoded video and playing it within the VOD client. In a VOD scenario, determining appropriate QPs (Quality Per Frame) for each video frame based on the characteristics of the VOD service can improve the VOD effect and enhance the viewing experience for the VOD audience. Similarly, in a live video streaming scenario, the terminal used by the broadcaster can act as a video production device, encoding the live video and transmitting it to the terminal used by the audience. The terminal used by the audience can act as a video consumption device, decoding the encoded live video and playing it. In a live video streaming scenario, determining appropriate QPs for each video frame based on the characteristics of the live video service can improve the live streaming effect and enhance the live streaming viewing experience for the audience.
[0056] It is understood that the video processing system described in the embodiments of this application is for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and does not constitute a limitation on the technical solutions provided in the embodiments of this application. As those skilled in the art will know, with the evolution of system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0057] Furthermore, the video processing method provided in this application embodiment can also be combined with cloud technology. Cloud technology refers to a hosting technology that unifies a series of resources such as hardware, software, and networks within a wide area network or local area network to realize data computation, storage, processing, and sharing. Cloud computing technology within cloud technology can provide computational support for the video processing process, and cloud storage technology within cloud technology can provide storage services for the video processing process. The video processing method provided in this application embodiment embodiment can also be deployed as a video processing cloud service. When video encoding processing is required, the video processing cloud service can be directly invoked to encode the video.
[0058] Based on the above description of the video processing system, the video processing method proposed in the embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0059] This application provides a video processing method, which mainly describes the process of determining video attribute features, determining encoding offset parameters that match the video attribute features, determining the initial quantization parameters when the target video frame is an I-frame, and determining the initial quantization parameters when the target video frame is a B-frame. This video processing method can be executed by the video production device 301 in the aforementioned video processing system. Please refer to [link to relevant documentation]. Figure 4 The video processing method may include the following steps S401-S406:
[0060] S401, Obtain the target video frame to be encoded from the target video.
[0061] The target video may include multiple video frames. Each video frame in the target video is encoded sequentially according to its own encoding order. The target video frame to be encoded can be obtained from the target video.
[0062] S402, Obtain the video attribute features of the target video.
[0063] The video attribute features of the target video may include any one or more of the following: resolution information of the target video, video type information of the target video, bitrate information of the target video, and playback effect reference information of the target video. The video attribute features of the target video may be obtained when the target video frame to be encoded is obtained from the target video.
[0064] Specifically: ① The target video's resolution information refers to the resolution of the target video when played on the video consumption device. This resolution information can be the default setting of the video consumption device, such as the default resolution of 480P in the video service products (such as video software, video applications, video clients, etc.) running on the video consumption device; or, this resolution information can be the resolution set by the video consumption object on the video consumption device, such as the resolution set to 1080P in the video service products running on the video consumption device. ② The target video's video type information refers to the identifier of the video type to which the target video belongs, such as whether the target video belongs to the TV series type, or the target video belongs to the movie type, or the target video belongs to the animation type, etc. ③ The target video's bitrate information refers to the amount of data traffic used by the encoded target video per unit time (e.g., 1 second). This bitrate information can be set to a constant bitrate (e.g., CBR mode in the bitrate control modes mentioned above) or an average bitrate (e.g., ABR mode in the bitrate control modes mentioned above). The target video's bitrate information can be set based on the network transmission bandwidth between the video production device and the video consumption device (i.e., the target bandwidth mentioned above), and the target video's bitrate information cannot exceed the network transmission bandwidth. ④ The target video's playback effect reference information refers to the description information of the target video's playback effect on the video consumption device. The playback effect reference information can include any of the following: quality-priority effect, bitrate-priority effect, and a quality-bitrate compromise effect. This playback effect reference information can be the default setting of the video consumption device, for example, the default playback effect reference information set in the video service product running on the video consumption device is bitrate-priority effect; or, this resolution information can be set by the video consumption object on the video consumption device, for example, the playback effect reference information set by the video consumption object in the video service product running on the video consumption device is quality-priority effect.
[0065] S403, determine the encoding offset parameters that match the video attribute features.
[0066] After obtaining the video attribute features of the target video, the encoding offset parameters that match these features can be determined. The process of determining the encoding offset parameters that match the video attribute features refers to determining the parameter values of these parameters. The encoding offset parameters can include a first encoding offset parameter (ipratio) and a second encoding offset parameter (pbratio). The first encoding offset parameter (ipratio) refers to the average increase in the quantizer value of I-frames compared to the quantizer value of P-frames; a higher value of the first encoding offset parameter (ipratio) indicates higher I-frame quality. The second encoding offset parameter (pbratio) refers to the average decrease in the quantizer value of B-frames compared to the quantizer value of P-frames; a higher value of the second encoding offset parameter (pbratio) indicates lower B-frame quality.
[0067] The process of determining the encoding offset parameter that matches the video attribute features may include: determining attribute feature indication information that matches the video attribute features in the parameter matching relationship, where the parameter matching relationship may include multiple attribute feature indications and a reference offset parameter corresponding to each attribute feature indication; and determining the reference offset parameter corresponding to the matching attribute feature indication as the encoding offset parameter that matches the video attribute features. The process of determining the encoding offset parameter that matches the video attribute features is described below for four cases: the target video's video attribute features include the target video's resolution information; the target video's video attribute features include the target video's type information; the target video's video attribute features include the target video's bitrate information; and the target video's video attribute features include the target video's playback effect reference information.
[0068] (1) The video attribute features of the target video may include the resolution information of the target video. Different resolution information is matched with different encoding offset parameters. In this case, the attribute feature indication information in the reference matching relationship refers to the resolution range, and the attribute feature indication information that matches the video attribute features refers to the resolution range to which the resolution information of the target video belongs. That is, when the video attribute features of the target video include the resolution information of the target video, the resolution range to which the resolution information of the target video belongs can be determined in the parameter matching relationship. Then, the reference offset parameter corresponding to the resolution range to which the resolution information of the target video belongs can be determined as the encoding offset parameter that matches the video attribute features of the target video. When the video attribute features of the target video include the resolution information of the target video, an exemplary reference matching relationship can be seen in Table 1 below:
[0069] Table 1
[0070]
[0071]
[0072] As shown in Table 1 above, when the resolution information of the target video belongs to the resolution range [0P, 480P], image quality should be prioritized, and the parameter value of the first encoding parameter should be set to 1.8 (i.e., ipratio(1.8)) and the parameter value of the second encoding parameter should be set to 1.5 (i.e., pbratio(1.5)). When the resolution information of the target video belongs to the resolution range (480P, 1080P), a trade-off between image quality and bitrate can be considered, and the parameter value of the first encoding parameter should be set to 1.5 and the parameter value of the second encoding parameter should be set to 1.3. When the resolution information of the target video belongs to the resolution range (1080P, +∞), the bitrate distribution can be prioritized. The image quality under high bitrate and high resolution is sufficient under the current network transmission bandwidth and video consumption device configuration stage, and the parameter value of the first encoding parameter can be set to 1.2 and the parameter value of the second encoding parameter can be set to 1.1.
[0073] (2) The video attribute features of the target video may include the video type information to which the target video belongs. Different video type information is matched with different encoding offset parameters. In this case, the attribute feature indication information in the reference matching relationship refers to the reference video type identifier, and the attribute feature indication information that matches the video attribute features refers to the reference video type identifier that matches the video type information to which the target video belongs. That is, when the video attribute features of the target video include the type information to which the target video belongs, the reference video type identifier that matches the video type information to which the target video belongs can be determined in the parameter matching relationship. Then, the reference offset parameter corresponding to the matching reference video type identifier can be determined as the encoding offset parameter that matches the video attribute features of the target video. When the video attribute features of the target video include the type information to which the target video belongs, an exemplary reference matching relationship can be seen in Table 2 below:
[0074] Table 2
[0075]
[0076]
[0077] As shown in Table 2 above, when the target video's video type information matches any of the categories of "live show" or "anime," image quality should be prioritized, with the first encoding parameter set to 1.8 and the second encoding parameter set to 1.5. When the target video's video type information matches any of the categories of "games," "food," "sports," or "travel," a compromise between image quality and bitrate can be considered, with the first encoding parameter set to 1.5 and the second encoding parameter set to 1.3. When the target video's video type information matches any of the categories of "TV series" or "movie," bitrate distribution should be prioritized. Image quality at high bitrate and high resolution is sufficient for the current network transmission bandwidth and video consumption device configuration, so the first encoding parameter can be set to 1.2 and the second encoding parameter set to 1.1.
[0078] (3) The video attribute features of the target video may include the bitrate information of the target video. Different bitrate information is matched with different encoding offset parameters. In this case, the attribute feature indication information in the reference matching relationship refers to the bitrate interval, and the attribute feature indication information that matches the video attribute features refers to the bitrate interval to which the bitrate information of the target video belongs. That is, when the video attribute features of the target video include the bitrate information of the target video, the bitrate interval to which the bitrate information of the target video belongs can be determined in the parameter matching relationship. Then, the reference offset parameter corresponding to the bitrate interval to which the bitrate information of the target video belongs can be determined as the encoding offset parameter that matches the video attribute features of the target video. When the video attribute features of the target video include the bitrate information of the target video, an exemplary reference matching relationship can be seen in Table 3 below:
[0079] Table 3
[0080]
[0081] As shown in Table 3 above, when the target video's bitrate falls within the bitrate range [0Mb / s, 2Mb / s), image quality should be prioritized, and the first encoding parameter should be set to 1.8, and the second encoding parameter to 1.5. When the target video's bitrate falls within the bitrate range [2Mb / s, 10Mb / s), a trade-off between image quality and bitrate can be considered, and the first encoding parameter should be set to 1.5, and the second encoding parameter to 1.3. When the target video's bitrate falls within the bitrate range [10Mb / s, +∞), bitrate distribution should be prioritized, as the image quality at high bitrate and high resolution is sufficient given the current network transmission bandwidth and video consumption device configuration. In this case, the first encoding parameter should be set to 1.2, and the second encoding parameter to 1.1.
[0082] (4) The video attribute features of the target video may include playback effect reference information of the target video. Different playback effect reference information is matched with different encoding offset parameters. In this case, the attribute feature indication information in the reference matching relationship refers to the reference playback effect identifier, and the attribute feature indication information that matches the video attribute features refers to the reference playback effect identifier that matches the playback effect reference information of the target video. That is, when the video attribute features of the target video include the playback effect reference information of the target video, the reference playback effect identifier that matches the playback effect reference information of the target video can be determined in the parameter matching relationship, and then the reference offset parameter corresponding to the matching reference playback effect identifier can be determined as the encoding offset parameter that matches the video attribute features of the target video. When the video attribute features of the target video include the playback effect reference information of the target video, an exemplary reference matching relationship can be seen in Table 4 below:
[0083] Table 4
[0084]
[0085] As shown in Table 2 above, when the playback effect reference information of the target video matches the picture quality priority effect, the parameter value of the first encoding parameter can be set to 1.8 and the parameter value of the second encoding parameter can be set to 1.5; when the playback effect reference information of the target video matches the picture quality bitrate compromise effect, the parameter value of the first encoding parameter can be set to 1.5 and the parameter value of the second encoding parameter can be set to 1.3; when the playback effect reference information of the target video matches the bitrate priority effect, the parameter value of the first encoding parameter can be set to 1.2 and the parameter value of the second encoding parameter can be set to 1.1.
[0086] It should be noted that (1)-(4) above respectively introduce the determination process of the encoding offset parameter in four cases: the target video's video attribute features include the target video's resolution information, the target video's video attribute features include the target video's video type information, the target video's video attribute features include the target video's bitrate information, and the target video's video attribute features include the target video's playback effect reference information. However, in actual video encoding scenarios, the target video's resolution information, the target video's video type information, the target video's bitrate information, and the target video's playback effect reference information can be flexibly combined. For example, the target video's video attribute features can include the target video's resolution information and the target video's bitrate information. When the target video's resolution information belongs to the resolution range [0P, 480P] and the target video's bitrate information belongs to the bitrate range [0Mb / s, 2Mb / s], the image quality can be prioritized, and the parameter value of the first encoding parameter can be set to 1.8, and the parameter value of the second encoding parameter can be set to 1.5.
[0087] S404. Estimate the quantization parameters of the target video frame based on the coding offset parameters to obtain the initial quantization parameters of the target video frame.
[0088] The processes for estimating the initial quantization parameters of the target video frame based on the coding offset parameter differ depending on whether the target video frame is a keyframe (I-frame) or a bidirectional difference frame (B-frame). The following describes the processes for estimating the initial quantization parameters of the target video frame based on the coding offset parameter when the target video frame is a keyframe and when it is a bidirectional difference frame:
[0089] (1) When the target video frame is a keyframe, the process of estimating the quantization parameters of the target video frame based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame may include: performing parameter mapping processing on the encoding quantization parameters of the specified type of encoded video frames among the N encoded video frames of the target video based on the encoding offset parameters to obtain the offset quantization parameters of the specified type of encoded video frames, where N is a positive integer; determining the statistical parameters of the N encoded video frames based on the offset quantization parameters of the specified type of encoded video frames and the encoding quantization parameters of other types of encoded video frames among the N encoded video frames; and determining the initial quantization parameters of the target video frame based on the statistical parameters of the N encoded video frames and the number of N encoded video frames. The N encoded video frames are the N encoded video frames in the target video whose encoding order is before the target video frame. Other types of encoded video frames refer to the other encoded video frames among the N encoded video frames besides the specified type of encoded video frames.
[0090] Here, the process of determining the initial quantization parameters of the target video frame of the aforementioned keyframe type is further explained: ① The essence of parameter mapping is to uniformly map the quantization parameters of the encoded video frames of the specified type to the result of the target type (i.e., the other types mentioned above) based on the quantization offset parameters. This application embodiment uses keyframe type or bidirectional difference frame type as an example, and forward difference frame (i.e., P-frame) type as the other type. That is, this application embodiment uses the encoded video frames of the forward difference frame type as the basic unit, uniformly mapping the quantization parameters of the encoded video frames of the keyframe type and the quantization parameters of the encoded video frames of the bidirectional difference frame type to the forward difference frame type, obtaining the offset quantization parameters of the encoded video frames of the keyframe type and the offset quantization parameters of the encoded video frames of the bidirectional difference frame type. ② The essence of statistical parameters is the sum of the offset quantization parameters of the encoded video frames of the specified type and the quantization parameters of the encoded video frames of other types. ③ The initial quantization parameter of the target video frame can be equal to the ratio between the statistical parameters of N encoded video frames and the number of N encoded video frames. In summary, ①-③ show that the initial quantization parameter of the target video frame of the keyframe type is the ratio between the sum of the quantization parameters of the N encoded video frames whose encoding order precedes the target video frame and the number of the N encoded video frames. Furthermore, in the process of calculating the sum, it is necessary to perform parameter mapping processing on the quantization parameters of the encoded video frames of a specified type among the N encoded video frames, uniformly mapping them to the target type before summing. Through parameter mapping processing, not only can the initial quantization parameter of the target video frame be adapted to the video attribute features of the target video, but it is also beneficial for normalization in bitrate control.
[0091] This section focuses on the parameter mapping process. Based on the encoding offset parameter, the process of mapping the encoding quantization parameters of a specified type of encoded video frame among N encoded video frames of the target video to obtain the offset quantization parameter of the specified type of encoded video frame can include: if the specified type is a keyframe type, then the encoding quantization parameters of the keyframe type encoded video frame can be mapped based on the first encoding offset parameter (i.e., ipratio) to obtain the offset quantization parameter of the keyframe type encoded video frame; see Formula 1 below:
[0092] QP = QP + ipoffset = QP + 6.0 × log2(ipratio) (Formula 1)
[0093] Here is an explanation of the parameters in Formula 1 above: QP on the left side of the first equal sign represents the offset quantization parameter of the encoded video frame of the keyframe type; QP on the right side of the first and second equal signs represents the code quantization parameter of the encoded video frame of the keyframe type; ipoffset represents the first offset, which is determined based on the first code offset parameter; ipratio represents the first code offset parameter; the code quantization parameter of the first encoded video frame of the keyframe type can be set to a constant (e.g., 24).
[0094] If the specified type is a bidirectional difference frame type, the coded quantization parameters of the encoded video frames of the bidirectional difference frame type can be mapped according to the second coded offset parameter (i.e., pbratio) to obtain the offset quantization parameters of the encoded video frames of the bidirectional difference frame type; see Formula 2 below:
[0095] QP = QP + pboffset = QP + 6.0 × log2(pbratio) (Formula 2)
[0096] Here is an explanation of the parameters in Formula 2 above: QP on the left side of the first equal sign represents the offset quantization parameter of the encoded video frame of the bidirectional difference frame type; QP on the right side of the first and second equal signs represents the coding quantization parameter of the encoded video frame of the bidirectional difference frame type; pboffset represents the second offset, which is determined based on the second coding offset parameter; pbratio represents the second coding offset parameter.
[0097] (2) When the target video frame is a bidirectional difference frame type, the process of estimating the quantization parameters of the target video frame based on the coding offset parameters to obtain the initial quantization parameters of the target video frame may include: determining the reference video frame of the target video frame in the target video, the number of reference video frames may be one or M, where M is an integer greater than 1; if the number of reference video frames is one, the reference quantization parameters of the reference video frame may be determined as the initial quantization parameters of the target video frame; if the number of reference video frames is M, the complexity parameters of each of the M reference video frames may be obtained, and the reference quantization parameters of the M reference video frames may be weighted and summed based on the complexity parameters of the M reference video frames to obtain the initial quantization parameters of the target video frame; when performing the weighted summation calculation, the weight of the reference quantization parameter of any reference video frame may be determined based on the complexity parameter of that reference video frame and the sum of the complexity parameters of the M reference video frames, and the weight of the reference quantization parameter of any reference video frame may be equal to the ratio between the complexity parameter of that reference video frame and the sum of the complexity parameters of the M reference video frames. It should be noted that the complexity parameter of the reference video frame can refer to the fuzzy complexity parameter of the reference video frame. The process for determining the fuzzy complexity parameter of the reference video frame is the same as the process for determining the fuzzy complexity parameter of the target video frame when the target video frame is a forward difference frame type. For details, please refer to [link to relevant documentation]. Figure 5 The embodiment shown describes the process of determining the fuzzy complexity parameter of the target video frame when the target video frame is of the forward difference frame type; alternatively, the complexity parameter of the reference video frame can be any one or both of the time complexity or space complexity of the reference video frame.
[0098] The reference quantization parameters of a specified type of reference video frame in the reference video frame are obtained by mapping the encoded quantization parameters of the specified type of reference video frame according to the encoded offset parameters. The parameter mapping process of the encoded quantization parameters of the specified type of reference video frame is the same as that of the encoded quantization parameters of the specified type of encoded video frame. For details, please refer to the relevant description of the parameter mapping process of the encoded quantization parameters of the specified type of encoded video frame in the previous content, which will not be repeated here. The reference quantization parameters of other types of reference video frames in the reference video frame are the encoded quantization parameters of other types of reference video frames. Other types of reference video frames refer to other reference video frames in the reference video frame besides the reference video frames of the specified type. In other words, the initial quantization parameter of the target video frame of the bidirectional difference frame type is either the reference quantization parameter of a reference video frame of the target video frame, or the result of a complexity-weighted sum of the reference quantization parameters of M reference video frames of the target video frame. Furthermore, when the type of the reference video frame is other, the reference quantization parameter of the reference video frame is equal to the encoded quantization parameter of the reference video frame, and no parameter mapping processing is required. When the type of the reference video frame is a specified type, the encoded quantization parameter of the reference video frame of the specified type needs to be uniformly mapped to the target type according to the encoded offset parameter to obtain the reference quantization parameter of the reference video frame of the specified type. Through parameter mapping processing, not only can the initial quantization parameter of the target video frame be adapted to the video attribute features of the target video, but it is also beneficial for normalization in bitrate control.
[0099] S405, adjust the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame.
[0100] After estimating the quantization parameters of the target video frame based on the coding offset parameters to obtain the initial quantization parameters of the target video frame, the initial quantization parameters of the target video frame can be adjusted to obtain the coding quantization parameters of the target video frame.
[0101] S406: Encode the target video frame according to the coding quantization parameters of the target video frame.
[0102] After adjusting the initial quantization parameters of the target video frame to obtain its encoded quantization parameters, the target video frame can be encoded based on these parameters. Encoding the target video frame using its encoded quantization parameters can involve two stages: the first stage is quantizing the target video frame according to these parameters to obtain the quantized target video frame; the second stage is encoding the quantized target video frame.
[0103] In this embodiment of the application, the video attribute features of the target video can be obtained when the target video frame to be encoded is obtained from the target video. This can make the encoding quantization parameters of the target video frame more compatible with the current video attribute features of the target video. Using encoding quantization parameters with higher compatibility to encode the target video frame is beneficial to improving the QoE index and video viewing experience on the video consumer side. When the video attribute features of the target video include the resolution information of the target video, the encoding quantization parameters of the target video frame can be adapted to the video playback conditions of the target video. When the video attribute features of the target video include the bitrate information of the target video, the encoding quantization parameters of the target video frame can be adapted to the network environment of the target video. When the video attribute features of the target video include the video type information of the target video, the encoding quantization parameters of the target video frame can be adapted to the video type of the target video. When the video attribute features of the target video include the playback effect reference information of the target video, the encoding quantization parameters of the target video frame can be adapted to the expected playback effect of the target video. In other words, the encoding quantization parameters of the target video frame determined in this application embodiment can be adapted from different perspectives of video services, all with the aim of improving the video encoding effect and achieving the best balance between the video presentation quality and QoE index of the target video at the video consumption end.
[0104] This application provides a video processing method, which mainly describes the process of determining the initial quantization parameters when the target video frame is a P-frame, and the process of adjusting the initial quantization parameters of the target video frame. This video processing method can be executed by the video production device 301 in the aforementioned video processing system. Please refer to [link to relevant documentation]. Figure 5 The video processing method may include the following steps S501-S509:
[0105] S501: Obtain the target video frame to be encoded from the target video.
[0106] The execution process of step S501 in this embodiment is the same as described above. Figure 4 The execution process of step S401 in the illustrated embodiment is the same, and can be found in the above description. Figure 4 The relevant description of step S401 in the illustrated embodiment will not be repeated here.
[0107] S502, perform type detection on the target video frame;
[0108] After obtaining the target video frame to be encoded from the target video, the type of the target video frame can be detected. The type of the target video frame can be any one of keyframe type, forward difference frame type, or bidirectional difference frame type. If the type of the target video frame is keyframe type or bidirectional difference frame type, steps S503-S505 can be triggered. After step S505 is executed, steps S508-S509 can be executed. If the type of the target video frame is forward difference frame type, steps S506-S507 can be triggered. After step S507 is executed, steps S508-S509 can be executed.
[0109] S503, obtain the video attribute features of the target video.
[0110] S504, determine the encoding offset parameters that match the video attribute features.
[0111] S505, perform quantization parameter estimation on the target video frame based on the coding offset parameter to obtain the initial quantization parameters of the target video frame.
[0112] The execution process of step S503 in this embodiment is the same as described above. Figure 4 The execution process of step S402 in the illustrated embodiment is the same as described above, and the execution process of step S504 is the same as described above. Figure 4 The execution process of step S403 in the illustrated embodiment is the same as that described above, and the execution process of step S505 is the same as that described above. Figure 4 The execution process of step S404 in the illustrated embodiment is the same, and can be found in the above description. Figure 4 The relevant descriptions in the illustrated embodiments will not be repeated here.
[0113] S506, obtain the fuzziness complexity parameter of the target video frame.
[0114] The process of obtaining the complexity parameters of the target video frame may include: obtaining the prediction residual parameter (SATD) of the target video frame; determining the fuzzy complexity parameter of the target video frame based on the cumulative complexity parameters of the N encoded video frames of the target video, the cumulative number of frames of the N encoded video frames, and the prediction residual parameter of the target video frame. The N encoded video frames are the N encoded video frames in the target video whose encoding order is before the target video frame, and N is a positive integer.
[0115] The process of determining the prediction residual parameters of the target video frame can include: downsampling the target video frame to obtain a downsampled video frame; then, predicting the downsampled video frame to obtain a predicted video frame; calculating the residual between the predicted video frame and the target video frame; then, transforming the residual between the predicted video frame and the target video frame and summing the absolute values to obtain the prediction residual parameters of the target video frame; the prediction processing can include inter-prediction processing (i.e., inter-frame prediction processing) and intra-prediction processing (i.e., intra-frame prediction processing). Intra-prediction processing refers to the prediction blocks within a video frame being formed based on the coded reconstructed blocks and the current block. Inter-prediction processing mainly includes motion estimation (e.g., motion search methods, motion estimation criteria, sub-pixel interpolation, and motion vector estimation, etc.) and motion compensation, which are references and prediction interpolation compensations at the GOP granularity temporal level; the transformation processing specifically refers to performing a Hadamard transform on the residual between the predicted video frame and the target video frame. The cumulative complexity parameter of N encoded video frames can be obtained by weighted summation of the complexity parameters of the N encoded video frames. Here, summation can be understood as follows: the complexity parameter of the second encoded video frame equals the complexity parameter of the first encoded video frame (e.g., any one or both of time complexity and space complexity) multiplied by 0.5 plus the prediction residual parameter of the second encoded video frame; the complexity parameter of the third encoded video frame equals the complexity parameter of the second encoded video frame multiplied by 0.5 plus the prediction residual parameter of the third encoded video frame, and so on, to obtain the cumulative complexity parameter of the N encoded video frames. The cumulative frame count of the N encoded video frames can be obtained by weighted summation of the frame counts of the N encoded video frames. The specific calculation process for the complexity parameter of the target video frame can be found in Formulas 3-5 below.
[0116] cplxsum[i]=cplxsum[i-1]×0.5+SATD[i] Formula 3
[0117] cplxcount[i] = cplxcount[i-1] × 0.5 + 1 (Formula 4)
[0118] blurred_complexity[i]=cplxsum[i] / cplxcount[i]Formula 5
[0119] Here is an explanation of the parameters in Formulas 3-5: i represents the target video frame; SATD[i] represents the prediction residual parameter of the target video frame; cplxsum[i-1] represents the cumulative complexity parameter of N encoded video frames, with an initial value of 0. cplxsum[i-1] is obtained by weighted accumulation of the complexity parameters of N encoded video frames, and the constant 0.5 is the weight used for weighting; cplxsum[i] represents the cumulative complexity parameter of the target video frame, which is determined based on cplxsum[i-1] and SATD[i]. The values are fixed; cplxcount[i-1] represents the cumulative frame count of N encoded video frames. The initial value of cplxcount is 0. It is obtained by weighted accumulation of the frame counts of N encoded video frames. The constant 0.5 is the weight used for weighting; cplxcount[i] represents the cumulative frame count of the target video frame, which is determined based on cplxcount[i-1]. blurred_complexity[i] represents the blur complexity parameter of the target video frame, which is determined based on cplxsum[i] and cplxcount[i].
[0120] S507, Estimate the quantization parameters of the target video frame based on the fuzziness complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame.
[0121] After obtaining the fuzzy complexity parameters of the target video frame, quantization parameters can be estimated based on these parameters to obtain the initial quantization parameters. Estimating the initial quantization parameters based on the fuzzy complexity parameters can include: ① Obtaining the compression factor of the target video frame, and determining the quantization level parameters based on the fuzzy complexity parameters and the compression factor. ② Obtain the cumulative allocation information and cumulative complexity parameter of the target video frame. The cumulative allocation information of the target video frame is obtained by accumulating the allocation information of the target video frame and the allocation information of N encoded video frames. Here, the accumulation can be understood as the cumulative allocation information of the target video frame being equal to the sum of the allocation information of the target video frame and the allocation information of the N encoded video frames. The allocation information of the target video frame refers to the number of bits pre-allocated to the target video frame, and the allocation information of the encoded video frame refers to the number of bits pre-allocated to the encoded video frame. The cumulative complexity parameter of the target video frame (i.e., the aforementioned cplxsum[i]) is determined based on the cumulative complexity parameters of the N encoded video frames (i.e., the aforementioned cplxsum[i-1]) and the prediction residual parameter of the target video frame (i.e., the aforementioned SATD[i]). ③ Determine the optimization factor of the quantization level parameter based on the cumulative allocation information and cumulative complexity parameter of the target video frame. ④ Optimize the quantization level parameter based on the optimization factor to obtain the initial quantization parameter of the target video frame. The process of estimating the quantization parameters of the target video frame based on its fuzziness complexity parameter, and obtaining the initial quantization parameters of the target video frame, can be found in Formulas 6-8 below:
[0122] qscale_raw[i]=blurred_complexity[i] (1-qcompres0) Formula 6
[0123] rate_factor[i]=wanted_bits_window[i] / cplxsum[i] Formula 7
[0124] qscale_adjust[i]=qscale_raw[i] / rate_factor[i] Formula 8
[0125] Here is an explanation of the parameters in Formulas 6-8: i represents the target video frame; qcompress represents the compression factor, which defaults to 0.6 in ABR mode. It characterizes the relationship between the blur complexity parameter and the quantization level parameter of the target video frame and is used to adjust the magnitude of the quantization level parameter; blurred_complexity[i] represents the blur complexity parameter of the target video frame; qscale_raw[i] represents the quantization level parameter of the target video frame; rate_factor[i] represents the optimization factor of the quantization level parameter; wanted_bits_window[i] represents the cumulative allocated information of the target video frame; cplxsum[i] represents the cumulative complexity parameter of the target video frame; rate_factor[i] is equal to the ratio between wanted_bits_window[i] and cplxsum[i]; qscale_adjust[i] represents the initial quantization parameter of the target video frame; qscale_adjust[i] is equal to the ratio between qscale_raw[i] and rate_factor[i].
[0126] S508 adjusts the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame.
[0127] As mentioned above, the target video frame can be any of the following types: keyframe, forward difference frame, or bidirectional difference frame. When the target video frame is any of these types, the initial quantization parameters of the target video frame need to be adjusted to obtain the encoded quantization parameters. The process of adjusting the initial quantization parameters of the target video frame to obtain the encoded quantization parameters may include:
[0128] (1) Determine the adjustment factor for the initial quantization parameters of the target video frame based on the cumulative encoded information and the cumulative allocated information of the N encoded video frames in the target video. The cumulative encoded information of the N encoded video frames is obtained by accumulating the encoded information of the N encoded video frames, where the encoded information of the encoded video frame refers to the number of bits actually generated by encoding the encoded video frame; the cumulative allocated information of the N encoded video frames is obtained by accumulating the allocated information of the N encoded video frames.
[0129] The process of determining the adjustment factor for the initial quantization parameters of the target video frame based on the cumulative encoded information and cumulative allocation information of the N encoded video frames in the target video may include: obtaining the bitrate information of the target video and the total encoding time of the N encoded video frames, where the total encoding time of the N encoded video frames can be determined based on the number of frames of the N encoded video frames and the frame rate information of the target video, where the frame rate information of the target video refers to the number of video frames transmitted per unit time; determining the average buffer information of the N encoded video frames based on the bitrate information of the target video and the total encoding time of the N encoded video frames; and determining the adjustment factor for the initial quantization parameters of the target video frame based on the cumulative encoded information, cumulative allocation information, and average buffer information of the N encoded video frames.
[0130] (2) Adjust the initial quantization parameters of the target video frame according to the adjustment factor to obtain the encoded quantization parameters of the target video frame. The process of adjusting the initial quantization parameters of the target video frame according to the adjustment factor to obtain the encoded quantization parameters of the target video frame may include: adjusting the initial quantization parameters of the target video frame according to the adjustment factor to obtain the adjusted quantization parameters of the target video frame; and determining the encoded quantization parameters of the target video frame according to the adjusted quantization parameters of the target video frame.
[0131] For details of the processes described in (1)-(2) above, please refer to Formulas 9-12 below:
[0132] abr_buffer[i-1] = 2 × R T ×sqrt(T total ) Formula 9
[0133] overflow[i] =
[0134] clip3(0.5, 2, 1.0+(total_bits[i-1]-wanted_bits[i-1]) / abr_buffer[i-1]) Formula 10
[0135] qscale_adjust[i]=qscale_adjust[i]×overflow[i] Formula 11
[0136] QP[i]=12+6×log2(qscale_adjust[i] / 0.85) Formula 12
[0137] Here is an explanation of the parameters in Formulas 9-12 above: R T This indicates the bitrate information of the target video; T totalsqrt(T) represents the total encoding time of N encoded video frames; total ) represents T total The square root of; abr_buffer[i-1] represents the average buffer information of N encoded video frames; total_bits[i-1] represents the cumulative encoded information of N encoded video frames; wanted_bits[i-1] represents the cumulative allocated information of N encoded video frames; clip3 represents the clip3 function; overflow[i] represents the initial quantization parameter adjustment factor of the target video frame; qscale_adjust[i] on the right side of Equation 11 represents the initial quantization parameter of the target video frame; qscale_adjust[i] on the left side of Equation 11 represents the adjusted quantization parameter of the target video frame; qscale_adjust[i] on the right side of Equation 12 represents the adjusted quantization parameter of the target video frame; QP[i] represents the encoded quantization parameter of the target video frame.
[0138] S509: Encode the target video frame according to the coding quantization parameters of the target video frame.
[0139] The execution process of step S509 in this embodiment is the same as described above. Figure 4 The execution process of step S406 in the illustrated embodiment is the same; please refer to the above for details. Figure 4 The description of step S406 in the illustrated embodiment will not be repeated here. After encoding the target video frame, the encoding quantization parameters of the video frames whose encoding order follows the target video frame can be determined according to the video processing method provided in this application embodiment, and encoding processing can be performed until all video frames in the target video have been processed.
[0140] In this embodiment, when the target video frame is a forward difference frame, the initial quantization parameters of the target video frame can be estimated based on its fuzzy complexity parameters, ensuring that the initial quantization parameters match the complexity of the target video frame. The initial quantization parameters of the target video frame can be adjusted based on the cumulative encoded information of all encoded video frames preceding the target video frame and the cumulative allocated information of all encoded video frames. This ensures that the actual encoded information generated during the entire encoding process is close to the pre-allocated encoded information, improving the overall encoding effect.
[0141] The above Figure 4 and Figure 5 The video processing methods shown can be summarized as follows: Figure 6 The flowchart shown illustrates that video processing methods may include:
[0142] (1) Determine the target video frame to be encoded from the target video, and perform type detection on the target video frame. The type of the target video frame may include any one of key frame type, forward difference frame type or bidirectional difference frame type.
[0143] (2) When the target video frame is a keyframe type, a reset judgment can be performed first. If it is determined that a reset is needed, the model parameters of the bitrate control model can be reset (i.e., initialized). If it is determined that a reset is not needed, or after the model parameters of the bitrate control model are reset, the coding quantization parameters of the N encoded video frames in the target video whose coding order is before the target video frame can be mapped to the same frame type (e.g., forward difference frame type) according to the coding offset parameter and then summed to obtain statistical parameters. The statistical parameters are further divided by the number of N encoded video frames to obtain the initial quantization parameters of the target video frame. After the initial quantization parameters of the target video frame are determined, the initial quantization parameters of the target video frame can be adjusted using the adjustment factor (i.e., the overflow[i] mentioned above) to obtain the coding quantization parameters of the target video frame.
[0144] (3) When the target video frame is a forward difference frame type, the fuzzy complexity parameter of the target video frame can be calculated first; then a reset judgment can be made. If it is determined that a reset is needed, the model parameters of the bitrate control model can be reset (i.e., initialized); if it is determined that a reset is not needed, or after the model parameters of the bitrate control model have been reset, the quantization parameters of the target video frame can be estimated based on the fuzzy complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame; after the initial quantization parameters of the target video frame are determined, the initial quantization parameters of the target video frame can be adjusted using the adjustment factor (i.e., the overflow[i] mentioned above) to obtain the encoded quantization parameters of the target video frame. Optionally, after determining the coding quantization parameters of the target video frame, the coding quantization parameters of the target video frame can be restricted based on the coding quantization parameters of video frames adjacent to the target video frame in the coding order. For example, if the absolute value of the difference between the coding quantization parameters of the adjacent video frames and the coding quantization parameters of the target video frame is greater than a restriction threshold, the coding quantization parameters of the target video frame can be restricted so that the absolute value of the difference between the coding quantization parameters of the adjacent video frames and the restricted coding quantization parameters of the target video frame is less than or equal to the restriction threshold. This can prevent the video quality from changing drastically when the video consumer plays the target video, thereby affecting the video consumption experience of the video consumer.
[0145] (4) When the target video is a bidirectional difference frame type, the coding quantization parameters of the reference video frame of the target video frame can be mapped to the same frame type (e.g., a forward difference frame type) according to the coding offset parameter. Then, the initial quantization parameters of the target video frame can be determined according to the coding quantization parameters of the mapped reference video frame. For example, the coding quantization parameters of the mapped reference video frame can be determined as the initial quantization parameters of the target video frame (when there is one reference video frame), or the coding quantization parameters of the reference video frame can be weighted and summed according to the complexity parameter of the reference video frame to obtain the initial quantization parameters of the target video frame (when there are two reference video frames). After determining the initial quantization parameters of the target video frame, it can be determined whether to set the target bitrate (i.e., the bitrate information mentioned above). If the target bitrate is set, the initial quantization parameters of the target video frame can be adjusted using the adjustment factor (i.e., the overflow[i] mentioned above) to obtain the coding quantization parameters of the target video frame; otherwise, the initial quantization parameters of the target video frame can be determined as the coding quantization parameters of the target video frame.
[0146] (5) After determining the coding and quantization parameters of the target video frame, the coding and quantization parameters of the target video frame can be further adjusted by using video buffer verification (VBV) and the further adjusted coding and quantization parameters of the target video frame can be output. Then, the target video frame can be encoded according to the coding and quantization parameters of the target video frame. The compensation window of the key frame, the model parameters of the bit rate control model, the buffer state, the model parameters of the information content estimation model, etc. can also be adjusted according to the coding result of the target video frame.
[0147] exist Figure 6 In the video processing scheme shown, by introducing an encoding offset parameter that matches the video feature attributes of the target video during the process of determining the initial quantization parameters of the target video frame, the initial quantization parameters of the determined target video frame can be adapted to the video attribute features of the target video. In this way, under the premise that the bitrate of the encoded video meets the target bandwidth, the video presentation quality and QoE (Quality of Experience) index at the video consumer end can be optimally balanced, thereby improving the video encoding effect.
[0148] To more intuitively illustrate the relationship between the encoding offset parameter and the video bitrate, the bitrate distribution during the video encoding process under different encoding offset parameters (ipratio / pbratio) is statistically presented here: Figure 7a The bitrate distribution of I-frames, B-frames, and P-frames in the video is shown when ipratio(1.4) and pbratio(1.3). Figure 7aThe horizontal axis represents time, and the vertical axis represents bitrate. Dark gray bars represent the bitrate of I-frames in the video, light gray bars represent the bitrate of P-frames in the video, white bars represent the bitrate of B-frames in the video, and the black line represents the target bitrate. Figure 7b The bitrate distribution of I-frames, B-frames, and P-frames in the video is shown when ipratio(1.8) and pbratio(1.1). Similarly, Figure 7b The horizontal axis represents time, and the vertical axis represents bitrate. Dark gray bars represent the bitrate of I-frames in the video, light gray bars represent the bitrate of P-frames, white bars represent the bitrate of B-frames, and the black line represents the target bitrate. Figure 7a and Figure 7b A direct comparison shows that by flexibly controlling the encoding offset parameters (ipratio / pbratio), the bitrate of each I-frame, P-frame, and B-frame in the video can be flexibly controlled, thereby controlling the fluctuation of the bitrate of each frame in the entire video. By determining the encoding offset parameters that match the video attribute characteristics, the QoE index of the video consumer can be improved (e.g., reducing buffering time for stuttering, reducing the duration of the first frame, increasing the video viewing time, etc.) while ensuring that the bitrate of the encoded video meets the target bandwidth.
[0149] To more intuitively illustrate the improvement effect of the video processing method provided in this application's embodiments on QoE and QoS metrics, this paper combines... Figure 8a The statistical charts shown compare QoS metrics for two methods: rate control optimization without using coding offset parameters and rate control optimization with coding offset parameters. Figure 8b The statistical charts shown compare the QoE metrics for two methods: bitrate control optimization without using the coding offset parameter and bitrate control optimization with the coding offset parameter. Specifically, Figure 8a The horizontal axis represents time, and the vertical axis represents QoS metrics (such as rendering stutter time per 100 seconds, i.e., the duration of stuttering within 100 seconds). The solid black line represents the rendering stutter time per 100 seconds without using the encoding offset parameter for bitrate control optimization, and the dashed black line represents the rendering stutter time per 100 seconds with the encoding offset parameter for bitrate control optimization. It is easy to see that the rendering stutter time per 100 seconds is significantly reduced when using the encoding offset parameter for bitrate control optimization compared to the method without encoding offset parameter for bitrate control optimization. Figure 8bThe horizontal axis represents time, and the vertical axis represents the QoE metric (e.g., average viewing time). The solid black line represents the average viewing time without bitrate control optimization using the encoding offset parameter, while the dashed black line represents the average viewing time with bitrate control optimization using the encoding offset parameter. It is easy to see that the average viewing time with bitrate control optimization using the encoding offset parameter is significantly improved compared to the method without bitrate control optimization.
[0150] The methods of the embodiments of this application have been described in detail above. In order to facilitate better implementation of the above solutions of the embodiments of this application, the apparatus of the embodiments of this application is provided below.
[0151] Please see Figure 9 , Figure 9 This is a schematic diagram of a video processing apparatus provided in an embodiment of this application. The video processing apparatus can be installed in the computer device provided in this embodiment. The video processing apparatus can be a computer program (including program code) running on the computer device, which can be the aforementioned video production equipment. The video processing apparatus can be used to execute... Figure 4 , Figure 5 or Figure 6 The corresponding steps in the method embodiments shown. Please refer to... Figure 9 The video processing apparatus may include the following units:
[0152] The acquisition unit 901 is used to acquire the target video frame to be encoded from the target video; and to acquire the video attribute features of the target video;
[0153] The processing unit 902 is used to determine the coding offset parameter that matches the video attribute features; to estimate the quantization parameters of the target video frame based on the coding offset parameter to obtain the initial quantization parameters of the target video frame; to adjust the initial quantization parameters of the target video frame to obtain the coding quantization parameters of the target video frame; and to perform coding processing on the target video frame based on the coding quantization parameters of the target video frame.
[0154] In one implementation, the video attribute features include one or more of the following: resolution information of the target video, video type information of the target video, bitrate information of the target video, and playback effect reference information of the target video; wherein, the encoding offset parameters matched with different video attribute features are different.
[0155] In one implementation, when determining the encoding offset parameter that matches the video attribute features, the processing unit 902 specifically performs the following steps:
[0156] In the parameter matching relationship, the attribute feature indication information that matches the video attribute feature is determined. The parameter matching relationship includes multiple attribute feature indication information and a reference offset parameter corresponding to each attribute feature indication information. The reference offset parameter corresponding to the matching attribute feature indication information is determined as the encoding offset parameter that matches the video attribute feature.
[0157] In one implementation, the target video frame is a keyframe type; the processing unit 902 is used to estimate the quantization parameters of the target video frame based on the coding offset parameters. Specifically, when obtaining the initial quantization parameters of the target video frame, it performs the following steps:
[0158] Based on the coding offset parameters, the coding quantization parameters of the specified type of encoded video frames among the N encoded video frames of the target video are mapped to obtain the offset quantization parameters of the specified type of encoded video frames, where N is a positive integer. Based on the offset quantization parameters of the specified type of encoded video frames and the coding quantization parameters of other types of encoded video frames among the N encoded video frames, the statistical parameters of the N encoded video frames are determined. Other types of encoded video frames refer to: other encoded video frames among the N encoded video frames besides the specified type of encoded video frames. Based on the statistical parameters of the N encoded video frames and the number of N encoded video frames, the initial quantization parameters of the target video frame are determined.
[0159] In one implementation, the encoding offset parameter includes a first encoding offset parameter and a second encoding offset parameter; the processing unit 902 is used to perform parameter mapping processing on the encoding quantization parameters of a specified type of encoded video frames among N encoded video frames of the target video according to the encoding offset parameter, and to obtain the offset quantization parameter of the specified type of encoded video frames, specifically to perform the following steps:
[0160] If the specified type is a keyframe type, then the encoding quantization parameters of the encoded video frames of the keyframe type are mapped according to the first encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the keyframe type; if the specified type is a bidirectional difference frame type, then the encoding quantization parameters of the encoded video frames of the bidirectional difference frame type are mapped according to the second encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the bidirectional difference frame type.
[0161] In one implementation, the target video frame is a bidirectional difference frame type; the processing unit 902 is used to estimate the quantization parameters of the target video frame based on the coding offset parameters, and to obtain the initial quantization parameters of the target video frame, specifically performs the following steps:
[0162] In the target video, a reference video frame is determined. If there is only one reference video frame, its reference quantization parameter is used as the initial quantization parameter of the target video frame. If there are M reference video frames, the complexity parameter of each of the M reference video frames is obtained, and the reference quantization parameters of the M reference video frames are weighted and summed according to their complexity parameters to obtain the initial quantization parameter of the target video frame, where M is an integer greater than 1. The reference quantization parameter of a specified type of reference video frame is obtained by mapping the encoded quantization parameter of the specified type of reference video frame to the encoded quantization parameter based on the encoded offset parameter. The reference quantization parameter of other types of reference video frames is the encoded quantization parameter of those other types. Other types of reference video frames refer to all reference video frames other than those of the specified type.
[0163] In one implementation, the processing unit 902 is further configured to perform the following steps:
[0164] Type detection is performed on the target video frame; if the target video frame is a keyframe type or a bidirectional difference frame type, the step of obtaining the video attribute features of the target video and determining the encoding offset parameters that match the video attribute features is triggered; if the target video frame is a forward difference frame type, the fuzzy complexity parameter of the target video frame is obtained, and the quantization parameter of the target video frame is estimated based on the fuzzy complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame.
[0165] In one implementation, when processing unit 902 obtains the fuzziness complexity parameter of the target video frame, it specifically performs the following steps:
[0166] Obtain the prediction residual parameters of the target video frame; determine the fuzzy complexity parameters of the target video frame based on the cumulative complexity parameters of the N encoded video frames, the cumulative frame count of the N encoded video frames, and the prediction residual parameters of the target video frame, where N is a positive integer; where the cumulative complexity parameter is obtained by weighted accumulation of the complexity parameters of the N encoded video frames; and the cumulative frame count is obtained by weighted accumulation of the frame counts of the N encoded video frames.
[0167] In one implementation, the processing unit 902 is used to estimate the quantization parameters of the target video frame based on the fuzziness complexity parameter of the target video frame, and to obtain the initial quantization parameters of the target video frame, specifically by performing the following steps:
[0168] The compression factor of the target video frame is obtained, and the quantization level parameter of the target video frame is determined based on the fuzziness complexity parameter of the target video frame and the compression factor. The cumulative allocation information and cumulative complexity parameter of the target video frame are obtained. The cumulative allocation information is obtained by accumulating the allocation information of the target video frame and the allocation information of N encoded video frames. The cumulative complexity parameter of the target video frame is determined based on the cumulative complexity parameters of the N encoded video frames and the prediction residual parameter of the target video frame. An optimization factor for the quantization level parameter is determined based on the cumulative allocation information and cumulative complexity parameter of the target video frame. The quantization level parameter is optimized based on the optimization factor to obtain the initial quantization parameters of the target video frame.
[0169] In one implementation, the processing unit 902, when adjusting the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame, specifically performs the following steps:
[0170] Based on the cumulative encoded information and cumulative allocated information of N encoded video frames in the target video, an adjustment factor for the initial quantization parameters of the target video frame is determined. The cumulative encoded information of the N encoded video frames is obtained by accumulating the encoded information of the N encoded video frames, and the cumulative allocated information of the N encoded video frames is obtained by accumulating the allocated information of the N encoded video frames, where N is a positive integer. The initial quantization parameters of the target video frame are adjusted according to the adjustment factor to obtain the encoded quantization parameters of the target video frame.
[0171] According to another embodiment of this application, Figure 9 The various units in the video processing apparatus shown can be individually or entirely merged into one or more other units, or some of the units can be further divided into multiple functionally smaller units. This achieves the same operation without affecting the technical effects of the embodiments of this application. The above-mentioned units are divided based on logical functions. In practical applications, the function of one unit can also be implemented by multiple units, or the function of multiple units can be implemented by one unit. In other embodiments of this application, the resource processing apparatus may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented collaboratively by multiple units.
[0172] According to another embodiment of this application, the following can be achieved by running on a general-purpose computing device, such as a computer, which includes processing elements and storage elements such as a central processing unit (CPU), random access memory (RAM), and read-only memory (ROM), a device capable of performing operations such as... Figure 4 , Figure 5 or Figure 6The computer program (including program code) involved in each step of the corresponding method shown is used to construct, for example... Figure 9 The video processing apparatus shown herein, and the video processing method for implementing the embodiments of this application, are described. A computer program may be recorded on, for example, a computer-readable storage medium, loaded onto the aforementioned computing device via the computer-readable storage medium, and executed therein.
[0173] In this embodiment, video attribute features of the target video can be obtained, and encoding offset parameters matching the video attribute features can be determined. Then, quantization parameters of the target video frame to be encoded in the target video can be estimated based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame. The initial quantization parameters of the target video frame can then be adjusted to obtain the encoding quantization parameters of the target video frame. Thus, the target video frame can be encoded based on the encoding quantization parameters. It can be seen that the encoding quantization parameters of the target video frame determined in this embodiment are compatible with the video attribute features of the target video. In other words, encoding quantization parameters for encoding the target video frame can be specifically determined based on the video attribute features of the target video. This allows for the optimal balance between the video presentation quality and the QoE (Quality of Experience) index at the video consumer end, while ensuring that the bitrate of the encoded video meets the target bandwidth, thereby improving the video encoding effect.
[0174] Based on the above methods and apparatus embodiments, this application provides a computer device. Please refer to [link to relevant documentation]. Figure 10 , Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 10 The computer device shown includes at least a processor 1001, an input interface 1002, an output interface 1003, and a computer-readable storage medium 1004. The processor 1001, input interface 1002, output interface 1003, and computer-readable storage medium 1004 can be connected via a bus or other means.
[0175] The input interface 1002 can be used to acquire the target video, acquire the video attribute features of the target video, etc.; the output interface 1003 can be used to output the target video frame obtained by encoding processing, the target video obtained by encoding processing, etc.
[0176] The computer-readable storage medium 1004 can be stored in the memory of a computer device. The computer-readable storage medium 1004 is used to store computer programs, including computer instructions. The processor 1001 is used to execute the program instructions stored in the computer-readable storage medium 1004. The processor 1001 (or CPU (Central Processing Unit)) is the computing and control core of the computer device, suitable for implementing one or more computer instructions, specifically suitable for loading and executing one or more computer instructions to achieve corresponding method flows or corresponding functions.
[0177] This application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device used to store programs and data. It is understood that the computer-readable storage medium here can include both built-in storage media in the computer device and extended storage media supported by the computer device. The computer-readable storage medium provides storage space that stores the operating system of the computer device. Furthermore, the storage space also stores one or more computer instructions suitable for loading and execution by a processor. These computer instructions can be one or more computer programs (including program code). It should be noted that the computer-readable storage medium here can be high-speed RAM or non-volatile memory, such as at least one disk storage device; optionally, it can also be at least one computer-readable storage medium located remotely from the aforementioned processor.
[0178] The computer device can be the aforementioned video production device, which can be loaded and executed by the processor 1001 with one or more computer instructions stored in the computer-readable storage medium 1004 to achieve the above-mentioned functions. Figure 4 , Figure 5 or Figure 6 The corresponding steps of the video processing method shown. In a specific implementation, the computer instructions in the computer-readable storage medium 1004 are loaded by the processor 1001 and executed as follows:
[0179] The process involves: acquiring the target video frame to be encoded from the target video; obtaining the video attribute features of the target video and determining the encoding offset parameters that match the video attribute features; estimating the quantization parameters of the target video frame based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame; adjusting the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame; and encoding the target video frame based on the encoded quantization parameters of the target video frame.
[0180] In one implementation, the video attribute features include one or more of the following: resolution information of the target video, video type information of the target video, bitrate information of the target video, and playback effect reference information of the target video; wherein, the encoding offset parameters matched with different video attribute features are different.
[0181] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to determine the encoding offset parameters that match the video attribute features, they are specifically used to perform the following steps:
[0182] In the parameter matching relationship, the attribute feature indication information that matches the video attribute feature is determined. The parameter matching relationship includes multiple attribute feature indication information and a reference offset parameter corresponding to each attribute feature indication information. The reference offset parameter corresponding to the matching attribute feature indication information is determined as the encoding offset parameter that matches the video attribute feature.
[0183] In one implementation, the target video frame is a keyframe type; when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to estimate the quantization parameters of the target video frame based on the encoding offset parameters and obtain the initial quantization parameters of the target video frame, the instructions specifically perform the following steps:
[0184] Based on the coding offset parameters, the coding quantization parameters of the specified type of encoded video frames among the N encoded video frames of the target video are mapped to obtain the offset quantization parameters of the specified type of encoded video frames, where N is a positive integer. Based on the offset quantization parameters of the specified type of encoded video frames and the coding quantization parameters of other types of encoded video frames among the N encoded video frames, the statistical parameters of the N encoded video frames are determined. Other types of encoded video frames refer to: other encoded video frames among the N encoded video frames besides the specified type of encoded video frames. Based on the statistical parameters of the N encoded video frames and the number of N encoded video frames, the initial quantization parameters of the target video frame are determined.
[0185] In one implementation, the encoding offset parameter includes a first encoding offset parameter and a second encoding offset parameter; when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to perform parameter mapping processing on the encoding quantization parameters of the specified type of encoded video frames among the N encoded video frames of the target video according to the encoding offset parameter, and to obtain the offset quantization parameters of the specified type of encoded video frames, the instructions are specifically used to perform the following steps:
[0186] If the specified type is a keyframe type, then the encoding quantization parameters of the encoded video frames of the keyframe type are mapped according to the first encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the keyframe type; if the specified type is a bidirectional difference frame type, then the encoding quantization parameters of the encoded video frames of the bidirectional difference frame type are mapped according to the second encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the bidirectional difference frame type.
[0187] In one implementation, the target video frame is a bidirectional difference frame type; when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to estimate the quantization parameters of the target video frame based on the coding offset parameters and obtain the initial quantization parameters of the target video frame, they are specifically used to perform the following steps:
[0188] In the target video, a reference video frame is determined. If there is only one reference video frame, its reference quantization parameter is used as the initial quantization parameter of the target video frame. If there are M reference video frames, the complexity parameter of each of the M reference video frames is obtained, and the reference quantization parameters of the M reference video frames are weighted and summed according to their complexity parameters to obtain the initial quantization parameter of the target video frame, where M is an integer greater than 1. The reference quantization parameter of a specified type of reference video frame is obtained by mapping the encoded quantization parameter of the specified type of reference video frame to the encoded quantization parameter based on the encoded offset parameter. The reference quantization parameter of other types of reference video frames is the encoded quantization parameter of those other types. Other types of reference video frames refer to all reference video frames other than those of the specified type.
[0189] In one implementation, the computer instructions in the computer-readable storage medium 1004 are loaded by the processor 1001 and are also used to perform the following steps:
[0190] Type detection is performed on the target video frame; if the target video frame is a keyframe type or a bidirectional difference frame type, the step of obtaining the video attribute features of the target video and determining the encoding offset parameters that match the video attribute features is triggered; if the target video frame is a forward difference frame type, the fuzzy complexity parameter of the target video frame is obtained, and the quantization parameter of the target video frame is estimated based on the fuzzy complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame.
[0191] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to obtain the fuzzy complexity parameter of the target video frame, they are specifically used to perform the following steps:
[0192] Obtain the prediction residual parameters of the target video frame; determine the fuzzy complexity parameters of the target video frame based on the cumulative complexity parameters of the N encoded video frames, the cumulative frame count of the N encoded video frames, and the prediction residual parameters of the target video frame, where N is a positive integer; where the cumulative complexity parameter is obtained by weighted accumulation of the complexity parameters of the N encoded video frames; and the cumulative frame count is obtained by weighted accumulation of the frame counts of the N encoded video frames.
[0193] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to estimate the quantization parameters of the target video frame based on the fuzziness complexity parameter of the target video frame, and obtain the initial quantization parameters of the target video frame, the instructions specifically perform the following steps:
[0194] The compression factor of the target video frame is obtained, and the quantization level parameter of the target video frame is determined based on the fuzziness complexity parameter of the target video frame and the compression factor. The cumulative allocation information and cumulative complexity parameter of the target video frame are obtained. The cumulative allocation information is obtained by accumulating the allocation information of the target video frame and the allocation information of N encoded video frames. The cumulative complexity parameter of the target video frame is determined based on the cumulative complexity parameters of the N encoded video frames and the prediction residual parameter of the target video frame. An optimization factor for the quantization level parameter is determined based on the cumulative allocation information and cumulative complexity parameter of the target video frame. The quantization level parameter is optimized based on the optimization factor to obtain the initial quantization parameters of the target video frame.
[0195] In one implementation, when the computer instructions in the computer-readable storage medium 1004 are loaded and executed by the processor 1001 to adjust the initial quantization parameters of the target video frame and obtain the encoded quantization parameters of the target video frame, they are specifically used to perform the following steps:
[0196] Based on the cumulative encoded information and cumulative allocated information of N encoded video frames in the target video, an adjustment factor for the initial quantization parameters of the target video frame is determined. The cumulative encoded information of the N encoded video frames is obtained by accumulating the encoded information of the N encoded video frames, and the cumulative allocated information of the N encoded video frames is obtained by accumulating the allocated information of the N encoded video frames, where N is a positive integer. The initial quantization parameters of the target video frame are adjusted according to the adjustment factor to obtain the encoded quantization parameters of the target video frame.
[0197] In this embodiment, video attribute features of the target video can be obtained, and encoding offset parameters matching the video attribute features can be determined. Then, quantization parameters of the target video frame to be encoded in the target video can be estimated based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame. The initial quantization parameters of the target video frame can then be adjusted to obtain the encoding quantization parameters of the target video frame. Thus, the target video frame can be encoded based on the encoding quantization parameters. It can be seen that the encoding quantization parameters of the target video frame determined in this embodiment are compatible with the video attribute features of the target video. In other words, encoding quantization parameters for encoding the target video frame can be specifically determined based on the video attribute features of the target video. This allows for the optimal balance between the video presentation quality and the QoE (Quality of Experience) index at the video consumer end, while ensuring that the bitrate of the encoded video meets the target bandwidth, thereby improving the video encoding effect.
[0198] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the video processing methods provided in the various alternative embodiments described above.
[0199] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A video processing method, characterized in that, The method includes: Obtain the target video frames to be encoded from the target video; Perform type detection on the target video frame; If the target video frame is a forward difference frame type, then the fuzzy complexity parameter of the target video frame is obtained, and the quantization parameter of the target video frame is estimated based on the fuzzy complexity parameter to obtain the initial quantization parameter of the target video frame; wherein, obtaining the fuzzy complexity parameter of the target video frame includes: obtaining the prediction residual parameter of the target video frame, wherein the prediction residual parameter is obtained by transforming the residual between the prediction video frame and the target video frame and then summing the absolute values; based on the N encoded views of the target video... The cumulative complexity parameter of the target video frame is determined by using the cumulative complexity parameter of the N encoded video frames and the prediction residual parameter of the target video frame; the cumulative frame number of the target video frame is determined by using the cumulative frame number of the N encoded video frames; the fuzzy complexity parameter of the target video frame is obtained by dividing the cumulative complexity parameter of the target video frame by the cumulative frame number of the target video frame, where N is a positive integer; wherein, the cumulative complexity parameter is obtained by weighted accumulation of the complexity parameters of the N encoded video frames; the cumulative frame number is obtained by weighted accumulation of the frame number of the N encoded video frames; The initial quantization parameters of the target video frame are adjusted to obtain the encoded quantization parameters of the target video frame; The target video frame is encoded according to the encoding and quantization parameters of the target video frame.
2. The method as described in claim 1, characterized in that, The method further includes: If the target video frame is a keyframe or a two-way difference frame, then the video attribute features of the target video are obtained, and the encoding offset parameters that match the video attribute features are determined; the quantization parameters of the target video frame are estimated based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame.
3. The method as described in claim 2, characterized in that, The video attribute features include any one or more of the following: resolution information of the target video, video type information of the target video, bitrate information of the target video, and playback effect reference information of the target video; wherein, different video attribute features are matched with different encoding offset parameters.
4. The method as described in claim 2, characterized in that, The step of determining the encoding offset parameter that matches the video attribute features includes: In the parameter matching relationship, attribute feature indication information that matches the video attribute features is determined. The parameter matching relationship includes multiple attribute feature indication information and a reference offset parameter corresponding to each attribute feature indication information. The reference offset parameter corresponding to the matched attribute feature indication information is determined as the encoding offset parameter that matches the video attribute feature.
5. The method as described in claim 2, characterized in that, The target video frame is a keyframe type; the step of estimating the quantization parameters of the target video frame based on the encoding offset parameters to obtain the initial quantization parameters of the target video frame includes: Based on the encoding offset parameter, the encoding quantization parameters of the specified type of encoded video frames in the N encoded video frames of the target video are processed by parameter mapping to obtain the offset quantization parameter of the specified type of encoded video frames, where N is a positive integer; Based on the offset quantization parameters of the specified type of encoded video frames and the encoding quantization parameters of other types of encoded video frames among the N encoded video frames, statistical parameters of the N encoded video frames are determined. The statistical parameters refer to the sum of the offset quantization parameters of the specified type of encoded video frames and the encoding quantization parameters of the other types of encoded video frames. The other types of encoded video frames refer to the encoded video frames among the N encoded video frames other than the specified type of encoded video frames. The initial quantization parameters of the target video frame are determined based on the ratio between the statistical parameters of the N encoded video frames and the number of the N encoded video frames. The parameter mapping process is used to uniformly map the encoding quantization parameters of the specified type of encoded video frames to the other types based on the encoding offset parameters.
6. The method as described in claim 5, characterized in that, The encoding offset parameters include a first encoding offset parameter and a second encoding offset parameter; the step of performing parameter mapping processing on the encoding quantization parameters of a specified type of encoded video frames among N encoded video frames of the target video according to the encoding offset parameters to obtain the offset quantization parameters of the specified type of encoded video frames includes: If the specified type is a keyframe type, then the encoding quantization parameters of the encoded video frames of the keyframe type are mapped according to the first encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the keyframe type. If the specified type is a bidirectional difference frame type, then the encoding quantization parameters of the encoded video frames of the bidirectional difference frame type are mapped according to the second encoding offset parameter to obtain the offset quantization parameters of the encoded video frames of the bidirectional difference frame type.
7. The method as described in claim 2, characterized in that, The target video frame is a bidirectional difference frame type; the step of estimating the quantization parameters of the target video frame based on the coding offset parameters to obtain the initial quantization parameters of the target video frame includes: Determine a reference video frame for the target video frame within the target video; If the number of reference video frames is one, then the reference quantization parameters of the reference video frame are determined as the initial quantization parameters of the target video frame; If the number of reference video frames is M, then the complexity parameter of each of the M reference video frames is obtained, and the reference quantization parameters of the M reference video frames are weighted and summed according to the complexity parameters of the M reference video frames to obtain the initial quantization parameters of the target video frame, where M is an integer greater than 1. The reference quantization parameter of the specified type of reference video frame in the reference video frame is obtained by performing parameter mapping processing on the coding quantization parameter of the specified type of reference video frame according to the coding offset parameter; the reference quantization parameter of other types of reference video frames in the reference video frame is the coding quantization parameter of the other types of reference video frames; the other types of reference video frames refer to: other reference video frames in the reference video frame besides the specified type of reference video frame.
8. The method as described in claim 1, characterized in that, The step of estimating the quantization parameters of the target video frame based on the fuzziness complexity parameter of the target video frame to obtain the initial quantization parameters of the target video frame includes: Obtain the compression factor of the target video frame, and determine the quantization level parameter of the target video frame based on the fuzziness complexity parameter of the target video frame and the compression factor; The cumulative allocation information of the target video frame and the cumulative complexity parameter of the target video frame are obtained; the cumulative allocation information of the target video frame is obtained by accumulating the allocation information of the target video frame and the allocation information of the N encoded video frames; the cumulative complexity parameter of the target video frame is determined based on the cumulative complexity parameters of the N encoded video frames and the prediction residual parameter of the target video frame. The optimization factor of the quantization level parameter is determined based on the cumulative allocated information of the target video frame and the cumulative complexity parameter of the target video frame. The quantization level parameters are optimized based on the optimization factor to obtain the initial quantization parameters of the target video frame.
9. The method according to any one of claims 1-8, characterized in that, The adjustment of the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame includes: Based on the cumulative encoded information of N encoded video frames in the target video and the cumulative allocation information of the N encoded video frames, an adjustment factor for the initial quantization parameters of the target video frames is determined; the cumulative encoded information of the N encoded video frames is obtained by accumulating the encoded information of the N encoded video frames, and the cumulative allocation information of the N encoded video frames is obtained by accumulating the allocation information of the N encoded video frames, where N is a positive integer; The initial quantization parameters of the target video frame are adjusted according to the adjustment factor to obtain the encoded quantization parameters of the target video frame.
10. A video processing apparatus, characterized in that, The video processing device includes: The acquisition unit is used to acquire the target video frame to be encoded from the target video; The processing unit is used to perform type detection on the target video frame; The processing unit is further configured to, if the type of the target video frame is a forward difference frame type, obtain the fuzzy complexity parameter of the target video frame, and perform quantization parameter estimation on the target video frame based on the fuzzy complexity parameter of the target video frame to obtain the initial quantization parameter of the target video frame; wherein, obtaining the fuzzy complexity parameter of the target video frame includes: obtaining the prediction residual parameter of the target video frame, wherein the prediction residual parameter is obtained by transforming the residual between the prediction video frame and the target video frame and then summing the absolute values; based on the N of the target video... The cumulative complexity parameter of the target video frame is determined by using the cumulative complexity parameter of the N encoded video frames and the prediction residual parameter of the target video frame; the cumulative frame number of the target video frame is determined by using the cumulative frame number of the N encoded video frames; the fuzzy complexity parameter of the target video frame is obtained by dividing the cumulative complexity parameter of the target video frame by the cumulative frame number of the target video frame, where N is a positive integer; wherein, the cumulative complexity parameter is obtained by weighted accumulation of the complexity parameters of the N encoded video frames; the cumulative frame number is obtained by weighted accumulation of the frame number of the N encoded video frames; The processing unit is further configured to adjust the initial quantization parameters of the target video frame to obtain the encoded quantization parameters of the target video frame. The processing unit is further configured to encode the target video frame according to the encoding quantization parameters of the target video frame.
11. A computer device, characterized in that, The computer device includes: A processor is a tool for implementing computer programs. A computer-readable storage medium storing a computer program adapted to be loaded by the processor and executed as described in any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program adapted to be loaded by a processor and executed as described in any one of claims 1 to 9.
13. A computer program product, characterized in that, The computer program product includes computer instructions that, when executed by a processor, implement the video processing method as described in any one of claims 1 to 9.