Code rate control method and device, electronic equipment, storage medium and program product
By dividing the video sequence into multiple image groups and using linear models to predict the bit rate and dynamically update the model parameters, the problem of dynamic bit rate allocation in the prior art increases resource consumption and delay is solved, and efficient variable bit rate is achieved Bit rate control.
Patent Information
- Application Number
- CN202411462486.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-18
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-10-18
AI Technical Summary
In the existing video encoding technology, the dynamic bit rate allocation method requires a pre-processing module, which leads to increased resource consumption and delay and increased hardware costs.
By dividing the video sequence into multiple image groups, each image group including continuous multi-frame images, the predicted bit rate of the predicted frames in each image group is predicted using a linear model, and the model parameters are dynamically updated to achieve variable bit rate Bit rate control.
Without significantly increasing resource consumption and delay, variable bit rate control of video sequences is realized, avoiding increasing hardware costs.
Smart Images

Figure CN119402655A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video coding technology, and in particular to a rate control method, device, electronic device, storage medium and program product. Background Art
[0002] Video coding is mainly to reduce the required storage space and transmission bandwidth by compressing video data. In the process of video coding, bit rate control is a key point, which can affect the image quality and compression efficiency of the compressed video.
[0003] In the related art, dynamic bit rate allocation is used for bit rate control. This method requires a pre-preprocessing module to analyze the difference between the front and rear frames of the image, so as to allocate different bit rates to the image frames according to the changes in the image picture. However, when the pre-preprocessing module performs image analysis on the image frames, the end-to-end delay will be increased, and under the same hardware performance, adding a pre-preprocessing module will introduce additional resource consumption or increase additional hardware costs. Summary of the invention
[0004] In order to overcome the problems existing in the related art, the present disclosure provides a rate control method, device, electronic device, storage medium and program product to achieve variable bit rate rate control without significantly increasing resource consumption and delay.
[0005] According to a first aspect of an embodiment of the present disclosure, a rate control method is provided, comprising: dividing a video sequence into a plurality of image groups, each image group comprising a plurality of frames of images that are continuous in time; determining a predicted rate corresponding to each image group and a first parameter of each image group, the first parameter being a slope of a linear model, the linear model being used to predict a predicted rate of an i-th predicted frame in each image group, i being an integer greater than 1; determining a predicted rate of a first predicted frame in each image group according to the predicted rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group; for an i-th predicted frame in each image group, performing the following steps: updating a second parameter of an i-th predicted frame based on a second parameter of an i-1-th predicted frame in each image group, the predicted rate of all predicted frames in the first i-1 predicted frames, the actual rate of all predicted frames, and the number of frames of the plurality of frames of images included in each image group, the second parameter being an intercept of the linear model; determining a predicted rate corresponding to an i-th predicted frame of each image group according to the first parameter of each image group, the predicted rate of an i-1-th predicted frame of each image group, and the second parameter of an i-th predicted frame of each image group.
[0006] In some embodiments, the predicted bit rate corresponding to the i-th predicted frame of each image group is determined based on the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group, and the second parameter of the i-th predicted frame of each image group, including: obtaining a first product between the first parameter of each image group and the predicted bit rate of the i-1th predicted frame of each image group; summing the first product and the second parameter of the i-th predicted frame of each image group to obtain the predicted bit rate corresponding to the i-th predicted frame of each image group.
[0007] In some embodiments, determining the first parameter of each image group includes: for the first image group, determining a first preset value as the first parameter of the first image group; for the non-first image group, determining the first parameter of the non-first image group based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group.
[0008] In some embodiments, the first parameter of the non-first image group is determined based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group, including: obtaining the second product of the first parameter of the previous image group of the non-first image group and the actual bit rate of the previous image group; dividing the second product by the predicted bit rate of the previous image group to obtain the first parameter of the non-first image group.
[0009] In some embodiments, based on the second parameter of the i-1th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames, and the number of frames of multiple frames included in each image group, the second parameter of the i-th predicted frame is updated, including: determining the bit rate difference of all predicted frames based on the predicted bit rates of all predicted frames in the first i-1 predicted frames and the actual bit rates of all predicted frames; dividing the bit rate difference by the number of frames of multiple frames included in each image group to obtain the average bit rate difference of all predicted frames; obtaining the sum of the second parameter of the i-1th predicted frame in each image group and the average bit rate difference to obtain the second parameter of the i-th predicted frame; wherein the second parameter of the first predicted frame is a second preset value.
[0010] In some embodiments, the predicted bit rate corresponding to each image group is determined, including: for the first image group, the predicted bit rate corresponding to the first image group is determined based on a first preset bit rate, the number of frames and the frame rate of multiple frames of images included in the first image group; for the non-first image group, the predicted bit rate corresponding to the non-first image group is determined based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, the second preset bit rate is greater than the first preset bit rate, and the first preset bit rate is greater than the third preset bit rate.
[0011] In some embodiments, the predicted bit rate corresponding to the non-first image group is determined based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, including: obtaining the difference between the second preset bit rate and the third preset bit rate; obtaining the third product of the average intra-frame macroblock coding ratio and the difference; summing the third product and the third preset bit rate to obtain the predicted bit rate corresponding to the non-first image group.
[0012] In some embodiments, the above method also includes: obtaining the ratio value of the intra-frame coded macroblocks of each predicted frame in the previous picture group other than the first picture group in all coded macroblocks; determining the average intra-frame macroblock coding ratio of the previous picture group other than the first picture group based on the ratio value and the number of frames of multiple frames included in the previous picture group.
[0013] According to a second aspect of an embodiment of the present disclosure, a bit rate control device is provided, comprising: a division module, configured to divide a video sequence into a plurality of image groups, each image group comprising a plurality of frames of images that are continuous in time; a first determination module, configured to determine a predicted bit rate corresponding to each image group and a first parameter of each image group, the first parameter being a slope of a linear model, the linear model being used to predict a predicted bit rate of an i-th predicted frame in each image group, i being an integer greater than 1; a second determination module, configured to determine, based on the predicted bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group, a first parameter of each image group; a first parameter of each image group being used to predict a predicted bit rate of an i-th predicted frame in each image group, wherein i is an integer greater than 1; and a second determination module, configured to determine, based on the predicted bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group, a first parameter of each image group. A predicted bit rate of a predicted frame; a third determination module is configured to perform the following steps for the i-th predicted frame in each image group: based on the second parameter of the i-1-th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames and the number of frames of the multi-frame image, update the second parameter of the i-th predicted frame, the second parameter being the intercept of the linear model; and determine the predicted bit rate corresponding to the i-th predicted frame of each image group according to the first parameter of each image group, the predicted bit rate of the i-1-th predicted frame of each image group and the second parameter of the i-th predicted frame of each image group.
[0014] In some embodiments, the third determination module is configured to: obtain a first product between a first parameter of each image group and a predicted bit rate of an i-1th predicted frame of each image group; sum the first product and a second parameter of an i-th predicted frame of each image group to obtain a predicted bit rate corresponding to an i-th predicted frame of each image group.
[0015] In some embodiments, the first determination module includes a first determination submodule and a second determination submodule; the first determination submodule is configured to: for the first image group, determine the first preset value as the first parameter of the first image group; the second determination submodule is configured to: for the non-first image group, determine the first parameter of the non-first image group based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group.
[0016] In some embodiments, the second determination submodule is configured to: obtain the second product of the first parameter of the previous image group other than the first image group and the actual bit rate of the previous image group; divide the second product by the predicted bit rate of the previous image group to obtain the first parameter of the non-first image group.
[0017] In some embodiments, the third determination module is configured to: determine the rate difference of all predicted frames based on the predicted bit rates of all predicted frames in the first i-1 predicted frames and the actual bit rates of all predicted frames; divide the rate difference by the number of frames of the multi-frame images included in each image group to obtain the average rate difference of all predicted frames; obtain the sum of the second parameter of the i-1th predicted frame in each image group and the average bit rate difference to obtain the second parameter of the i-1th predicted frame; wherein the second parameter of the first predicted frame is a second preset value.
[0018] In some embodiments, the first determination module also includes a third determination submodule and a fourth determination submodule; the third determination submodule is configured as: for the first image group, based on the first preset bit rate, the number of frames of multiple frames included in the first image group, and the frame rate, determine the predicted bit rate corresponding to the first image group; the fourth determination submodule is configured as: for the non-first image group, based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, determine the predicted bit rate corresponding to the non-first image group, the second preset bit rate is greater than the first preset bit rate, and the first preset bit rate is greater than the third preset bit rate.
[0019] In some embodiments, the fourth determination submodule is configured to: obtain the difference between the second preset bit rate and the third preset bit rate; obtain the third product of the average intra-frame macroblock coding ratio and the difference; sum the third product and the third preset bit rate to obtain the predicted bit rate corresponding to the non-first image group.
[0020] In some embodiments, the above-mentioned device also includes: an acquisition module, configured to: obtain the ratio value of the intra-frame coded macroblocks of each predicted frame in the previous image group other than the first image group in all coded macroblocks; a fourth determination module, configured to: determine the average intra-frame macroblock coding ratio of the previous image group other than the first image group based on the ratio value and the number of frames of multiple frames included in the previous image group.
[0021] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; a memory for storing computer programs or instructions; wherein the processor executes the computer program or instructions to implement the steps in any one of the bit rate control methods in the first aspect above.
[0022] According to a fourth aspect of an embodiment of the present disclosure, a non-temporary computer-readable storage medium is provided, wherein the storage medium stores a computer program or instructions. When the computer program or instructions in the storage medium are executed by a processor, the steps in any one of the bit rate control methods in the first aspect are implemented.
[0023] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, including a computer program or instructions, which, when executed by a processor, implements the steps in any one of the bit rate control methods in the first aspect.
[0024] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0025] The method divides a video sequence into a plurality of image groups, each of which includes a plurality of frames of images that are continuous in time; determines a predicted bit rate corresponding to each image group and a first parameter of each image group, wherein the first parameter is a slope of a linear model, and the linear model is used to predict a predicted bit rate of an i-th predicted frame in each image group, wherein i is an integer greater than 1; determines a predicted bit rate of a first predicted frame in each image group according to the predicted bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group; performs the following steps for an i-th predicted frame in each image group: updates a second parameter of an i-1-th predicted frame in each image group, wherein the second parameter is an intercept of a linear model; determines a predicted bit rate corresponding to an i-th predicted frame in each image group according to the first parameter of each image group, the predicted bit rate of an i-1-th predicted frame in each image group, and the second parameter of an i-th predicted frame in each image group. In this way, the predicted bit rate of the next predicted frame is determined based on the predicted bit rate of the previous predicted frame, the first parameter and the second parameter of the linear model, so that the variable bit rate control of the predicted frame can be achieved. At the same time, since this solution does not involve a pre-processing module, it will not introduce additional resource consumption and delay, and will not increase hardware costs.
[0026] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0028] Figure 1 is a flow chart of a rate control method according to an exemplary embodiment;
[0029] Figure 2 is a schematic diagram showing an image group according to an exemplary embodiment;
[0030] Figure 3 is a flow chart of a rate control method according to an exemplary embodiment;
[0031] Figure 4 is a block diagram of a bit rate control device according to an exemplary embodiment;
[0032] Figure 5 is a structural block diagram of an electronic device 500 according to an exemplary embodiment;
[0033] Figure 6 is a block diagram of a server 600 according to an exemplary embodiment. DETAILED DESCRIPTION
[0034] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices consistent with some aspects of the present disclosure as detailed in the appended claims.
[0035] In the field of video coding technology, there are two main rate control strategies: constant bitrate (CBR) and variable bitrate (VBR), depending on whether the bitrate is consistent within a unit time.
[0036] Bit rate control mainly includes two parts: bit rate allocation and quantization parameter (QP) adjustment. In the bit rate allocation process, there are two main methods: average bit rate allocation and dynamic bit rate allocation.
[0037] Among them, the average bit rate allocation is to divide the preset bit rate (the bit rate is pre-set, and the present disclosure does not limit its value) by the frame rate to obtain the bit rate of each frame of the image. Since the bit rate of each frame of the image is fixed, this will result in a poor quality effect of the encoded image when the scene switches. Therefore, this method is simple but lacks flexibility; dynamic bit rate allocation requires the use of a pre-processing module to analyze the difference between the previous and next frames of the image, so as to allocate different bit rates to each frame of the image according to the changes in the image picture, so as to achieve more flexible bit rate control, that is: dynamic bit rate allocation is to determine whether the image is static or dynamic through the pre-processing module, so as to allocate different bit rates to different images. However, the introduction of the pre-processing module in the encoding process has the following two main disadvantages:
[0038] 1. Introducing delay: The pre-processing module needs to perform image analysis on each frame of the input image, which will increase the end-to-end delay.
[0039] 2. Increased cost: Under the same hardware performance, adding a pre-processing module will introduce additional resource consumption. If it is pre-processed by software, it will increase the burden on the central processing unit (CPU). If it is pre-processed by hardware, it will increase additional hardware costs.
[0040] Figure 1 FIG. 1 is a flow chart of a rate control method according to an exemplary embodiment. Figure 1 As shown, the bit rate control method can be applied to an electronic device, and the method mainly includes the following steps:
[0041] In step 101, a video sequence is divided into a plurality of image groups, each of which includes a plurality of temporally continuous frame images.
[0042] In step 102, a prediction code rate corresponding to each group of pictures and a first parameter of each group of pictures are determined.
[0043] In step 103, the prediction bit rate of the first prediction frame in each image group is determined according to the prediction bit rate corresponding to each image group and the number of frames of the multiple images included in each image group.
[0044] In step 104, the second parameter of the i-th prediction frame is updated based on the second parameter of the i-1-th prediction frame in each image group, the prediction bit rates of all prediction frames in the first i-1 prediction frames, the actual bit rates of all prediction frames, and the number of frames of the multi-frame images included in each image group.
[0045] In step 105, the prediction bit rate corresponding to the i-th prediction frame of each image group is determined according to the first parameter of each image group, the prediction bit rate of the i-1th prediction frame of each image group and the second parameter of the i-th prediction frame of each image group.
[0046] Here, the video sequence can be any coded video sequence. The number of frames of the multiple frames included in each group of pictures (GOP, also called picture group) can be the same, such as the number of frames corresponding to the frame rate (frame per second, fps), or they can be different, and the present disclosure does not limit this. The number of frames of the multiple frames included in each image group can also be called the length of each image group. The first parameter is the slope of the linear model, which is used to predict the predicted bit rate of the i-th predicted frame in each image group, where i is an integer greater than 1. The second parameter is the intercept of the linear model.
[0047] In some embodiments, for step 101, the electronic device may divide the video sequence into multiple image groups according to the number of frames corresponding to fps, or may evenly divide all images included in the video sequence according to a preset number of image groups to obtain multiple image groups, or may divide in other ways, which are not limited in the present disclosure. In this way, each image group obtained includes multiple frames of images that are continuous in time.
[0048] Figure 2 FIG. 1 is a schematic diagram showing an image group according to an exemplary embodiment. Figure 2 As shown, two picture groups are used as an example to explain the picture group. The first picture group includes an intra-coded picture (Intra-coded picture I frame), a first predicted frame (predictive frame, P frame), a second P frame, ..., an mth P frame (m is an integer greater than 2); the second picture group includes an I frame, a first P frame, a second P frame, ..., an nth P frame (n is an integer greater than 2).
[0049] It should be noted that the starting frame in each image group is an I frame. Figure 2 The types of image frames included in the image group shown are only examples, and there may be bidirectionally predicted pictures (B frames) or other types of frames between adjacent P frames, which is not limited in the present disclosure. m and n may be the same or different, which is not limited in the present disclosure.
[0050] In some embodiments, for step 102, in order to predict the bit rate of each predicted frame included in each picture group, it is necessary to first determine the predicted bit rate corresponding to each picture group.
[0051] In some embodiments, for step 103, the predicted bit rate of the first predicted frame in each image group can be obtained through the predicted bit rate corresponding to each image group and the number of frames of multiple images included in each image group.
[0052] In one embodiment, the predicted bit rate corresponding to each image group is divided by the number of frames of the multi-frame images included in each image group to obtain the predicted bit rate of the first predicted frame, as shown in the following formula (1):
[0053]
[0054] Among them, j represents the j-th image group, j is a positive integer; frameBitrate(1,j) represents the predicted bitrate of the first predicted frame of the j-th image group; GopBitrate(j) represents the predicted bitrate corresponding to the j-th image group; GopLen(j) represents the number of frames of the multi-frame images included in the j-th image group.
[0055] In some embodiments, for non-first prediction frames (e.g., the i-th prediction frame) in each group of images, the prediction bit rate of the i-th prediction frame in each group of images can be predicted by a linear model. In this case, it is necessary to determine the first parameter and the second parameter of the linear model, that is, determine the first parameter in step 102 and the second parameter in step 104.
[0056] In some embodiments, for step 104, when the second parameter of the i-th prediction frame is updated, it is necessary to determine the predicted bit rates of all the prediction frames in the first i-1 prediction frames and the actual bit rates of all the prediction frames. When predicting the bit rate of the i-th prediction frame, the predicted bit rates of all the prediction frames in the first i-1 prediction frames (i.e., from the first prediction frame to the i-1 prediction frame) have been predicted, and after encoding all the prediction frames in the first i-1 prediction frames, the actual bit rates of all the prediction frames in the first i-1 prediction frames can be determined according to the encoding results. In this way, according to the second parameter of the i-1th prediction frame in each image group, the predicted bit rates of all the prediction frames in the first i-1 prediction frames, the actual bit rates of all the prediction frames, and the number of frames of the multi-frame images included in each image group, the second parameter of the i-th prediction frame in each image group can be updated to obtain the second parameter of the i-th prediction frame in each image group.
[0057] In some embodiments, for step 105, after determining the second parameter of the i-th prediction frame in each image group, the prediction bit rate of the i-1-th prediction frame of each image group and the second parameter are calculated to determine the prediction bit rate corresponding to the i-th prediction frame of each image group. In this way, for the i-th prediction frame in each image group, after updating the second parameter of the current prediction frame, the prediction bit rate corresponding to the current prediction frame is predicted based on the prediction bit rate of the previous prediction frame and the updated second parameter, so that dynamic bit rate control can be achieved.
[0058] In an embodiment of the present application, a video sequence is divided into a plurality of image groups, and then a predicted bit rate corresponding to each image group and a first parameter of each image group are determined, and based on the predicted bit rate corresponding to each image group and the number of frames of multiple frames included in each image group, the predicted bit rate of the first predicted frame in each image group is determined; for the i-th predicted frame in each image group, based on the second parameter of the i-1-th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames, and the number of frames of multiple frames included in each image group, the second parameter of the i-th predicted frame is updated, and then the predicted bit rate corresponding to the i-th predicted frame of each image group is determined according to the first parameter of each image group, the predicted bit rate of the i-1-th predicted frame of each image group, and the second parameter of the i-th predicted frame of each image group. In this way, the predicted bit rate of the next predicted frame is determined based on the predicted bit rate of the previous predicted frame, the first parameter and the second parameter of the linear model, so that the variable bit rate control of the predicted frame can be achieved. At the same time, since this solution does not involve a pre-processing module, it will not introduce additional resource consumption and delay, and will not increase hardware costs.
[0059] In some embodiments, determining the first parameter of each image group includes: for the first image group, determining a first preset value as the first parameter of the first image group; for the non-first image group, determining the first parameter of the non-first image group based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group.
[0060] It can be understood that the first parameter of the first image group can be expressed by the following formula (2):
[0061] α(j)=a, j=1 (2)
[0062] Among them, α(j) represents the first parameter of the j-th image group; a represents a first preset value, which can be understood as the initial value of the first parameter, which belongs to the model coefficient of the GOP level; the first preset value is an integer or decimal greater than 0, and its value range can be: greater than or equal to 0.1, and less than or equal to 2. This value range is only for exemplary description, and the present disclosure does not make any specific limitation on this.
[0063] Here, the actual bit rates of all the image frames included in the previous image group of the non-first image group can be obtained after encoding these image frames, and the actual bit rate of the previous image group of the non-first image group can be obtained by adding the actual bit rates of all the image frames included in the previous image group. In this way, based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group, the first parameter of the non-first image group can be determined through calculation.
[0064] In some embodiments, the image frame may be encoded by intra-frame encoding, which mainly utilizes spatial redundant information for encoding.
[0065] In some embodiments, the first parameter of the non-first image group is determined based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group, including: obtaining the second product of the first parameter of the previous image group of the non-first image group and the actual bit rate of the previous image group; dividing the second product by the predicted bit rate of the previous image group to obtain the first parameter of the non-first image group.
[0066] It can be understood that after obtaining the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group, the first parameter of the previous image group of the non-first image group is multiplied by the actual bit rate of the previous image group to obtain the product of the two, i.e., the second product; then, the second product is divided by the predicted bit rate of the previous image group to obtain the first parameter of the non-first image group. In this way, by determining the first parameter of the non-first image group in the above manner, the relevant information of the previous image group of the non-first image group (i.e., the first parameter of the previous image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group) is referred to, which can ensure that the change of the first parameter between adjacent image groups will not be too large, avoiding mutation.
[0067] In one embodiment, the process of determining the first parameter of the non-first image group can be expressed by the following formula (3):
[0068]
[0069] Wherein, α(j-1) represents the first parameter of the j-1th image group; realGopBitrate(j-1) represents the actual bitrate of the j-1th image group; GopBitrate(j-1) represents the predicted bitrate of the j-1th image group.
[0070] In some embodiments, based on the second parameter of the i-1th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames, and the number of frames of multiple frames included in each image group, the second parameter of the i-th predicted frame is updated, including: determining the bit rate difference of all predicted frames based on the predicted bit rates of all predicted frames in the first i-1 predicted frames and the actual bit rates of all predicted frames; dividing the bit rate difference by the number of frames of multiple frames included in each image group to obtain the average bit rate difference of all predicted frames; obtaining the sum of the second parameter of the i-1th predicted frame in each image group and the average bit rate difference to obtain the second parameter of the i-th predicted frame; wherein the second parameter of the first predicted frame is a second preset value.
[0071] Here, the bit rate difference of all predicted frames in the first i-1 predicted frames in each picture group can be expressed by the following formula (4):
[0072]
[0073] Among them, biterror(i-1,j) represents the bitrate difference of all predicted frames among the first i-1 predicted frames in the j-th image group; frameBitrate(1,j) represents the predicted bitrate of the first predicted frame in the j-th image group; realframeBitrate(1,j) represents the actual bitrate of the first predicted frame in the j-th image group; frameBitrate(i-1,j) represents the predicted bitrate of the i-1-th predicted frame in the j-th image group; realframeBitrate(i-1,j) represents the actual bitrate of the i-1-th predicted frame in the j-th image group.
[0074] Here, the second parameter of the i-th predicted frame in each picture group can be expressed by the following formula (5):
[0075]
[0076] in, represents the second parameter of the i-th predicted frame in the j-th picture group; Indicates the second parameter of the i-1th prediction frame in the j-th picture group. In this way, by determining the second parameter of the i-th prediction frame in each picture group in the above manner, the second parameter of the current (i-th) prediction frame is dynamically determined according to the encoded previous (i-1th) prediction frame, and the second parameter is used for the bit rate prediction of the current (i-th) prediction frame, which can deepen the connection between the previous and next prediction frames.
[0077] In one example, the second parameter of the first prediction frame in the first picture group can be expressed by the following equation (6):
[0078]
[0079] in, represents the second parameter of the i-th predicted frame in the first image group, b represents the second preset value, which can be understood as the initial value of the second parameter, which belongs to the model coefficient at the frame level; the second preset value is a number greater than 0, and its value range can be: greater than 0 and less than or equal to 50% of frameBitrate(1,1) (representing the predicted bit rate of the first predicted frame in the first image group), and this value range is only for exemplary description, and the present disclosure does not make specific limitations on this.
[0080] In some embodiments, when j>1, the second parameter of the first prediction frame of the non-first picture group, that is, The value of may be the second parameter corresponding to the last predicted frame in the previous image group (i.e., the j-1th image group) that is not the first image group; The value of can also be other numerical values, which is not limited in the present disclosure.
[0081] In some embodiments, the predicted bit rate corresponding to the i-th predicted frame of each image group is determined based on the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group, and the second parameter of the i-th predicted frame of each image group, including: obtaining a first product between the first parameter of each image group and the predicted bit rate of the i-1th predicted frame of each image group; summing the first product and the second parameter of the i-th predicted frame of each image group to obtain the predicted bit rate corresponding to the i-th predicted frame of each image group.
[0082] It can be understood that after obtaining the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group, and the second parameter of the i-th predicted frame of each image group, since the first parameter is the slope of the linear model and the second parameter is the intercept of the linear model, the first parameter of each image group is multiplied by the predicted bit rate of the i-1th predicted frame of each image group to obtain the product of the two, that is, the first product; then, the first product is added to the second parameter of the i-th predicted frame of each image group to obtain the predicted bit rate corresponding to the i-th predicted frame of each image group. In this way, the predicted bit rate corresponding to the current predicted frame is predicted in the above manner, and the predicted bit rate of the previous predicted frame is referred to, so that dynamic bit rate control can be achieved, and the predicted bit rates between the two predicted frames will not differ too much. Moreover, in static scenes, a lower bit rate can be allocated through the first parameter (e.g., the first parameter is relatively low), and in dynamic scenes, a higher bit rate can be allocated through the first parameter (e.g., the first parameter is relatively high), thereby improving the video quality of dynamic scenes while keeping the average bit rate unchanged; or reducing the size of the video while keeping the quality of dynamic scenes unchanged (e.g., static scenes are the main ones and dynamic scenes are the auxiliary ones, in this case, the bit rate of static scenes is small, the bit rate of dynamic scenes is large, the total bit rate is small, and the video size is relatively small), thereby making it more convenient to store and transmit.
[0083] In one embodiment, the process of determining the prediction bit rate corresponding to the i-th prediction frame of each image group can be expressed by the following formula (7):
[0084]
[0085] Wherein, frameBitrate(i,j) represents the predicted bitrate of the i-th predicted frame in the j-th image group; α(j) represents the first parameter corresponding to the j-th image group; frameBitrate(i-1,j) represents the predicted bitrate of the i-1-th predicted frame in the j-th image group; Represents the second parameter of the i-1th predicted frame in the jth picture group.
[0086] In some embodiments, the predicted bit rate corresponding to each image group is determined, including: for the first image group, the predicted bit rate corresponding to the first image group is determined based on a first preset bit rate, the number of frames of multiple frames included in the first image group, and the frame rate; for the non-first image group, the predicted bit rate corresponding to the non-first image group is determined based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate, and the third preset bit rate.
[0087] Here, the first preset bit rate, the second preset bit rate and the third preset bit rate can all be preset bit rate values, and their values can be related to the resolution of the video sequence and the current network scenario. For example, when the resolution is 1080P, the value of the first preset bit rate can be 2 megabits (M) or 3M, and the present disclosure does not limit this. The second preset bit rate (also known as the preset maximum bit rate) is greater than the first preset bit rate, and the first preset bit rate is greater than the third preset bit rate (also known as the preset minimum bit rate). The value of the second preset bit rate can be 2 times or 3 times the first preset bit rate; the value of the third preset bit rate can be half or one third of the first preset bit rate, and the present disclosure does not limit this.
[0088] It can be understood that for the first image group, after determining the first preset bit rate, the number of frames of the multiple frames included in the first image group, and the frame rate, the first preset bit rate is multiplied by the number of frames of the multiple frames included in the first image group to obtain a fourth product, and then the fourth product is divided by the frame rate to obtain the predicted bit rate corresponding to the first image group.
[0089] In one embodiment, the process of determining the predicted bit rate corresponding to the first picture group can be expressed by the following formula (8):
[0090]
[0091] Wherein, GopBitrate1 represents the predicted bit rate of the first image group; TargetBitrate1 represents the first preset bit rate; GopLen(1) represents the number of frames of the multi-frame images included in the first image group; and fps represents the frame rate.
[0092] For a non-first image group, based on the statistical information of each frame in the previous image group of the non-first image group after encoding, that is, the number of intra-frame coded macroblocks and the number of all coded macroblocks in each predicted frame in the previous image group, the average intra-frame macroblock coding ratio can be determined, and then based on the average intra-frame macroblock coding ratio, the second preset bit rate and the third preset bit rate, the predicted bit rate corresponding to the non-first image group can be obtained through calculation. In this way, after determining the predicted bit rate corresponding to the non-first image group, the predicted bit rate of the first predicted frame in the non-first image group can be determined based on the predicted bit rate.
[0093] In some embodiments, the predicted bit rate corresponding to the non-first image group is determined based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, including: obtaining the difference between the second preset bit rate and the third preset bit rate; obtaining the third product of the average intra-frame macroblock coding ratio and the difference; summing the third product and the third preset bit rate to obtain the predicted bit rate corresponding to the non-first image group.
[0094] It can be understood that after determining the average intra-frame macroblock coding ratio, the second preset bit rate and the third preset bit rate of the previous image group other than the first image group, the second preset bit rate is subtracted from the third preset bit rate to obtain the difference between the two; then the average intra-frame macroblock coding ratio is multiplied by the difference to obtain the third product of the two; finally, the third product is added to the third preset bit rate to obtain the predicted bit rate corresponding to the non-first image group.
[0095] In one embodiment, the process of determining the predicted bit rate corresponding to the non-first picture group can be expressed by the following formula (9):
[0096] GopBitrate(j)=avgIntraPercent(j-1)*(TargetBitrate2-TargetBitrate3)+TargetBitrate3 (9)
[0097] Wherein, avgIntraPercent(j-1) represents the average intra-frame macroblock coding ratio of the j-1th image group; TargetBitrate2 represents the second preset bit rate; and TargetBitrate3 represents the third preset bit rate.
[0098] In some embodiments, the above method also includes: obtaining the ratio value of the intra-frame coded macroblocks of each predicted frame in the previous picture group other than the first picture group in all coded macroblocks; determining the average intra-frame macroblock coding ratio of the previous picture group other than the first picture group based on the ratio value and the number of frames of multiple frames included in the previous picture group.
[0099] It can be understood that according to the statistical information of all predicted frames in the previous picture group other than the first picture group after the encoding is completed, that is, the number of intra-frame coded macroblocks of each predicted frame in the previous picture group and the number of all coded macroblocks, the number of intra-frame coded macroblocks of each predicted frame in the previous picture group is divided by the number of all coded macroblocks, and the ratio value of the intra-frame coded macroblocks of each predicted frame in the previous picture group in all coded macroblocks can be obtained. Then, the ratio values corresponding to all predicted frames in the previous picture group are added to obtain the total ratio value. Finally, the total ratio value is divided by the number of frames of the multi-frame images included in the previous picture group to obtain the average intra-frame macroblock coding ratio of the previous picture group other than the first picture group.
[0100] In one embodiment, the process of determining the average intra-frame macroblock coding ratio of the previous picture group other than the first picture group can be expressed by the following formula (10):
[0101]
[0102] Among them, avgIntraPercent(j-1) represents the average intra-frame macroblock coding ratio of the j-1th image group; intraPercent(1,j-1) represents the ratio of the intra-frame coded macroblocks of the first predicted frame in the j-1th image group to all coded macroblocks; intraPercent(2,j-1) represents the ratio of the intra-frame coded macroblocks of the second predicted frame in the j-1th image group to all coded macroblocks at the third preset bit rate; intraPercent(N,j-1) represents the ratio of the intra-frame coded macroblocks of the Nth predicted frame in the j-1th image group to all coded macroblocks at the third preset bit rate; N represents the last predicted frame in the j-1th image group.
[0103] In some embodiments, the ratio of the intra-coded macroblocks of the i-th predicted frame in the previous picture group other than the first picture group to all coded macroblocks can be determined by the following formula (11):
[0104]
[0105] Among them, intraPercent(i,j-1) represents the proportion of intra-frame coded macroblocks of the i-th predicted frame in the j-1-th image group in all coded macroblocks; intraMbCount(i,j-1) represents the number of intra-frame coded macroblocks of the i-th predicted frame in the j-1-th image group; frameMbCount(j-1) represents the number of all coded macroblocks in the j-1-th image group, which is also the number of all coded macroblocks corresponding to each predicted frame in the j-1-th image group.
[0106] It should be noted that: within the same picture group, the number of all coded macroblocks corresponding to each predicted frame is the same.
[0107] In some embodiments, taking a macroblock of 16×16 as an example, frameMbCount(j-1) can be determined by the following formula (12):
[0108] frameMbCount(j-1)=(width+15)*(height+15) / (16*16) (12)
[0109] Wherein, width represents the width of the image frame in the j-1th image group; height represents the height of the image frame in the j-1th image group.
[0110] In an example, the rate control process of a predicted frame in a group of pictures is described by taking GOP1 as an example:
[0111] 1. The frame rate is used as the length of GOP1 (i.e., the first group of pictures). The predicted bit rate corresponding to GOP1 can be determined by the above formula (8). In this case, GopLen(1)=fps.
[0112] 2. The bit rate of the first predicted frame (eg, P1 frame) in GOP1 can be calculated based on the average bit rate, see the above formula (1).
[0113] 3. According to the encoding result of the previous frame (P1 frame), the actual bit rate of the P1 frame can be determined, and the number of intra-frame coded macroblocks and the total number of macroblocks of the P1 frame can also be obtained. Therefore, according to the above formula (11), the proportion of the intra-frame coded macroblocks of the P1 frame in all the coded macroblocks can be determined. According to the above formulas (2), (6) and (7), the predicted bit rate of the second predicted frame (e.g., P2 frame) in GOP1 can be determined.
[0114] 4. According to the encoding result of the P2 frame, the actual bit rate of the P2 frame can be determined. According to the predicted bit rate of the P2 frame, the actual bit rate of the P2 frame, the predicted bit rate of the P1 frame and the actual bit rate of the P1 frame, the bit rate difference between the first two P frames in GOP1 is determined by the above formula (4). Then, the second parameter of the third predicted frame (e.g., P3 frame) in GOP1 is determined by the above formula (5). The parameter is used for bit rate prediction of the P3 frame. Then, the predicted bit rate of the P3 frame is determined by the above formula (7). And according to the above formula (11), the proportion of intra-frame coded macroblocks of the P2 frame in all coded macroblocks can be determined.
[0115] 5. Perform the relevant calculation in step 4 above on the third predicted frame (e.g., P3 frame) in GOP1 until the encoding of all predicted frames in GOP1 is completed. According to the relevant bit rate of the image frames in GOP1, the first parameter is updated in combination with the above formula (3) to obtain the first parameter of GOP2 (the second image group).
[0116] 6. Determine the ratio of intra-frame coded macroblocks of each predicted frame in GOP1 to all coded macroblocks based on the above formula (11), determine the average intra-frame macroblock coding ratio of GOP1 based on the above formula (10), and then determine the predicted bit rate corresponding to GOP2 in combination with the above formula (9), and repeat the above steps 2 to 6 until the predicted bit rates of the predicted frames of all image groups are determined.
[0117] Figure 3 FIG. 1 is a flow chart of a rate control method according to an exemplary embodiment. Figure 3 As shown, the method mainly includes the following steps:
[0118] In step 301, a video sequence is divided into a plurality of image groups, each of which includes a plurality of temporally continuous frame images.
[0119] In step 302, a prediction code rate corresponding to each group of pictures and a first parameter of each group of pictures are determined.
[0120] In step 303, the prediction bit rate of the first prediction frame in each image group is determined according to the prediction bit rate corresponding to each image group and the number of frames of the multiple images included in each image group.
[0121] In step 304, the second parameter of the i-th prediction frame is updated based on the second parameter of the i-1-th prediction frame in each image group, the prediction bit rates of all prediction frames in the first i-1 prediction frames, the actual bit rates of all prediction frames, and the number of frames of the multi-frame images included in each image group.
[0122] In step 305, a first product between a first parameter of each picture group and a predicted code rate of an i-1th predicted frame of each picture group is obtained.
[0123] In step 306, the first product is summed with the second parameter of the i-th predicted frame of each picture group to obtain the predicted bit rate corresponding to the i-th predicted frame of each picture group.
[0124] Figure 4 FIG. 1 is a block diagram of a bit rate control device according to an exemplary embodiment. Figure 4 As shown, the device mainly includes: a division module 401, configured to divide the video sequence into a plurality of image groups, each image group includes a plurality of frames of images that are continuous in time; a first determination module 402, configured to determine the prediction bit rate corresponding to each image group and a first parameter of each image group, the first parameter being the slope of a linear model, the linear model being used to predict the prediction bit rate of the i-th prediction frame in each image group, i being an integer greater than 1; a second determination module 403, configured to determine the prediction bit rate of the first prediction frame in each image group according to the prediction bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group bit rate; a third determination module 404 is configured to perform the following steps for the i-th prediction frame in each image group: based on the second parameter of the i-1-th prediction frame in each image group, the predicted bit rates of all prediction frames in the first i-1 prediction frames, the actual bit rates of all prediction frames and the number of frames of the multi-frame image, update the second parameter of the i-th prediction frame, the second parameter being the intercept of the linear model; according to the first parameter of each image group, the predicted bit rate of the i-1-th prediction frame of each image group and the second parameter of the i-th prediction frame of each image group, determine the predicted bit rate corresponding to the i-th prediction frame of each image group.
[0125] In some embodiments, the third determination module 404 is configured to: obtain a first product between a first parameter of each image group and a predicted bit rate of an i-1th predicted frame of each image group; sum the first product and a second parameter of an i-th predicted frame of each image group to obtain a predicted bit rate corresponding to an i-th predicted frame of each image group.
[0126] In some embodiments, the first determination module 402 includes a first determination submodule and a second determination submodule; the first determination submodule is configured to: for the first image group, determine the first preset value as the first parameter of the first image group; the second determination submodule is configured to: for the non-first image group, determine the first parameter of the non-first image group based on the first parameter of the previous image group of the non-first image group, the actual bit rate of the previous image group, and the predicted bit rate of the previous image group.
[0127] In some embodiments, the second determination submodule 403 is configured to: obtain the second product of the first parameter of the previous image group other than the first image group and the actual bit rate of the previous image group; divide the second product by the predicted bit rate of the previous image group to obtain the first parameter of the non-first image group.
[0128] In some embodiments, the third determination module 404 is configured to: determine the rate difference of all predicted frames based on the predicted bit rates of all predicted frames in the first i-1 predicted frames and the actual bit rates of all predicted frames; divide the rate difference by the number of frames of the multi-frame images included in each image group to obtain the average rate difference of all predicted frames; obtain the sum of the second parameter of the i-1th predicted frame in each image group and the average rate difference to obtain the second parameter of the i-1th predicted frame; wherein the second parameter of the first predicted frame is a second preset value.
[0129] In some embodiments, the first determination module 402 also includes a third determination submodule and a fourth determination submodule; the third determination submodule is configured as: for the first image group, based on the first preset bit rate, the number of frames of multiple frames of images included in the first image group, and the frame rate, determine the predicted bit rate corresponding to the first image group; the fourth determination submodule is configured as: for the non-first image group, based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, determine the predicted bit rate corresponding to the non-first image group, the second preset bit rate is greater than the first preset bit rate, and the first preset bit rate is greater than the third preset bit rate.
[0130] In some embodiments, the fourth determination submodule is configured to: obtain the difference between the second preset bit rate and the third preset bit rate; obtain the third product of the average intra-frame macroblock coding ratio and the difference; sum the third product and the third preset bit rate to obtain the predicted bit rate corresponding to the non-first image group.
[0131] In some embodiments, the above-mentioned device also includes: an acquisition module, configured to: obtain the ratio value of the intra-frame coded macroblocks of each predicted frame in the previous image group other than the first image group in all coded macroblocks; a fourth determination module, configured to: determine the average intra-frame macroblock coding ratio of the previous image group other than the first image group based on the ratio value and the number of frames of multiple frames included in the previous image group.
[0132] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0133] Figure 5 1 is a block diagram of an electronic device 500 according to an exemplary embodiment. For example, the electronic device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0134] Reference Figure 5 , the electronic device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .
[0135] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with at least one of display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.
[0136] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include at least one of the following: instructions for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, and videos. The memory 504 may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), an erasable programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk, or an optical disk.
[0137] The power supply component 506 provides power to various components of the electronic device 500. The power supply component 506 may include at least one of the following: a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 500.
[0138] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the electronic device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0139] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the electronic device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.
[0140] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to, a home button, a volume button, a start button, and a lock button.
[0141] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 can detect the open / closed state of the electronic device 500, the relative positioning of the components, such as the display and keypad of the electronic device 500, and the sensor assembly 514 can also detect the position change of the electronic device 500 or a component in the electronic device 500, the presence or absence of contact between the user and the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and the temperature change of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include a light sensor, such as a complementary metal oxide semiconductor (CMOS) or a charge coupled device (CCD) image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include, but is not limited to, at least one of the following: an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, and a temperature sensor.
[0142] The communication component 516 is configured to facilitate communication between the electronic device 500 and other devices in a wired or wireless manner. The electronic device 500 can access a wireless network based on a communication standard, such as Wi-Fi, 4G, 5G, or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0143] In an exemplary embodiment, the electronic device 500 can be implemented by one or more application specific integrated circuits (ASIC), digital signal processors (DSP), digital signal processing devices (DSPD), programmable logic devices (PLD), field programmable gate arrays (FPGA), controllers, microcontrollers, microprocessors or other electronic components.
[0144] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 504 including executable instructions or a computer program, which can be executed by a processor 520 of an electronic device 500 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a compact disc read-only memory (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0145] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a mobile terminal, enables the mobile terminal to perform any of the above-mentioned bit rate control methods of the embodiments of the present disclosure. For example, the method includes:
[0146] The video sequence is divided into a plurality of image groups, each of which includes a plurality of frames of images that are continuous in time; the predicted bit rate corresponding to each image group and the first parameter of each image group are determined, the first parameter being the slope of a linear model, the linear model being used to predict the predicted bit rate of the i-th predicted frame in each image group, i being an integer greater than 1; the predicted bit rate of the first predicted frame in each image group is determined according to the predicted bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group; for the i-th predicted frame in each image group, the following steps are performed: based on the second parameter of the i-1-th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames and the number of frames of the plurality of frames of images included in each image group, the second parameter of the i-th predicted frame is updated, the second parameter being the intercept of the linear model; the predicted bit rate corresponding to the i-th predicted frame of each image group is determined according to the first parameter of each image group, the predicted bit rate of the i-1-th predicted frame of each image group and the second parameter of the i-th predicted frame of each image group.
[0147] The embodiment of the present disclosure provides a computer program product, which includes: a computer program or an executable instruction, which is stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the executable instruction from the computer-readable storage medium, and the processor executes the computer program or the executable instruction, so that the computer device executes any one of the above-mentioned bit rate control methods of the embodiment of the present disclosure.
[0148] Figure 6 FIG. 6 is a block diagram of a server 600 according to an exemplary embodiment. Figure 6 The server 600 includes a processing component 622, which further includes one or more processors, and a memory resource represented by a memory 632 for storing instructions executable by the processing component 622, such as an application. The application stored in the memory 632 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 622 is configured to execute instructions to perform any of the above-mentioned bit rate control methods. For example, the method includes:
[0149] The video sequence is divided into a plurality of image groups, each of which includes a plurality of frames of images that are continuous in time; the predicted bit rate corresponding to each image group and the first parameter of each image group are determined, the first parameter being the slope of a linear model, the linear model being used to predict the predicted bit rate of the i-th predicted frame in each image group, i being an integer greater than 1; the predicted bit rate of the first predicted frame in each image group is determined according to the predicted bit rate corresponding to each image group and the number of frames of the plurality of frames of images included in each image group; for the i-th predicted frame in each image group, the following steps are performed: based on the second parameter of the i-1-th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames and the number of frames of the plurality of frames of images included in each image group, the second parameter of the i-th predicted frame is updated, the second parameter being the intercept of the linear model; the predicted bit rate corresponding to the i-th predicted frame of each image group is determined according to the first parameter of each image group, the predicted bit rate of the i-1-th predicted frame of each image group and the second parameter of the i-th predicted frame of each image group.
[0150] The server 600 may also include a power supply component 626 configured to perform power management of the server 600, a wired or wireless network interface 650 configured to connect the server 600 to a network, and an input / output (I / O) interface 658. The server 600 may operate an operating system stored in the memory 632, such as Windows Server™, Mac OSX™, Unix™ Linux™, FreeBSD™, or the like.
[0151] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0152] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A rate control method, characterized in that: include: Dividing the video sequence into a plurality of image groups, each image group comprising a plurality of temporally continuous frame images; Determine a predicted bit rate corresponding to each of the image groups and a first parameter of each of the image groups, where the first parameter is a slope of a linear model, and the linear model is used to predict a predicted bit rate of an i-th predicted frame in each of the image groups, where i is an integer greater than 1; Determining the predicted bit rate of the first predicted frame in each image group according to the predicted bit rate corresponding to each image group and the number of frames of the multiple frames of images included in each image group; For the i-th predicted frame in each of the image groups, the following steps are performed: Based on the second parameter of the i-1th predicted frame in each image group, the predicted bit rates of all predicted frames in the first i-1 predicted frames, the actual bit rates of all predicted frames, and the number of frames of the multi-frame images included in each image group, the second parameter of the i-th predicted frame is updated, where the second parameter is the intercept of the linear model; The predicted bit rate corresponding to the i-th predicted frame of each image group is determined according to the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group and the second parameter of the i-th predicted frame of each image group.
2. The method according to claim 1, characterized in that The step of determining the predicted bit rate corresponding to the i-th predicted frame of each image group according to the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group, and the second parameter of the i-th predicted frame of each image group comprises: Obtaining a first product between the first parameter of each group of pictures and the predicted bit rate of the i-1th predicted frame of each group of pictures; The first product is summed with the second parameter of the i-th predicted frame of each image group to obtain a predicted bit rate corresponding to the i-th predicted frame of each image group.
3. The method according to claim 1 or 2, characterized in that: The determining of the first parameter of each image group comprises: For a first image group, determining a first preset value as a first parameter of the first image group; For a non-first picture group, the first parameter of the non-first picture group is determined according to the first parameter of a previous picture group of the non-first picture group, the actual bit rate of the previous picture group, and the predicted bit rate of the previous picture group.
4. The method according to claim 3, characterized in that The determining the first parameter of the non-first group of pictures according to the first parameter of the previous group of pictures of the non-first group of pictures, the actual bit rate of the previous group of pictures, and the predicted bit rate of the previous group of pictures comprises: Obtaining a second product of a first parameter of a previous picture group that is not the first picture group and an actual bit rate of the previous picture group; The second product is divided by the predicted bit rate of the previous picture group to obtain the first parameter of the non-first picture group.
5. The method according to claim 1, characterized in that: The updating of the second parameter of the i-th prediction frame based on the second parameter of the i-1th prediction frame in each image group, the prediction bit rates of all prediction frames in the first i-1 prediction frames, the actual bit rates of all prediction frames, and the number of frames of the multi-frame images included in each image group includes: Determine a bit rate difference of all the predicted frames based on the predicted bit rates of all the predicted frames in the first i-1 predicted frames and the actual bit rates of all the predicted frames; Dividing the bit rate difference by the number of frames of the multi-frame images included in each image group to obtain an average bit rate difference of all the predicted frames; Obtaining the sum of the second parameter of the i-1th predicted frame in each image group and the average bit rate difference to obtain the second parameter of the i-th predicted frame; The second parameter of the first prediction frame is a second preset value.
6. The method according to claim 1, characterized in that The determining the predicted bit rate corresponding to each group of pictures includes: For a first image group, determining a predicted bit rate corresponding to the first image group according to a first preset bit rate, the number of frames and the frame rate of multiple frames of images included in the first image group; For a non-first image group, the predicted bit rate corresponding to the non-first image group is determined based on the average intra-frame macroblock coding ratio of the previous image group of the non-first image group, the second preset bit rate and the third preset bit rate, the second preset bit rate is greater than the first preset bit rate, and the first preset bit rate is greater than the third preset bit rate.
7. The method according to claim 6, characterized in that The determining the predicted bit rate corresponding to the non-first group of pictures according to the average intra-frame macroblock coding ratio of the previous group of pictures of the non-first group of pictures, the second preset bit rate and the third preset bit rate includes: Obtaining a difference between the second preset bit rate and the third preset bit rate; Obtaining a third product of the average intra-frame macroblock coding ratio and the difference; The third product and the third preset bit rate are summed to obtain a predicted bit rate corresponding to the non-first image group.
8. The method according to claim 6 or 7, characterized in that: The method further comprises: Obtaining a ratio value of the intra-frame coded macroblocks of each predicted frame in a previous picture group other than the first picture group in all coded macroblocks; According to the ratio value and the number of frames of the multiple frames of images included in the previous picture group, an average intra-frame macroblock coding ratio of the previous picture group other than the first picture group is determined.
9. A bit rate control device, characterized in that: include: A division module, configured to divide the video sequence into a plurality of image groups, each image group including a plurality of frames of images that are continuous in time; A first determination module is configured to determine a prediction bit rate corresponding to each of the image groups and a first parameter of each of the image groups, wherein the first parameter is a slope of a linear model, and the linear model is used to predict a prediction bit rate of an i-th prediction frame in each of the image groups, where i is an integer greater than 1; A second determination module is configured to determine the prediction bit rate of the first prediction frame in each image group according to the prediction bit rate corresponding to each image group and the number of frames of the multiple frames of images included in each image group; The third determining module is configured to perform the following steps for the i-th predicted frame in each of the image groups: Based on the second parameter of the i-1th prediction frame in each image group, the prediction bit rates of all prediction frames in the first i-1 prediction frames, the actual bit rates of all prediction frames, and the number of frames of the multi-frame images, updating the second parameter of the i-th prediction frame, where the second parameter is the intercept of the linear model; The predicted bit rate corresponding to the i-th predicted frame of each image group is determined according to the first parameter of each image group, the predicted bit rate of the i-1th predicted frame of each image group and the second parameter of the i-th predicted frame of each image group.
10. An electronic device, characterized in that: include: processor; Memory for storing computer programs or instructions; The processor executes the computer program or instructions to implement the steps of the method according to any one of claims 1 to 8.
11. A non-transitory computer-readable storage medium storing a computer program or instruction, characterized in that: When the computer program or instructions in the storage medium are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
12. A computer program product comprising a computer program or instructions, characterized in that When the computer program or instruction is executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Code rate controlling method for video coding based on Rho domain
CN101287123A
Code rate control method in video coding
CN108012149A
Image coding method and device, equipment and storage medium
CN113766226A
Multiple bit rate video encoding using variable bit rate and dynamic resolution for adaptive video streaming
US20100189183A1