A pre-analysis processing method, system and device for video coding and a storage medium

By detecting the buffer area of ​​the pre-analysis module and setting the base length and set length, the startup of the pre-analysis module and the encoding timing of the encoding thread can be flexibly controlled, solving the latency problem caused by excessive pre-analysis module buffer size and improving the real-time performance of video encoding and user experience.

CN117061773BActive Publication Date: 2026-03-31GUANGZHOU BAIGUOYUAN INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-08-24
Publication Date
2026-03-31

AI Technical Summary

Technical Problem

In existing video coding technologies, excessive caching in the pre-analysis module can introduce significant latency, affecting video real-time performance and user experience.

Method used

By detecting the cache area associated with the pre-analysis module, setting the base length and the set length, the startup of the pre-analysis module and the encoding timing of the encoding thread can be flexibly controlled, avoiding the delay introduced by excessively large caches and improving encoding efficiency and real-time performance.

Benefits of technology

It effectively avoids latency caused by excessive pre-analysis module caching, improving the real-time performance of video encoding and user experience, especially in scenarios with high real-time requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117061773B_ABST
    Figure CN117061773B_ABST
Patent Text Reader

Abstract

The embodiment of the application discloses a kind of pre-analysis processing method, system, equipment and storage medium of video coding.The technical scheme provided in the embodiment of the application, by detecting the cache area associated with pre-analysis module, the cache area is used to buffer the frame to be encoded;In the case where the cache length of cache area reaches the basic length, start pre-analysis module to carry out the pre-analysis of the frame to be encoded, and in the case where the cache length of cache area exceeds the basic length setting length, the encoding of the frame to be encoded corresponding to cache area is carried out by encoding thread;In the case where the cache length of cache area does not reach the basic length, close pre-analysis module;The basic length is set according to the specified video coding delay, and the setting length is determined according to the time consumption of the encoding thread to encode the frame to be encoded.The above technical means can avoid the large delay caused by the large cache of pre-analysis module, improve the coding efficiency, guarantee the real-time performance of video transmission and improve the user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video coding technology, and in particular to a video coding pre-analysis processing method, system, device and storage medium. Background Technology

[0002] Currently, real-time audio and video transmission technologies are used in scenarios such as live streaming and video calls. Mainstream HEVC (High Efficiency Video Coding / H.265) encoders typically include a pre-analysis module to pre-analyze the frames to be encoded. This module uses intra-frame prediction and inter-frame motion search to obtain pre-analysis information, which assists in the formal encoding of the frames and improves video encoding efficiency.

[0003] However, the pre-analysis module caches several frames to be encoded during the pre-analysis of the frames to be encoded. If the cache is too large, it will introduce a large delay, which will result in a relatively poor user experience for scenarios with high real-time video requirements. Summary of the Invention

[0004] This application provides a video encoding pre-analysis processing method, system, device, and storage medium, which can ensure encoding efficiency while avoiding large delays introduced by the pre-analysis module, and solve the technical problem of video delay caused by excessive pre-analysis module buffer.

[0005] In a first aspect, embodiments of this application provide a pre-analysis processing method for video encoding, comprising:

[0006] The detection pre-analysis module is associated with a cache region, which is used to cache frames to be encoded;

[0007] If the buffer length of the buffer area reaches the base length, the pre-analysis module is started to pre-analyze the frame to be encoded. If the buffer length of the buffer area exceeds the base length setting, the encoding thread encodes the corresponding frame to be encoded in the buffer area. If the buffer length of the buffer area does not reach the base length, the pre-analysis module is turned off. The base length is set according to the specified video encoding delay, which is introduced by the buffer area. The set length is determined according to the time taken by the encoding thread to encode the frame to be encoded.

[0008] In a second aspect, embodiments of this application provide a video coding pre-analysis processing system, comprising:

[0009] The detection module is configured to detect the cache area associated with the pre-analysis module. The cache area is used to cache frames to be encoded.

[0010] The processing module is used to start the pre-analysis module to pre-analyze the frame to be encoded when the buffer length of the buffer area reaches the basic length, and to encode the corresponding frame to be encoded in the buffer area through the encoding thread when the buffer length of the buffer area exceeds the basic length setting; and to shut down the pre-analysis module when the buffer length of the buffer area does not reach the basic length. The basic length is set according to the specified video encoding delay, which is introduced by the buffer area, and the set length is determined according to the time taken by the encoding thread to encode the frame to be encoded.

[0011] In a third aspect, embodiments of this application provide a video encoding pre-analysis processing apparatus, comprising:

[0012] Memory and one or more processors;

[0013] The memory is configured to store one or more programs;

[0014] When the one or more programs are executed by the one or more processors, the one or more processors implement the video coding pre-analysis processing method as described in the first aspect.

[0015] In a fourth aspect, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions configured, when executed by a computer processor, to perform the video encoding pre-analysis processing method as described in the first aspect.

[0016] In a fifth aspect, embodiments of this application provide a computer program product containing instructions that, when executed on a computer or processor, cause the computer or processor to perform the video encoding pre-analysis processing method as described in the first aspect.

[0017] This embodiment detects a buffer region associated with the pre-analysis module, which is used to buffer frames to be encoded. When the buffer length reaches a base length, the pre-analysis module is activated to pre-analyze the frames to be encoded. If the buffer length exceeds the base length, the encoding thread encodes the corresponding frames in the buffer region. If the buffer length does not reach the base length, the pre-analysis module is deactivated. The base length is set based on a specified video encoding delay, which is introduced by the buffer region. The set length is determined based on the encoding time of the encoding thread. By using the above techniques, by setting the base length of the buffer region based on the video encoding delay and determining the set length based on the encoding time, and combining this base length and set length to determine the activation timing of the pre-analysis module and the encoding timing of the encoding thread, the large delay introduced by an excessively large pre-analysis module buffer is avoided, thus improving encoding efficiency, ensuring real-time video transmission, and enhancing the user experience. Attached Figure Description

[0018] Figure 1 This is a flowchart of a video encoding pre-analysis processing method provided in an embodiment of this application;

[0019] Figure 2 This is a flowchart of the pre-analysis decision-making process based on scenario patterns in the embodiments of this application;

[0020] Figure 3 This is a flowchart of the coding decision process in the embodiments of this application;

[0021] Figure 4 This is a schematic diagram of the structure of a video coding pre-analysis processing system provided in an embodiment of this application;

[0022] Figure 5 This is a schematic diagram of the structure of a video encoding pre-analysis processing device provided in an embodiment of this application. Detailed Implementation

[0023] To make the objectives, technical solutions, and advantages of this application clearer, specific embodiments of this application will be described in further detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are merely for explaining this application and not for limiting it. It should also be noted that, for ease of description, only the parts relevant to this application are shown in the drawings, not all of them. Before discussing exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flowcharts. Although the flowcharts describe operations (or steps) as sequential processes, many of these operations can be performed in parallel, concurrently, or simultaneously. Furthermore, the order of the operations can be rearranged. The process can be terminated when its operation is completed, but may also have additional steps not included in the drawings. The process can correspond to a method, function, procedure, subroutine, subprogram, etc.

[0024] The video encoding pre-analysis processing method provided in this application aims to set the basic length of the buffer area according to the video encoding delay, determine the set length according to the encoding time, and combine the basic length and the set length to determine the start time of the pre-analysis module and the encoding time of the encoding thread. In this way, it avoids the introduction of large delays due to excessive buffer size of the pre-analysis module, and improves the real-time performance of video encoding while ensuring encoding efficiency.

[0025] Among relevant video coding schemes, the mainstream encoders include H.264 (Highly Compressed Digital Video Coding) and HEVC encoders. Compared to H.264, HEVC encoders support more flexible block partitioning, reference pixel filtering for intra-frame prediction, more efficient motion vector prediction technology, and SAO (Sample Adaptive Offset) to improve post-processing image quality. Generally, HEVC encoders have higher compression efficiency and support more flexible encoding configurations. However, HEVC encoders generally have higher encoding complexity than H.264 encoders. Common HEVC encoders typically include a pre-analysis module. This module buffers several incoming video frames for encoding, performing intra-frame prediction and inter-frame motion search. The pre-analysis module introduces encoding latency, but in return, it significantly improves encoding efficiency. Generally, at the same bitrate, it improves the objective encoding quality. However, the pre-analysis module is usually independent of the encoding thread. To ensure the encoding thread can acquire encoded frames in a timely manner, the pre-analysis module typically buffers several additional video frames, introducing additional latency. This latency does not improve image quality. Using a software-based HEVC encoder directly on low-end devices may result in insufficient encoding performance, leading to low encoding resolution and frame rate, thus affecting the viewing experience. Therefore, this application provides a video encoding pre-analysis processing method to address the technical problem of video latency caused by excessive pre-analysis module buffer size.

[0026] Example:

[0027] Figure 1 A flowchart of a video encoding pre-analysis processing method according to an embodiment of this application is provided. This video encoding pre-analysis processing method can be executed by a video encoding pre-analysis processing device, which can be implemented by software and / or hardware. The video encoding pre-analysis processing device can consist of two or more physical entities, or it can consist of a single physical entity. Generally, the video encoding pre-analysis processing device can be an encoding server, host, computer, mobile phone, tablet, or other encoding device.

[0028] The following description uses a video encoding pre-analysis processing device as the main body for performing the video encoding pre-analysis processing method. (Refer to...) Figure 1 The pre-analysis processing method for this video encoding specifically includes:

[0029] S110, Detect the cache area associated with the pre-analysis module. The cache area is used to cache frames to be encoded.

[0030] S120. When the buffer length of the buffer area reaches the basic length, start the pre-analysis module to pre-analyze the frame to be encoded. When the buffer length of the buffer area exceeds the basic length setting, encode the corresponding frame to be encoded in the buffer area through the encoding thread. When the buffer length of the buffer area does not reach the basic length, shut down the pre-analysis module. The basic length is set according to the specified video encoding delay. The video encoding delay is introduced by the buffer area. The set length is determined according to the time taken by the encoding thread to encode the frame to be encoded.

[0031] In this embodiment, during the pre-analysis processing for video encoding, the HEVC encoder's pre-analysis module, to ensure the encoding thread can acquire encoded frames in a timely manner and fully utilize the CPU, additionally caches several video frames to be encoded. This introduces additional latency, increasing the video latency at the viewer's end and degrading user interactivity. Therefore, it is necessary to flexibly utilize the encoder's pre-analysis module to balance encoding latency and CPU usage. Thus, this solution sets a base length for the buffer area based on the acceptable video encoding latency, using this base length to trigger the pre-analysis module's startup. This avoids excessive latency caused by caching too many video frames in the pre-analysis module's buffer area, improving the real-time performance of video encoding transmission. Furthermore, by setting this base length based on the encoding thread's encoding time for each frame, the encoding thread does not need to wait too long for the pre-analysis module's results, allowing for timely use of the pre-analysis results for formal video encoding. This ensures video encoding efficiency, fully utilizing CPU resources for video encoding, while simultaneously preventing excessive latency introduced by the pre-analysis module's buffer area, thus improving the real-time performance of video encoding. For scenarios with strong video calls and live streaming interaction (such as live chat), it can meet the real-time video requirements in the corresponding scenarios and improve the user experience.

[0032] Specifically, when the pre-analysis module performs pre-analysis processing on the video frames to be encoded, in order to make full use of CPU resources, it caches several video frames to be encoded in its cache area, instead of caching only one video frame at a time for pre-analysis processing. Furthermore, to reduce encoding latency, the cache area of ​​the pre-analysis module needs to be flexibly adapted.

[0033] Based on actual testing, the base length of the pre-analysis module's buffer area is 4. Triggering pre-analysis processing on the frames to be encoded within the buffer area when the buffer area reaches 4 can maintain a good balance between latency and coding efficiency.

[0034] In the buffer area, if the number of B-frames is 2, the pre-analysis module's default buffer frame count will reach 4+2+2 (the other 2 frames form a MINI GOP). Since the pre-analysis module is activated when the buffer length reaches the base length (i.e., a buffer length of 4 is sufficient for pre-analysis calculations), whenever the pre-analysis module needs to retrieve 2+1 frames (two consecutive B-frames plus a backward reference frame P), the buffer length will still be greater than the base length of 4. Therefore, in reality, the pre-analysis module will be activated for every frame to be encoded. While this better ensures that the main thread always gets pre-analyzed frames, such a buffer length is still too long, introducing additional latency. Furthermore, if the additional buffer frames are turned off when determining when to trigger the pre-analysis module, keeping only the pre-analysis module at 4 frames, then the pre-analysis module will only be activated when the main thread retrieves a frame to be encoded. In this case, the main thread will wait for the pre-analysis module's calculation results for video encoding, increasing the actual encoding time per frame.

[0035] Therefore, this application embodiment introduces the concept of a sync buffer (synchronization buffer area, i.e., a set length) into the pre-analysis module. When the buffer length of the pre-analysis module reaches 4 + sync buffer, the encoding thread extracts the pre-analyzed frame to be encoded from the buffer area to improve encoding efficiency and reduce encoding waiting time.

[0036] The length is set to the length of one frame to be encoded. In practical applications, setting the sync buffer to 1 means that the pre-analysis module will pre-analyze one frame before the encoding thread. This reduces the waiting time for the encoding thread when acquiring the frame to be encoded, thereby reducing encoding latency and improving the viewing experience on the user's end.

[0037] Optionally, considering the varying sensitivities to video latency in different scenarios, the base length can be adaptively adjusted for scenarios with high latency sensitivity, indicating that the buffer area is too long. For scenarios with high real-time requirements, the pre-analysis module can even be disabled, allowing direct video encoding. This eliminates the need to consider the video latency introduced by the pre-analysis module's buffer area, thus improving video real-time performance.

[0038] Among them, reference Figure 2 Before detecting the cache area of ​​the pre-analysis module, it also includes:

[0039] S1001, Detect the scene mode of the current video encoding;

[0040] S1002. If the current video encoding scene mode is the first setting mode, turn off the pre-analysis module;

[0041] S1003. If the current video encoding scene mode is the second setting mode, increase the base length.

[0042] By setting different scene modes, the system detects the real-time scene mode during video encoding to make decisions for the pre-analysis module based on the scene mode. Scene modes include a first setting mode and a second setting mode. The first setting mode is for highly interactive scenes. In highly interactive scenes, encoding latency is the most important factor to consider, so encoding efficiency needs to be appropriately sacrificed. In this case, the pre-analysis module can be turned off, and B-frame introduction can be disabled to avoid introducing latency and ensure real-time encoding. The second setting mode is for less interactive scenes. In less interactive scenes, the buffer length of the pre-analysis module's buffer area can be appropriately increased, and an appropriate number of B-frames can be introduced to improve encoding efficiency. Encoding efficiency can be adjusted by changing the base length setting. Multiple different scene modes can be added adaptively according to actual needs. The scene mode can be determined based on the real-time video interaction type, such as setting "video chat" as the first setting mode. This application's real-time example does not impose fixed restrictions on specific scene mode settings and detection, which will not be elaborated upon here.

[0043] Optionally, encoding the frame to be encoded corresponding to the buffer region via an encoding thread further includes:

[0044] The system detects the real-time encoding time of the encoding thread, adjusts the encoding resolution based on the real-time encoding time, and shuts down the current encoder and uses the default encoder for video encoding when the encoding resolution is lower than the set resolution threshold.

[0045] In this application, the real-time example uses a software-based H.264 encoder as a fallback encoding scheme for the software-based HEVC encoder. During video encoding in the encoding thread, the real-time encoding time is monitored. If the encoding time exceeds a set threshold, the current encoding performance is deemed insufficient, and the encoding resolution is reduced. A resolution threshold is set to trigger resolution switching. When insufficient encoding performance is detected and the encoding resolution falls below the resolution threshold, it is considered that the software-based HEVC encoder cannot provide adequate support under the current circumstances. Therefore, the software-based HEVC encoder is disabled, and the software-based H.264 encoder is used for video encoding.

[0046] On the other hand, encoding the frame to be encoded corresponding to the buffer region through the encoding thread also includes:

[0047] If a frame to be encoded exceeds a set size threshold, it is marked. If a frame of the corresponding frame type is marked a set number of times, the current encoder is turned off and the default encoder is used for video encoding.

[0048] It should be noted that excessively large bitrate fluctuations indicate that the current software-based HEVC encoder is unsuitable for video encoding. Therefore, to stabilize the bitrate and improve encoding quality, the encoder needs to be switched. Based on this, this embodiment detects the output size of the encoded frames from the software-based HEVC encoder and sets size thresholds for I, P, and B frames respectively. If the encoded output size of the corresponding frame type exceeds the set threshold, a flag is set. If the encoded output size of encoded frames exceeds the set threshold a set number of times consecutively, it is determined that the bitrate fluctuation is too large or there is a risk of bitrate overflow. In this case, the software-based HEVC encoder is also disabled, and a software-based H.264 encoder is used for video encoding.

[0049] In one embodiment, to further improve encoding quality, this application embodiment also performs adaptive settings for encoding parameters and frame rate. Specifically, after encoding the frame to be encoded corresponding to the buffer region through the encoding thread, the method further includes: detecting the real-time encoding frame rate of the encoding thread; and when the encoding frame rate is lower than a set frame rate threshold, disabling the pre-analysis module. The frame rate threshold is set to the encoding frame rate corresponding to when video encoding reaches a latency threshold.

[0050] Considering that enabling the encoding pre-analysis module increases encoding latency, and that for a given encoding latency of frames, the lower the frame rate, the greater the actual latency (in milliseconds), enabling encoding pre-analysis is not suitable at low frame rates. Based on this, embodiments of this application can also set a frame rate threshold based on the actual video encoding latency that may be introduced. The video frame rate corresponding to the maximum acceptable latency for video encoding (i.e., the latency threshold) is set as the frame rate threshold. When the actual encoded frame rate is detected to be less than this threshold, the encoding pre-analysis module is disabled. It is understood that when the actual encoded frame rate is less than this threshold, it indicates that the current software-encoded HEVC encoder cannot provide good encoding results. In this case, a fallback encoding scheme can be used, i.e., using a software-encoded H264 encoder for video encoding to maintain good encoding quality.

[0051] On the other hand, refer to Figure 3 Encoding of the corresponding frame to be encoded in the buffer area is performed by the encoding thread, and also includes:

[0052] S1201. Determine the decision result of the coding unit skipping mode in the frame to be encoded, and determine the optimal coding mode based on the decision;

[0053] S1202, Skip decision for recursive partitioning based on optimal coding pattern.

[0054] In typical HEVC encoders, the CTU (Code Unit) mode decision module is a crucial component of encoder complexity. The mode decision process typically begins with a skip mode (SKIP mode) decision, followed by intra-frame and inter-frame mode decisions to determine the optimal mode for the current CU (Code Unit) size, and finally, recursive CU partitioning. The optimal coding mode is derived after the current CU depth and recursive partitioning. However, in actual encoding, traversing all intra-frame and inter-frame modes and all recursive partitions significantly increases encoding complexity. Therefore, the HEVC encoder in this application first performs a SKIP mode decision at the current CU depth. Based on the SKIP mode decision result (the COST cost under SKIP mode), it determines whether to skip the remaining intra-frame and inter-frame mode encoding. After obtaining the optimal mode for the current depth, it then determines whether to skip the recursive mode decisions based on the optimal mode. Simultaneously, it adaptively adjusts its strategy based on encoding feedback, significantly reducing encoding complexity and improving the practicality of video encoding while ensuring minimal changes in subjective and objective image quality.

[0055] As described above, by detecting the buffer region associated with the pre-analysis module, which is used to buffer frames to be encoded, the pre-analysis module is started to pre-analyze the frames to be encoded when the buffer length reaches the base length. If the buffer length exceeds the base length, the encoding thread encodes the corresponding frames to be encoded in the buffer region. If the buffer length does not reach the base length, the pre-analysis module is shut down. The base length is set according to the specified video encoding delay, which is introduced by the buffer region. The set length is determined based on the encoding time of the encoding thread for the frames to be encoded. By using the above technical means, by setting the base length of the buffer region according to the video encoding delay and determining the set length according to the encoding time, the timing of starting the pre-analysis module and the encoding timing of the encoding thread are determined by combining the base length and the set length. This avoids the pre-analysis module buffer from being too large and introducing large delays, improves encoding efficiency, ensures real-time video transmission, and enhances the user experience.

[0056] Based on the above embodiments, Figure 4 A schematic diagram of the structure of a video coding pre-analysis processing system provided in this application. (Reference) Figure 4 The video encoding pre-analysis processing system provided in this embodiment specifically includes: a detection module 21 and a processing module 22.

[0057] Among them, the detection module 21 is configured to detect the cache area associated with the pre-analysis module, and the cache area is used to cache the frame to be encoded;

[0058] The processing module 22 is used to start the pre-analysis module to pre-analyze the frame to be encoded when the buffer length of the buffer area reaches the basic length, and to encode the frame to be encoded corresponding to the buffer area through the encoding thread when the buffer length of the buffer area exceeds the basic length setting; and to shut down the pre-analysis module when the buffer length of the buffer area does not reach the basic length. The basic length is set according to the specified video encoding delay, which is introduced by the buffer area. The set length is determined according to the time taken by the encoding thread to encode the frame to be encoded.

[0059] Among them, the length of the frame to be encoded is set to 1 frame.

[0060] Specifically, after encoding the frame to be encoded corresponding to the buffer region through the encoding thread, the process also includes:

[0061] The real-time encoding frame rate of the encoding thread is detected. When the encoding frame rate is lower than the set frame rate threshold, the pre-analysis module is turned off. The frame rate threshold is the encoding frame rate corresponding to the video encoding reaching the delay threshold.

[0062] Specifically, encoding the frame to be encoded corresponding to the buffer region through the encoding thread also includes:

[0063] Determine the decision result of the skipped mode of the coding unit in the frame to be encoded, and determine the optimal coding mode based on the decision result;

[0064] Skip decision based on recursive partitioning using the optimal encoding pattern.

[0065] In addition, before detecting the cache area of ​​the pre-analysis module, the following is also included:

[0066] Detect the scene mode of the current video encoding;

[0067] If the current video encoding scene mode is set to the first preset mode, disable the pre-analysis module;

[0068] If the current video encoding scenario mode is the second setting mode, increase the base length.

[0069] Specifically, encoding the frame to be encoded corresponding to the buffer region through the encoding thread also includes:

[0070] The system detects the real-time encoding time of the encoding thread, adjusts the encoding resolution based on the real-time encoding time, and shuts down the current encoder and uses the default encoder for video encoding when the encoding resolution is lower than the set resolution threshold.

[0071] Encoding the frame to be encoded corresponding to the buffer region through the encoding thread also includes:

[0072] If a frame to be encoded exceeds a set size threshold, it is marked. If a frame of the corresponding frame type is marked a set number of times, the current encoder is turned off and the default encoder is used for video encoding.

[0073] As described above, by detecting the buffer region associated with the pre-analysis module, which is used to buffer frames to be encoded, the pre-analysis module is started to pre-analyze the frames to be encoded when the buffer length reaches the base length. If the buffer length exceeds the base length, the encoding thread encodes the corresponding frames to be encoded in the buffer region. If the buffer length does not reach the base length, the pre-analysis module is shut down. The base length is set according to the specified video encoding delay, which is introduced by the buffer region. The set length is determined based on the encoding time of the encoding thread for the frames to be encoded. By using the above technical means, by setting the base length of the buffer region according to the video encoding delay and determining the set length according to the encoding time, the timing of starting the pre-analysis module and the encoding timing of the encoding thread are determined by combining the base length and the set length. This avoids the pre-analysis module buffer from being too large and introducing large delays, improves encoding efficiency, ensures real-time video transmission, and enhances the user experience.

[0074] The video encoding pre-analysis processing system provided in this application embodiment can be configured to execute the video encoding pre-analysis processing method provided in the above embodiment, and has corresponding functions and beneficial effects.

[0075] Based on the above practical examples, this application also provides a video encoding pre-analysis processing device, referring to... Figure 5 The video encoding pre-analysis processing device includes a processor 31, a memory 32, a communication module 33, an input device 34, and an output device 35. The memory, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the video encoding pre-analysis processing method described in any embodiment of this application (e.g., the detection module and processing module in the video encoding pre-analysis processing system). The communication module is configured to perform data transmission. The processor executes various functional applications and data processing of the device by running the software programs, instructions, and modules stored in the memory, thereby implementing the aforementioned video encoding pre-analysis processing method. The input device can be configured to receive input digital or character information and generate key signal inputs related to user settings and function control of the device. The output device may include a display device such as a screen. The video encoding pre-analysis processing device provided above can be configured to execute the video encoding pre-analysis processing method provided in the above embodiments, possessing corresponding functions and beneficial effects.

[0076] Based on the above embodiments, this application also provides a computer-readable storage medium storing computer-executable instructions. These instructions, when executed by a computer processor, are configured to perform a video encoding pre-analysis processing method. The storage medium can be any type of memory device or storage device. Of course, the computer-readable storage medium provided in this application is not limited to the video encoding pre-analysis processing method described above; it can also perform related operations within the video encoding pre-analysis processing method provided in any embodiment of this application.

[0077] Based on the above embodiments, this application also provides a computer program product. The technical solution of this application, in essence or in other words, the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer program product is stored in a storage medium and includes several instructions to cause a computer device, mobile terminal, or processor therein to execute all or part of the steps of the video encoding pre-analysis processing method described in the various embodiments of this application.

Claims

1. A pre-analysis processing method of video coding, characterized in that, The method comprises the following steps: detecting a cache area associated with a pre-analysis module, the cache area being used to cache frames to be encoded; in the case where the cache length of the cache area reaches a basic length, starting the pre-analysis module to perform pre-analysis on the frames to be encoded, and in the case where the cache length of the cache area exceeds the sum of the basic length and a set length, extracting the frames to be encoded that have completed pre-analysis from the cache area by an encoding thread for encoding; in the case where the cache length of the cache area does not reach the basic length, closing the pre-analysis module, closing B-frame introduction, and directly performing video encoding; the basic length is set according to a specified video encoding delay, the video encoding delay is introduced by the pre-analysis module caching the frames to be encoded to the cache area, and the set length is determined according to the time consumption of the encoding thread in encoding the frames to be encoded.

2. The pre-analysis processing method of video coding according to claim 1, wherein, After the frames to be encoded that have completed pre-analysis are extracted from the cache area by the encoding thread for encoding, the method further comprises the following steps: detecting a real-time encoding frame rate of the encoding thread, and closing the pre-analysis module when the encoding frame rate is lower than a set frame rate threshold, the set frame rate threshold being a corresponding encoding frame rate when the video encoding reaches a delay threshold.

3. The pre-analysis processing method of video coding according to claim 1, wherein, The encoding of the frames to be encoded that have completed pre-analysis by the encoding thread from the cache area further comprises the following steps: determining a decision result of a coding unit skip mode in the frames to be encoded, determining an optimal encoding mode based on the decision result, and performing recursive partitioning skip decision based on the optimal encoding mode. Before detecting the cache area of the pre-analysis module, the method further comprises the following steps:

4. The pre-analysis processing method of video coding according to any of claims 1-3, characterized in that, detecting a scene mode of current video encoding; in the case where the scene mode of the current video encoding is a first set mode, closing the pre-analysis module, the first set mode being a scene mode with stronger interactivity; in the case where the scene mode of the current video encoding is a second set mode, expanding the basic length, the second set mode being a scene mode with weaker interactivity. The encoding of the frames to be encoded that have completed pre-analysis by the encoding thread from the cache area further comprises the following steps:

5. The pre-analysis processing method of video coding according to claim 1, wherein, detecting a real-time encoding time consumption of the encoding thread, adjusting an encoding resolution according to the real-time encoding time consumption, and closing a current encoder and using a default encoder to perform video encoding in the case where the encoding resolution is lower than a set resolution threshold. The encoding of the frames to be encoded that have completed pre-analysis by the encoding thread from the cache area further comprises the following steps:

6. The pre-analysis processing method of video coding according to claim 1, wherein, marking the frames to be encoded whose encoding output size exceeds a set size threshold, and closing a current encoder and using a default encoder to perform video encoding in the case where frames to be encoded of a corresponding frame type are marked for a continuous set number of times. The set length is 1 frame to be encoded.

7. The pre-analysis processing method of video coding according to claim 1, wherein, The method comprises the following steps:

8. A pre-analysis processing system for video coding, characterized in that, detecting a cache area associated with a pre-analysis module, the cache area being used to cache frames to be encoded; ​ The processing module is configured to start the pre-analysis module to perform pre-analysis on the to-be-encoded frames when the cache length of the cache area reaches a basic length, and to extract the to-be-encoded frames that have completed pre-analysis from the cache area by an encoding thread to perform encoding when the cache length of the cache area exceeds the sum of the basic length and a set length; and the processing module is configured to close the pre-analysis module, close B-frame introduction, and directly perform video encoding when the cache length of the cache area does not reach the basic length. The basic length is set according to a specified video encoding delay, and the video encoding delay is introduced by the pre-analysis module that caches the to-be-encoded frames to the cache area; and the set length is determined according to the time consumed by the encoding thread to encode the to-be-encoded frames.

9. A pre-analysis processing device for video coding, characterized in that, The video encoding pre-analysis processing method comprises the following steps: a memory and one or more processors; the memory is configured to store one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the video encoding pre-analysis processing method according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are configured to perform the video encoding pre-analysis processing method according to any one of claims 1-7 when executed by a computer processor.

11. A computer program product, characterised in that, The computer program product contains instructions, and the instructions make the computer or processor execute the video encoding pre-analysis processing method according to any one of claims 1-7 when the instructions are executed on the computer or processor.

Citation Information

Patent Citations

  • Statistical multiplexing method and device

    CN105323578A

  • Low-delay code rate control method for 4K / 8K ultra-high-definition video coding

    CN110572661A