Dynamic coding structure parameter adjustment method and electronic device

CN122933909APending Publication Date: 2026-10-16WUXI YINGWEI INNOVATION TECHNOLOGY DEVELOPMENT CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611163345.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-07-31
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0005]本申请实施例提供一种动态编码结构参数调整方法及电子设备,解决视频编码过程中编码结构难以随内容变化进行有效适配的问题,从而提升编码结构对不同视频场景的适应能力

Benefits of technology

[0048] The dynamic coding structure parameter adjustment method and electronic device provided in this application determine the scene complexity corresponding to the video content; determine the coding structure parameters based on the scene complexity, wherein there is a corresponding relationship between the scene complexity and the coding structure parameters, and the coding structure parameters include the group of pictures (GOP) length, the IPB frame arrangement structure, and the number of reference frames; video coding based on the determined coding structure parameters enables the coding structure to be adapted to changes in video content, thereby taking into account coding efficiency, image quality stability, and bitrate control effect in different scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122933909A_ABST
    Figure CN122933909A_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a dynamic coding structure parameter adjustment method and electronic equipment, and relates to the technical field of video coding. The method comprises the following steps: determining the scene complexity corresponding to the video content; determining the coding structure parameter according to the scene complexity, wherein the scene complexity and the coding structure parameter have a corresponding relationship, the coding structure parameter comprises a group of pictures (GOP) length, an intra picture (IPB) frame arrangement structure, and a reference frame number; and performing video coding according to the determined coding structure parameter. The method is used to improve the adaptive ability of the coding structure to a static scene, a high dynamic scene and a scene switching, and to balance the compression efficiency, the picture quality stability and the code rate control effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of video coding, and in particular to a method for adjusting dynamic coding structure parameters and an electronic device. Background Technology

[0002] Existing video coding typically employs a pre-defined Group of Pictures (GOP) structure, combined with inter-frame prediction to achieve video compression.

[0003] However, a fixed GOP structure remains unchanged during the encoding process, making it difficult to adapt in real time to changes in video content. This results in limited compression efficiency in static scenes and an accumulation of prediction errors in dynamic scenes.

[0004] Therefore, how to improve the scene adaptability of the encoding structure according to changes in video content, so as to balance encoding efficiency, image quality stability and bitrate control, has become a technical problem that needs to be solved. Summary of the Invention

[0005] This application provides a method and electronic device for adjusting dynamic coding structure parameters, which solves the problem that the coding structure is difficult to effectively adapt to changes in content during video coding, thereby improving the adaptability of the coding structure to different video scenarios.

[0006] In a first aspect, embodiments of this application provide a method for adjusting dynamic coding structure parameters, including:

[0007] Determine the scene complexity corresponding to the video content;

[0008] The coding structure parameters are determined based on the scene complexity, wherein the scene complexity and the coding structure parameters are related, and the coding structure parameters include the length of the group of pictures (GOP), the arrangement structure of the IPB frames, and the number of reference frames.

[0009] Video encoding is performed based on the determined encoding structure parameters.

[0010] In one possible embodiment, a comprehensive complexity value is calculated based on the complexity index corresponding to the video content, wherein the complexity index includes at least one of motion feature index, texture feature index, scene change feature index, encoding feature index, and bitrate feature index.

[0011] The scene complexity is determined based on the comprehensive complexity value.

[0012] In one possible embodiment, calculating the comprehensive complexity value based on the complexity index corresponding to the video content includes:

[0013] The complexity indicators are weighted and fused according to preset weights to generate a comprehensive complexity value; the comprehensive complexity value is updated frame-by-frame according to a single-frame encoding cycle; wherein:

[0014] The motion characteristic index is calculated based on the horizontal and vertical components of the motion vector of the coded block.

[0015] And / or, the texture feature index is calculated based on the sum of the absolute differences after transformation of each of the coded blocks;

[0016] And / or, the scene change feature index is calculated based on the brightness histogram of adjacent video frames.

[0017] In one possible embodiment, different scene complexities correspond to different ranges of comprehensive complexity values; determining the scene complexity based on the comprehensive complexity value specifically includes:

[0018] The scene complexity is determined based on the range of values ​​for the overall complexity value; where the higher the scene complexity, the larger the upper limit of the range of values ​​for the corresponding overall complexity value.

[0019] In one possible embodiment, the video encoding based on the determined encoding structure parameters includes:

[0020] The number of consecutive cycles in which the scene complexity is maintained is determined based on the statistical period; the statistical period is the single-frame encoding completion cycle.

[0021] If the number of consecutive cycles exceeds a first preset threshold, then at least one of the reference frame number and quantization parameter QP is adjusted.

[0022] If the number of consecutive cycles exceeds the second preset threshold, the length of the Group of Pictures (GOP) and the arrangement of IPB frames are switched, and the second preset threshold is greater than the first preset threshold.

[0023] In one possible embodiment, the method for adjusting the number of reference frames includes:

[0024] Based on the scene complexity, a corresponding range of reference frame count values ​​is determined; wherein, different scene complexities correspond to different ranges of reference frame count values; the higher the scene complexity, the smaller the upper limit of the corresponding range of reference frame count values.

[0025] Select a reference frame number value from the determined range of reference frame number values;

[0026] And / or,

[0027] The step of determining the number of consecutive periods for which the scene complexity is maintained based on the statistical period includes:

[0028] Obtain the scenario complexity for the current statistical period and the scenario complexity for the previous period;

[0029] If the complexity of the current statistical period scenario is the same as that of the previous period scenario, increment the consecutive period number by 1;

[0030] If the complexity of the current statistical period scenario is different from that of the previous period scenario, the number of consecutive periods will be set to zero.

[0031] In one possible embodiment, before performing video encoding based on the determined encoding structure parameters, the method further includes:

[0032] Calculate bitrate fluctuations and quantization parameter fluctuations;

[0033] A feedback indicator is generated based on the bitrate fluctuation and the quantization parameter fluctuation.

[0034] If the feedback indicator exceeds the third preset threshold, then return to the step of determining the scene complexity corresponding to the video content.

[0035] In one possible embodiment, the video encoding based on the determined encoding structure parameters includes:

[0036] If the feedback index does not exceed the third preset threshold, then video encoding is performed according to the determined encoding structure parameters.

[0037] In one possible embodiment, before performing video encoding according to the determined encoding structure parameters, the method includes: determining the scene category of the video content;

[0038] Load the corresponding encoding structure parameters according to the scene category.

[0039] Secondly, embodiments of this application provide a dynamic coding structure parameter adjustment device, comprising:

[0040] The first determining module is used to determine the scene complexity corresponding to the video content;

[0041] The second determining module is used to determine the coding structure parameters based on the scene complexity, wherein the scene complexity and the coding structure parameters have a corresponding relationship, and the coding structure parameters include the length of the group of images (GOP), the arrangement structure of the IPB frames, and the number of reference frames.

[0042] The encoding module is used to perform video encoding according to the determined encoding structure parameters.

[0043] Thirdly, embodiments of this application provide an electronic device, including: a processor, and a memory communicatively connected to the processor;

[0044] The memory stores instructions that the computer executes;

[0045] The processor executes computer execution instructions stored in memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.

[0046] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.

[0047] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.

[0048] The dynamic coding structure parameter adjustment method and electronic device provided in this application determine the scene complexity corresponding to the video content; determine the coding structure parameters based on the scene complexity, wherein there is a corresponding relationship between the scene complexity and the coding structure parameters, and the coding structure parameters include the group of pictures (GOP) length, the IPB frame arrangement structure, and the number of reference frames; video coding based on the determined coding structure parameters enables the coding structure to be adapted to changes in video content, thereby taking into account coding efficiency, image quality stability, and bitrate control effect in different scenarios. Attached Figure Description

[0049] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0050] Figure 1 A flowchart illustrating a dynamic coding structure parameter adjustment method provided in this application;

[0051] Figure 2 A flowchart illustrating another dynamic coding structure parameter adjustment method provided in this application;

[0052] Figure 3 A flowchart illustrating a multi-level image stabilization method provided in this application;

[0053] Figure 4 A schematic diagram of a dynamic coding structure parameter adjustment device provided in this application;

[0054] Figure 5 This application provides a schematic diagram of the structure of an electronic device.

[0055] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation

[0056] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this application.

[0057] First, let me explain the terms used in this application:

[0058] A Group of Pictures (GOP) is a group of consecutive images. In MPEG encoding, images (i.e., frames) are divided into three types: Intra-coded frames (I-frames), Predicted frames (P-frames), and Bidirectional predicted frames (B-frames).

[0059] Intra-coded frame (I-frame): refers to an encoding method that compresses and encodes only the image information of a single frame, without referencing any other frame data before or after it. It serves as the starting reference frame for a group of images (GOP) and can directly decode the complete image. It is the basis for random playback, resume playback, and screen refresh in video streams.

[0060] Forward predicted frame (P-frame): refers to a method of motion prediction and interpolation coding based solely on frames that have already been decoded before the frame.

[0061] Bidirectional predictive frame (B-frame): refers to a coding method that combines the coded frames on both sides to achieve bidirectional predictive coding, resulting in a high compression ratio.

[0062] Video coding technology is widely used in scenarios such as cameras, video conferencing terminals, live streaming equipment, action cameras and drone image transmission equipment. It requires compression of continuous video frames through video acquisition terminals, encoding processing modules and storage or transmission links to meet constraints such as bandwidth, latency and storage costs.

[0063] Existing video coding typically employs a pre-defined fixed GOP structure, combined with inter-frame prediction for compression. Before encoding begins, the user or system usually configures the GOP length and the arrangement of IPB frames, and the established structure is largely followed during subsequent encoding.

[0064] However, existing methods mainly focus on fixed structures, making it difficult to adapt in real time to changes in video content. When the image is static for a long period or has little movement, the fixed structure cannot fully utilize scene redundancy, easily leading to insufficient compression efficiency. When the image has rapid movement, drastic texture changes, or sudden scene changes, the established prediction relationship can easily cause error accumulation, resulting in image quality fluctuations and abnormal increases in bitrate. Especially when static areas and high dynamic areas alternate within the same video stream, it is difficult to balance coding efficiency, image quality stability, and transmission smoothness.

[0065] In view of the above problems, this application provides a dynamic coding structure parameter adjustment method. In a video coding system consisting of a video acquisition end, a coding processing module, and a storage or transmission link, a multi-dimensional complexity index is calculated based on the motion characteristics, texture characteristics, and scene change characteristics of the video content. A comprehensive complexity value is generated based on the multi-dimensional complexity index, and the coding structure parameters are adjusted according to the comprehensive complexity value. This enables the coding prediction method and resource allocation to be adaptively adjusted with scene changes, so as to balance coding efficiency, image quality stability, and bitrate control.

[0066] The executing entity of this dynamic coding structure adjustment method is, for example, an adjustment system. Optionally, the adjustment system can be any existing electronic device with processing capabilities, such as a terminal or a server. In some embodiments, the adjustment system can also be deployed in a server cluster or cloud environment. This application does not limit the deployment environment of the adjustment system.

[0067] The technical solution of this application and how it solves the above-mentioned technical problems will be described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will be described below with reference to the accompanying drawings.

[0068] Figure 1 A flowchart illustrating a dynamic coding structure adjustment method provided in this application is shown below. Figure 1 As shown, the method includes:

[0069] S101, Determine the scene complexity corresponding to the video content.

[0070] In one possible implementation, the adjustment system can calculate a comprehensive complexity value based on the complexity metrics corresponding to the video content. These complexity metrics include at least one of motion feature metrics, texture feature metrics, scene change feature metrics, coding feature metrics, and bitrate feature metrics. The scene complexity is then determined based on the comprehensive complexity value.

[0071] For example, the video content can be the original captured frames or a pre-processed sequence of frames to be encoded.

[0072] For example, motion features are used to characterize the degree of dynamic change in the image, and a quantitative result reflecting the strength of motion is formed by statistically analyzing motion-related information in the video content; texture features are used to characterize the texture complexity of the image, and a quantitative result reflecting the complexity of details is formed by calculating texture-related information in the video content; scene change features are used to characterize scene switching or drastic scene changes, and a quantitative result reflecting the degree of abrupt change is formed by comparing the overall differences between adjacent frames.

[0073] For example, coding feature metrics can be statistical parameters output during intra-frame and inter-frame mode decision-making processes. These may include the proportion of skipped mode coding blocks (i.e., Skip ratio), the proportion of merged mode coding blocks (i.e., Merge ratio), and the recursive partitioning depth of coding units (i.e., CU splitting depth).

[0074] For example, bitrate characteristic metrics can be closed-loop operational data used to characterize the fluctuation of the actual encoding load, such as the actual bitrate, the inter-frame fluctuation of quantization parameters (i.e., QP fluctuation), and the real-time capacity occupancy percentage of the encoding output buffer (i.e., buffer occupancy rate). Optionally, when the video content is in a static state for a long time, motion characteristics and scene change characteristics remain at a low level; when there is a large-scale rapid movement or sudden shot changes, motion characteristics and scene change characteristics increase accordingly.

[0075] In one possible implementation, the adjustment system can perform weighted fusion of various complexity indicators according to preset weights to generate a comprehensive complexity value, wherein the comprehensive complexity value is updated frame by frame in a single-frame encoding cycle.

[0076] For example, motion feature indices are calculated based on the horizontal and vertical components of the motion vector of the coded block.

[0077] For example, the texture feature index is calculated based on the sum of the absolute differences after transformation of each coded block.

[0078] For example, scene change feature indicators are calculated based on the brightness histograms of adjacent video frames.

[0079] Optionally, the adjustment system can statistically analyze the horizontal and vertical motion vector components of the video content to generate motion features, calculate the sum of the absolute transformation coefficients of the intra-frame prediction residuals of the video content to generate texture features, and compare the difference between the brightness histograms of the current frame and the previous frame to generate scene change features.

[0080] Optionally, the adjustment system can divide the video frame into coded blocks and extract motion vectors, and statistically analyze the horizontal and vertical motion vector components of each coded block. Then, the components are summarized according to preset weights to form motion features. When there is unidirectional motion in the picture, the statistical results can directly reflect the main direction and intensity of the motion.

[0081] Optionally, during the generation of texture features, the adjustment system can perform intra-frame prediction on the current frame, transform the intra-frame prediction residuals, and sum the absolute values. The sum of the absolute transformation coefficients of the resulting intra-frame prediction residuals is used as the texture complexity of the current frame or the current region.

[0082] Optionally, during the generation of scene change features, the adjustment system can separately count the brightness distribution frequency of the current frame and the previous frame, calculate the difference between the brightness histograms of the two frames in each brightness interval, and then summarize the differences to obtain the scene change amount and output the scene change features.

[0083] Optionally, after acquiring motion features, texture features, scene change features, encoding features, and bitrate features, the adjustment system can map each feature to the same numerical range, and then perform linear weighted fusion according to preset weights to obtain a comprehensive complexity value.

[0084] Optionally, when motion features indicate strong displacement of the image while texture features are low, the adjustment system can increase the weight corresponding to motion features; when the image details are dense and the texture undulations are obvious, the adjustment system can increase the weight corresponding to texture features; when the brightness histograms of adjacent frames differ significantly, the adjustment system can increase the weight corresponding to scene change features.

[0085] Optionally, the aforementioned weights can be written in configuration files, coding structure parameter tables, or control instructions in practical applications. In practical applications, other implementation methods can also be selected for this weight setting, and this application does not limit this.

[0086] By fusing motion feature indicators, texture feature indicators, scene change feature indicators, encoding feature indicators, and bitrate feature indicators according to preset weights, the dynamics of the scene, the richness of detail, and the content switching characteristics can be reflected in a single indicator, thereby providing an input basis for the adaptive adjustment of encoding structure parameters.

[0087] By adopting this approach, the overall complexity can more completely represent different types of video content, reduce the judgment bias caused by single feature distortion, keep the subsequent adjustment of coding structure parameters consistent with content changes, thereby improving the adaptability of the coding structure to complex scenes, and making bitrate allocation and image quality control more stable, thus providing a more comprehensive and reliable input for dynamically adjusting coding structure parameters.

[0088] In some embodiments, different scene complexities correspond to different ranges of comprehensive complexity values. The adjustment system can determine the scene complexity based on the range of comprehensive complexity values ​​in which the comprehensive complexity value falls; wherein, the higher the scene complexity, the larger the upper limit of the corresponding range of comprehensive complexity values.

[0089] For example, the complexity of different scenarios can be low, medium, and high.

[0090] Optionally, the adjustment system can compare the obtained comprehensive complexity value with preset upper and lower thresholds T2 and T1 to determine the scene complexity level. For example, if the comprehensive complexity value ≤ T1, the adjustment system can determine it as a low scene complexity level; if T1 < comprehensive complexity value < T2, the adjustment system can determine it as a medium scene complexity level; if the comprehensive complexity value ≥ T2, the adjustment system can determine it as a high scene complexity level. For example, the adjustment system can also obtain the lower threshold T1 based on the difference between the mean and the standard deviation, and obtain the upper threshold T2 based on the sum of the mean and the standard deviation.

[0091] By using the above method, scene complexity is classified and determined by the range of comprehensive complexity values ​​with increasing gradient upper limit, which improves the objectivity and discriminativeness of video scene complexity identification and provides a basis for adjusting video coding parameters.

[0092] S102, determine the coding structure parameters based on scene complexity. There is a corresponding relationship between scene complexity and coding structure parameters, which include the Group of Pictures (GOP) length, the IPB frame arrangement structure, and the number of reference frames. Optionally, the adjustment system can pre-establish a mapping data table that corresponds one-to-one between scene complexity and coding structure parameters, pre-binding a fixed GOP length, IPB frame arrangement format, and number of reference frames for each complexity level. After calculating the scene complexity corresponding to the current video, the coding structure parameters corresponding to that level are retrieved by looking up the table.

[0093] For example, low complexity can be configured with a GOP length of 120 and an IPB frame arrangement structure of IBBBBPBBBBB; medium complexity can be configured with a GOP length of 60 and an IPB frame arrangement structure of IBBPBBPBB; and high complexity can be configured with a GOP length of 16 and an IPB frame arrangement structure of IPPPPPPP.

[0094] Optionally, for low complexity, the number of reference frames can be set to 4, 5, or 6; for medium complexity, the number of reference frames can be set to 3 or 4; and for high complexity, the number of reference frames can be set to 1 or 2.

[0095] S103, perform video encoding according to the determined encoding structure parameters.

[0096] For example, the coding structure parameters are the final adjustment objects, and their role is to control the prediction method and resource allocation in the video coding process.

[0097] For example, changes in prediction methods are reflected in changes in reference relationships, frame type distribution, and keyframe spacing, while changes in resource allocation are reflected in the reconfiguration of coding resources under different complexity scenarios.

[0098] Optionally, the adjustment system can select the corresponding coding structure parameters based on a preset mapping relationship, and adjust the prediction method and resource allocation during the video encoding process accordingly. After the coding structure parameters are determined, the adjustment system can continue to encode subsequent frames according to the updated coding structure parameters.

[0099] In one possible implementation, the adjustment system can determine the number of consecutive cycles for maintaining scene complexity based on a statistical period, where the statistical period is the single-frame encoding completion cycle. If the number of consecutive cycles exceeds a first preset threshold, the adjustment system can adjust at least one of the number of reference frames and the quantization parameter QP; if the number of consecutive cycles exceeds a second preset threshold, the adjustment system can switch the group of pictures (GOP) length and the IPB frame arrangement structure, where the second preset threshold is greater than the first preset threshold.

[0100] As one possible implementation, the system can obtain the scenario complexity of the current statistical period and the scenario complexity of the previous period; if the scenario complexity of the current statistical period is the same as that of the previous period, the number of consecutive periods is incremented by 1; if the scenario complexity of the current statistical period is different from that of the previous period, the number of consecutive periods is set to zero.

[0101] Optionally, the system can be adjusted by setting a period counter cnt, which compares the current period's scene complexity with the previous period's complexity frame by frame; if the scene complexity remains unchanged, the counter value is incremented by 1; if the level changes, the counter is reset to zero and the cumulative counting restarts.

[0102] Optionally, the adjustment system can preset a first preset threshold M1 (e.g., 3 frame periods) and a second preset threshold M2 (e.g., 5 frame periods), satisfying M2 > M1.

[0103] Optionally, the adjustment system can use a period counter to count the number of consecutive periods for this level based on the statistical period. If the cumulative number of consecutive periods reaches M1, the adjustment system can determine that the scene complexity level has temporarily stabilized, and only adjust the number of reference frames and the quantization parameter QP, keeping the GOP length and IPB frame arrangement unchanged. If the cumulative number of consecutive periods reaches the threshold M2, the adjustment system can determine that the scene complexity level has long stabilized, and perform a complete switch and reconfiguration of the image group GOP length and IPB frame arrangement structure.

[0104] For example, if the cumulative number of consecutive cycles of the counter reaches M1, the scenario complexity is high. Adjusting the system can reduce the QP value, shrink the quantization step size, and suppress encoding distortion. If the scenario complexity is low, adjusting the system can moderately increase the QP value, improve the compression ratio, and save storage and transmission bandwidth.

[0105] Through the above processing, brief fluctuations in the overall complexity value will not directly trigger switching of the coding structure parameters, thereby reducing the probability of false triggering and making the changes in the coding structure parameters more consistent with the continuous changes in the video content, thus improving the stability and consistency of coding control.

[0106] In some embodiments, the adjustment system can determine the corresponding range of reference frame count values ​​based on scene complexity; different scene complexities correspond to different ranges of reference frame count values; the higher the scene complexity, the smaller the upper limit of the corresponding range of reference frame count values. Reference frame count values ​​are then selected from the determined range of reference frame count values.

[0107] Optionally, a smaller upper limit for the number of reference frames in high-complexity scenarios can reduce motion estimation computation and ensure real-time coding performance; a higher upper limit for the number of reference frames in low-complexity scenarios allows the system to rely on multiple frame references to improve inter-frame prediction accuracy and reduce the overall bitrate.

[0108] Optionally, the adjustment system can obtain different ranges of reference frame counts corresponding to different scene complexities based on a preset mapping table between scene complexity and reference frame count. For example, the adjustment system can take the largest integer in the range of reference frame counts corresponding to scene complexity as the reference frame count value.

[0109] Optionally, the adjustment system can calculate the processor utilization rate based on the scene complexity. If the processor utilization rate exceeds the computing power threshold, the adjustment system can determine that the load is too high and select the smallest integer in the range of corresponding reference frame number values ​​as the reference frame number value.

[0110] By determining the range of reference frame count values ​​corresponding to different scene complexities, the parameter adaptability can be improved, providing a basis for subsequent video encoding, thereby enhancing compression efficiency and bitrate stability.

[0111] In one possible implementation, before video encoding is performed based on the determined encoding structure parameters, the system can calculate bitrate fluctuations and quantization parameter fluctuations, generate feedback indicators, and if the feedback indicators exceed a third preset threshold, return to the step of determining the scene complexity corresponding to the video content.

[0112] Optionally, before video encoding based on the determined encoding structure parameters, the system can read the output bitrate, target bitrate, and quantization parameter changes within the current encoding cycle, and calculate the absolute value of the bitrate deviation and the absolute value of the quantization parameter increment within a preset statistical window, thereby forming a feedback indicator.

[0113] Optionally, the third preset threshold can be set in relation to the scene complexity. When the bit rate fluctuation continues to increase and the quantization parameters fluctuate frequently in a high-complexity scene, the feedback indicator will rise rapidly and exceed the threshold.

[0114] Optionally, the adjustment system can statistically analyze the bitrate fluctuation of each I-frame, P-frame, and B-frame as bitrate fluctuation, and use the absolute value of the QP difference between adjacent frames as quantization parameter fluctuation. The bitrate fluctuation and quantization parameter fluctuation are then fused together using a linear weighted method to obtain a feedback index. Alternatively, the adjustment system can also calculate the feedback index by performing Euclidean norm calculations on the bitrate fluctuation and quantization parameter fluctuation.

[0115] Optionally, if the feedback metric exceeds a third preset threshold, the adjustment system can re-execute the operation to determine the scene complexity corresponding to the video content. For example, the adjustment system can also preset a maximum number of iterations; if the number of times the adjustment system re-executes the operation to determine the scene complexity corresponding to the video content exceeds the maximum number of iterations, the adjustment system can issue an alarm.

[0116] In some embodiments, if the feedback metric does not exceed a third preset threshold, video encoding is performed according to the determined encoding structure parameters.

[0117] Using the above method, before video encoding is performed according to the determined encoding structure parameters, a feedback index is generated based on the calculated bitrate fluctuation and quantization parameter fluctuation. If the feedback index exceeds the third preset threshold, the scene complexity determination is re-executed to correct the parameter deviation caused by the complexity misjudgment from the root. If the feedback index does not exceed the third preset threshold, video encoding is performed according to the determined encoding structure parameters to improve the reliability of the encoded output.

[0118] As one possible implementation, the system can determine the scene category of the video content and load the corresponding encoding structure parameters based on the scene category.

[0119] Optionally, the system can identify the scene category corresponding to the input video. Exemplary scenes include indoor static detection scenes, sports scenes, and game scenes. Based on the identified scene category, a pre-built preset encoding parameter library is retrieved. This parameter library pre-configures the optimal encoding parameters for each scene category. Each entry stores a complete set of encoding structure parameters, including the GOP length value, IPB frame arrangement, and the number of reference frames.

[0120] In this application, the scene complexity corresponding to the video content is determined, and the coding structure parameters are determined based on the scene complexity. There is a correspondence between the scene complexity and the coding structure parameters, which include the group of pictures (GOP) length, the IPB frame arrangement structure, and the number of reference frames. Video encoding is then performed based on the determined coding structure parameters. This allows the encoder to adopt the corresponding structure configuration under different video content conditions. This method does not perform only local quantization adjustments under a fixed coding structure, but rather performs real-time adjustments at the coding structure layer, maintaining a balance between coding efficiency, image stability, and bitrate output under continuously changing scene conditions. It should be understood that the above examples are merely illustrative and not limiting.

[0121] Figure 2 A flowchart illustrating another dynamic coding structure parameter adjustment method provided in this application is shown below. Figure 2 As shown, the method includes:

[0122] (1) Read N coded blocks and video frames of the current statistical period.

[0123] (2) Calculate motion complexity (directional refinement);

[0124] Optionally, the motion vector of each coded block is decomposed into horizontal and vertical components and statistically analyzed separately. , , Calculations are performed, in which, .

[0125] in: It can be the horizontal component of the motion vector of the i-th coded block. It can be the vertical component of the motion vector of the i-th coded block; , It can be directional weights, configured according to the scenario (such as drone aerial photography). =0.7、 =0.3; Lifting equipment =0.3、 =0.7; General 0.5 / 0.5).

[0126] Optional, proportional to direction Automatically identify the principal direction and adjust the weights, where It is a very small positive value, used as a term to prevent division by zero in the denominator. For example, If the image has no vertical movement at all, , .

[0127] (3) Through the formula Calculate the texture complexity, where, Let be the SATD value of the i-th coded block.

[0128] (4) Through the formula Calculate the scene change index, where, This is the brightness histogram of the current frame. This is the brightness histogram of the previous frame.

[0129] (5) Through the formula Calculate the overall complexity model, where, For weighting coefficients, and .

[0130] (6) Complexity level classification (dynamic threshold);

[0131] Optional, if If it is judged as low complexity; It is classified as medium complexity; if The complexity is determined to be high, where T1 and T2 are dynamic thresholds.

[0132] Optionally, in high-complexity scenarios, the dynamic threshold T2 can be reduced to make the switching more sensitive, while in low-complexity scenarios, the dynamic threshold T1 can be increased to prevent false triggering.

[0133] Alternatively, the sliding window formula can also be used. Adjust the dynamic threshold, where, Let C be the mean of the overall complexity within the sliding window. Let C be the standard deviation within the sliding window. , For example, a confidence constant. , .

[0134] (7) Dynamic GOP decision-making;

[0135] For example, for low complexity, GOP=120, with the structure IBBBBBPBBBBB; for medium complexity, GOP=60, with the structure IBBPBBPBB; for high complexity, GOP=16, with the structure IPPPPPPP.

[0136] (8) Dynamic reference frame adjustment;

[0137] For example, for low complexity, the number of dynamic reference frames is adjusted to 4 to 6; for medium complexity, the number of dynamic reference frames is adjusted to 3 to 4; for high complexity, the number of dynamic reference frames is adjusted to 1 to 2.

[0138] (9) Multi-level anti-shake mechanism;

[0139] If C<T1, it is determined as low complexity (Low);

[0140] If T1≤C<T2, it is determined as medium complexity (Medium);

[0141] If C≥T2, it is determined as high complexity (High).

[0142] For example, if the level remains continuously for M1=3 cycles, only the dynamic reference frame adjustment and the quantization parameter are adjusted, and the GOP structure remains unchanged. The quantization parameter is used to control the encoding quantization step size, and adjusting this parameter can change the video compression degree to achieve a dynamic trade-off between bit rate and image quality.

[0143] For example, if the level remains continuously for M2=5 cycles (M2>M1), the GOP length and frame structure are switched.

[0144] (10) Through the formula to calculate bit rate feedback optimization, in which, is the deviation value between the actual bit rate and the target bit rate, is the quantization parameter adjustment amount, is the feedback weight coefficient. That is, the encoding adjustment amount to be corrected for the next frame is calculated through the bit rate deviation of the previous frame and the QP variation.

[0145] If R exceeds the threshold Tr, GOP reconstruction is triggered. If R exceeds the threshold Tr, the process returns to recalculate the motion complexity.

[0146] (11) Output encoding parameters and perform video encoding.

[0147] Figure 3 is a schematic flowchart of a multi-level anti-shake method provided in the present application, as Figure 3 shown, the method includes:

[0148] Step 1: Obtain the image complexity level within the current statistical period .

[0149] Step 2: Determine if the complexity level has changed;

[0150] Compare to current level The level saved in the previous period ;

[0151] If the two are not equal (complexity level changes), set the counter cnt to zero and use the current... Update the record value of the previous period, i.e. Then, proceed to the next statistical period.

[0152] If the two are equal (the complexity level remains unchanged), perform the counter increment operation (i.e., cnt = cnt + 1).

[0153] Step 3: Determine whether the counter value is greater than or equal to the threshold M2 (e.g., M2=5);

[0154] If the counter value is greater than or equal to the threshold M2, adjust the GOP length and frame structure, and simultaneously modify the number of reference frames and quantization parameters. After the adjustment is completed, proceed to the next statistical cycle.

[0155] If the counter value is less than the threshold M2, proceed to step 4.

[0156] Step 4: Determine whether the counter value is greater than or equal to the threshold M1 (e.g., M1=3);

[0157] If the counter value is greater than or equal to the threshold M1, only the number of reference frames and the quantization parameters are modified, while the GOP length and frame structure remain unchanged. After the adjustment is completed, the next statistical cycle begins.

[0158] If the counter value is less than the threshold M1, maintain the currently used encoding parameters and enter the next statistical cycle.

[0159] Figure 4 This application provides a schematic diagram of a dynamic coding structure parameter adjustment device, as shown below. Figure 4 As shown, the dynamic coding structure adjustment device 400 provided in this embodiment includes a first determining module 401, a second determining module 402, and an encoding module 403. Wherein:

[0160] The first determining module 401 is used to determine the scene complexity corresponding to the video content;

[0161] The second determining module 402 is used to determine the coding structure parameters based on the scene complexity. There is a corresponding relationship between the scene complexity and the coding structure parameters. The coding structure parameters include the length of the group of pictures (GOP), the arrangement structure of the IPB frames, and the number of reference frames.

[0162] Encoding module 403 is used to perform video encoding according to the determined encoding structure parameters.

[0163] Optionally, the first determining module 401 is further configured to calculate a comprehensive complexity value based on the complexity index corresponding to the video content, wherein the complexity index includes at least one of motion feature index, texture feature index, scene change feature index, coding feature index, and bitrate feature index.

[0164] The scene complexity is determined based on the overall complexity value.

[0165] Optionally, the first determining module 401 is further configured to perform weighted fusion of each complexity index according to preset weights to generate a comprehensive complexity value; the comprehensive complexity value is updated frame by frame with a single frame as the calculation period; wherein:

[0166] Motion characteristic indicators are calculated based on the horizontal and vertical components of the motion vector of the coded block.

[0167] And / or, the texture feature index is calculated based on the sum of the absolute differences after transformation of each coded block;

[0168] And / or, scene change feature indicators are calculated based on the brightness histograms of adjacent video frames.

[0169] Optionally, the first determining module 401 is also used to determine the scene complexity based on the range of comprehensive complexity values ​​corresponding to different scene complexities; wherein the higher the scene complexity, the larger the upper limit of the range of comprehensive complexity values.

[0170] Optionally, the encoding module 403 is also used to determine the number of consecutive cycles for maintaining scene complexity based on the statistical period; the statistical period is the single-frame encoding completion cycle.

[0171] If the number of consecutive cycles exceeds the first preset threshold, then at least one of the reference frame number and quantization parameter QP is adjusted.

[0172] If the number of consecutive cycles exceeds the second preset threshold, the length of the image group GOP and the IPB frame arrangement structure are switched. The second preset threshold is greater than the first preset threshold.

[0173] Optionally, the encoding module 403 is further configured to determine the corresponding range of reference frame counts based on scene complexity; wherein different scene complexities correspond to different ranges of reference frame counts; the higher the scene complexity, the smaller the upper limit of the corresponding range of reference frame counts.

[0174] Select the reference frame number value from the defined range of reference frame number values;

[0175] And / or,

[0176] Obtain the scenario complexity for the current statistical period and the scenario complexity for the previous period;

[0177] If the complexity of the current statistical period is the same as that of the previous period, increment the number of consecutive periods by 1.

[0178] If the complexity of the current statistical period is different from that of the previous period, the number of consecutive periods will be set to zero.

[0179] Optionally, the encoding module 403 is further configured to calculate bitrate fluctuation and quantization parameter fluctuation before performing video encoding based on the determined encoding structure parameters; generate a feedback index based on the bitrate fluctuation and quantization parameter fluctuation; and if the feedback index exceeds a third preset threshold, return to the step of determining the scene complexity corresponding to the video content.

[0180] Optionally, the encoding module 403 is further configured to determine the scene category of the video content before performing video encoding based on the determined encoding structure parameters; and load the corresponding encoding structure parameters based on the scene category.

[0181] Optionally, the encoding module 403 is also used to perform video encoding according to the determined encoding structure parameters if the feedback indicator does not exceed the third preset threshold.

[0182] The dynamic coding structure parameter adjustment device provided in this embodiment can execute the method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described in detail here.

[0183] Figure 5 This application provides a schematic diagram of the structure of an electronic device. For example... Figure 5 As shown, the electronic device 500 provided in this embodiment includes at least one processor 501 and a memory 502. Optionally, the electronic device 500 further includes a communication component 503. The processor 501, memory 502, and communication component 503 are connected via a bus 504.

[0184] In a specific implementation, at least one processor 501 executes computer execution instructions stored in memory 502, causing at least one processor 501 to perform the above-described method.

[0185] The specific implementation process of processor 501 can be found in the above method embodiments, and its implementation principle and technical effect are similar. It will not be repeated here.

[0186] In the above embodiments, it should be understood that the processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in this invention can be directly implemented by a hardware processor, or implemented by a combination of hardware and software modules within the processor.

[0187] The memory may include random access memory (RAM) and may also include non-volatile memory (NVM), such as at least one disk storage device.

[0188] The bus can be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. Buses can be categorized as address buses, data buses, control buses, etc. For ease of illustration, the buses shown in the accompanying drawings are not limited to a single bus or a single type of bus.

[0189] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the above-described method.

[0190] This application also provides a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the above-described method.

[0191] The aforementioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk. The readable storage medium can be any available medium accessible to a general-purpose or special-purpose computer.

[0192] An exemplary readable storage medium is coupled to a processor, enabling the processor to read information from and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can reside in an Application Specific Integrated Circuit (ASIC). Alternatively, the processor and the readable storage medium can exist as discrete components in the device.

[0193] The division of units is merely a logical functional division; in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.

[0194] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0195] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0196] If a function is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0197] Those skilled in the art will understand that all or part of the steps of the above-described method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above-described method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0198] Finally, it should be noted that other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the art not disclosed herein, and is not limited to the precise structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope.

Claims

1. A method for adjusting dynamic coding structure parameters, characterized in that, include: Determine the scene complexity corresponding to the video content; The coding structure parameters are determined based on the scene complexity, wherein the scene complexity and the coding structure parameters are related, and the coding structure parameters include the length of the group of images (GOP), the arrangement structure of the IPB frames, and the number of reference frames. Video encoding is performed based on the determined encoding structure parameters.

2. The method according to claim 1, characterized in that, Determining the scene complexity corresponding to the video content includes: The comprehensive complexity value is calculated based on the complexity index corresponding to the video content, wherein the complexity index includes at least one of motion feature index, texture feature index, scene change feature index, encoding feature index, and bitrate feature index. The scene complexity is determined based on the comprehensive complexity value.

3. The method according to claim 2, characterized in that, The step of calculating the comprehensive complexity value based on the complexity index corresponding to the video content includes: The complexity indicators are weighted and fused according to preset weights to generate a comprehensive complexity value; the comprehensive complexity value is updated frame-by-frame according to a single-frame encoding cycle; wherein: The motion characteristic index is calculated based on the horizontal and vertical components of the motion vector of the coded block. And / or, the texture feature index is calculated based on the sum of the absolute differences after transformation of each of the coded blocks; And / or, the scene change feature index is calculated based on the brightness histogram of adjacent video frames.

4. The method according to claim 2, characterized in that, Different scenario complexities correspond to different ranges of comprehensive complexity values; determining the scenario complexity based on the comprehensive complexity value specifically includes: The scene complexity is determined based on the range of values ​​for the overall complexity value; where the higher the scene complexity, the larger the upper limit of the range of values ​​for the corresponding overall complexity value.

5. The method according to claim 1, characterized in that, The step of performing video encoding according to the determined encoding structure parameters includes: The number of consecutive cycles in which the scene complexity is maintained is determined based on the statistical period; the statistical period is the single-frame encoding completion cycle. If the number of consecutive cycles exceeds a first preset threshold, then at least one of the reference frame number and quantization parameter QP is adjusted. If the number of consecutive cycles exceeds the second preset threshold, the length of the Group of Pictures (GOP) and the arrangement of IPB frames are switched, and the second preset threshold is greater than the first preset threshold.

6. The method according to claim 5, characterized in that, The method for adjusting the number of reference frames includes: Based on the scene complexity, a corresponding range of reference frame count values ​​is determined; wherein, different scene complexities correspond to different ranges of reference frame count values; the higher the scene complexity, the smaller the upper limit of the corresponding range of reference frame count values. Select a reference frame number value from the determined range of reference frame number values; And / or, The step of determining the number of consecutive periods for which the scene complexity is maintained based on the statistical period includes: Obtain the scenario complexity for the current statistical period and the scenario complexity for the previous period; If the complexity of the current statistical period scenario is the same as that of the previous period scenario, increment the consecutive period number by 1; If the complexity of the current statistical period scenario is different from that of the previous period scenario, the number of consecutive periods will be set to zero.

7. The method according to any one of claims 1-6, characterized in that, Before performing video encoding based on the determined encoding structure parameters, the method further includes: Calculate bitrate fluctuations and quantization parameter fluctuations; A feedback indicator is generated based on the bitrate fluctuation and the quantization parameter fluctuation. If the feedback indicator exceeds the third preset threshold, then return to the step of determining the scene complexity corresponding to the video content.

8. The method according to claim 7, characterized in that, The step of performing video encoding according to the determined encoding structure parameters includes: If the feedback index does not exceed the third preset threshold, then video encoding is performed according to the determined encoding structure parameters.

9. The method according to claim 1, characterized in that, Before performing video encoding based on the determined encoding structure parameters, the method includes: Determine the scene category of the video content; Load the corresponding encoding structure parameters according to the scene category.

10. An electronic device, characterized in that, include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory, causing the processor to perform the method as described in any one of claims 1-9.