CN116366850A - Video coding control method and device and electronic equipment - Google Patents

Video coding control method and device and electronic equipment Download PDF

Info

Publication number
CN116366850A
CN116366850A CN202310341090.XA CN202310341090A CN116366850A CN 116366850 A CN116366850 A CN 116366850A CN 202310341090 A CN202310341090 A CN 202310341090A CN 116366850 A CN116366850 A CN 116366850A
Authority
CN
China
Prior art keywords
target
frame
image
target area
ith
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310341090.XA
Other languages
Chinese (zh)
Inventor
周统和
杨涛
蒋义明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Lenovo Beijing Ltd
Original Assignee
Lenovo Beijing Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Lenovo Beijing Ltd filed Critical Lenovo Beijing Ltd
Priority to CN202310341090.XA priority Critical patent/CN116366850A/en
Publication of CN116366850A publication Critical patent/CN116366850A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • H04N19/423Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation characterised by memory arrangements

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The application provides a video coding control method, a video coding control device and electronic equipment, wherein the video coding control method comprises the following steps: obtaining a target streaming media; encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters; wherein, at least one frame of image has different coded bit numbers aiming at different target areas.

Description

Video coding control method and device and electronic equipment
Technical Field
The present disclosure relates to the field of information technologies, and in particular, to a video coding control method, a video coding control device, and an electronic device.
Background
During the transmission of video, it is necessary to transmit the video over a transmission channel of limited bandwidth. The encoder may generate a variable code stream when encoding a video sequence, so a video buffer is arranged between the encoder and a channel to smooth the bit stream fluctuation generated in the encoding process, and the encoder is required to adopt a proper code rate to control the encoding stability output to the buffer so as to avoid the overflow or underflow of the buffer.
In the prior art, code rate control of an encoder is based on an image group or an image for code rate adjustment, however, the granularity of adjustment is larger, and the stable image quality of various display formats cannot be ensured.
Disclosure of Invention
In view of this, the present application provides a video coding control method and apparatus, as follows:
a video coding control method, comprising:
obtaining a target streaming media;
encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters;
wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
Optionally, the method, wherein the encoding for each frame of image in the image sequence includes:
dividing each frame of image into at least two target areas based on target number of preset coding units;
encoding the at least two target areas respectively;
wherein, the number of target areas divided by each frame image in the image sequence of the streaming media is the same.
Optionally, the method for encoding the at least two target areas includes:
determining a compression factor of an ith target area of an nth frame image based on the number of coding bits of the ith target area of the nth-1 frame image, wherein N is an integer greater than 1, and i is a positive integer;
And encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image.
Optionally, in the above method, the determining the compression factor of the ith target area of the nth frame image based on the number of encoding bits of the ith target area of the nth-1 frame image includes:
if the number of coding bits of the ith target area of the N-1 frame image is larger than the number of target bits, lifting a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
if the number of coding bits of the ith target area of the N-1 frame image is smaller than the number of target bits, reducing a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
if the number of coding bits of the ith target area of the N-1 frame image is equal to the number of target bits, determining that the compression factor of the ith target area of the N-1 frame image is the compression factor of the ith target area of the N frame image;
wherein the value of the compression factor is inversely related to the number of coded bits, which are positively related to the encoded sharpness.
Optionally, in the above method, the target bit number of the i-th target area of the N-1-th frame image is an estimated value, and the method further includes:
and estimating the target bit number.
Optionally, in the above method, the estimating the target number of bits includes:
and determining the basic bit number of each target area based on the target code rate, the target frame rate and the number of the target areas in each frame of image, wherein the target code rate is related to a transmission channel for transmitting the coded target streaming media.
Alternatively, the method described above,
if the current frame is a 1 st frame image, the target bit number of the i-th target area of the 1 st frame image is the basic bit number;
and if the current frame is an N-th frame image, the target bit number of the ith target area of the N-th frame image comprises the sum of the difference value of the target bit number of the ith target area of the N-1 th frame and the coding bit number of the ith target area of the N-1 th frame and the basic bit number.
Alternatively, the method described above,
and if the current frame is an N-th frame image, determining the target bit number of the i-th target area of the N-th frame image according to the proportion of the complexity of the i-th target area of the N-1-th frame to the complexity of the N-1-th frame.
A video encoding control apparatus comprising:
the obtaining module is used for obtaining the target streaming media;
the encoding module is used for encoding each frame of image in the image sequence based on the image sequence of the target streaming media, and the target streaming media meets target display parameters;
wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
An electronic device, comprising: an encoder, a buffer;
the encoder is used for encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters;
the buffer is used for buffering the data coded by the coder and outputting the data through a transmission channel;
the encoder realizes that the number of coded bits of at least one frame of image after being coded aiming at different target areas is different at least based on the buffer result of the buffer;
the encoder is integrated in a processor of the electronic device, the buffer is a part of storage space in a memory of the electronic device, or the encoder and the buffer are integrated in a preset functional chip.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are needed in the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only embodiments of the present application, and that other drawings may be obtained according to the provided drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of an embodiment 1 of a video coding control method provided in the present application;
fig. 2 is a schematic structural diagram of an electronic device in embodiment 1 of a video encoding control method provided in the present application;
fig. 3 is a flowchart of an embodiment 2 of a video coding control method provided in the present application;
fig. 4 is a schematic view of a target area of a frame of image in embodiment 2 of a video coding control method provided in the present application;
fig. 5 is a flowchart of an embodiment 3 of a video coding control method provided in the present application;
fig. 6 is a schematic diagram of encoding streaming media in embodiment 3 of a video encoding control method provided in the present application;
fig. 7 is a flowchart of an embodiment 4 of a video coding control method provided in the present application;
fig. 8 is a flowchart of an embodiment 5 of a video coding control method provided in the present application;
Fig. 9 is a schematic structural diagram of an embodiment of a video encoding control device provided in the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
As shown in fig. 1, a flowchart of an embodiment 1 of a video coding control method provided in the present application is applied to an electronic device, and the method includes the following steps:
step S101: obtaining a target streaming media;
the electronic device applied in the embodiment may be an electronic device where a streaming media provider is located.
The target streaming media is transmitted to other electronic devices through a transmission channel after being encoded in the electronic devices.
Step S102: encoding each frame of image in an image sequence based on an image sequence of a target streaming media, wherein the target streaming media meets target display parameters; wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
Determining whether the target streaming media meets the target display parameters, and executing step S102 if yes; otherwise, each frame of image in the image sequence may be encoded in other ways.
Specifically, the target display parameter may be a preset resolution threshold.
For example, the target display parameter may be 1080P resolution, and of course, the selection of the target display parameter is not limited thereto, and the value of the target display parameter may be set according to practical situations in practice.
Wherein, each frame of image is divided into a plurality of target areas, and different coding parameters can be adopted for different target areas so as to realize different numbers of coded bits after different target areas are coded.
Wherein the bit number is the network bandwidth occupied by the encoded data corresponding to the target area, and the larger the bit number is, the more network bandwidth is required for transmitting the encoded data; the smaller the number of bits, the less network bandwidth is required to transmit the encoded data.
Specifically, in the scheme, different coding parameters are adopted for different coding regions of a frame of image, so that the number of coded bits of different target regions in the frame of image is different, and the code rate control for different target regions is different, so that the stability of the quality of the coded image can be ensured.
It should be noted that, in this scheme, after encoding a frame of image, the number of encoded bits encoded in different target areas is different, so that the number of bits of the data obtained after encoding in different areas is different.
If the target streaming media does not meet the target display parameters, a frame of image can be encoded by adopting the same encoding parameters, and the bit number of the data obtained by encoding any target area is the same.
In the present application, the coding parameter adjustment for image coding is specifically parameter adjustment performed by using a VBR (Variable BitRate) coding scheme.
As shown in fig. 2, a schematic structural diagram of an electronic device includes: an encoder 201 and a buffer 202; after the streaming media is input to the encoder for encoding, the encoded data enters the buffer 202 to smooth the bit stream fluctuation generated in the encoding process, and is sent to other devices through a transmission channel. Wherein, the encoder realizes the code rate control based on the feedback of the buffer, so as to avoid the condition that the buffer overflows or underflows.
In this embodiment, the data stream entering the buffer is ensured to be stable by different numbers of coded bits after coding different target areas for one frame of image.
It should be noted that, in the following embodiments, the process of encoding different target areas of each frame of image in the image sequence will be described in detail, and this embodiment will not be described in detail.
In summary, the video coding control method provided in this embodiment includes: obtaining a target streaming media; encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters; wherein, at least one frame of image has different coded bit numbers aiming at different target areas. In this embodiment, based on that the target streaming media meets the target and shows eucalyptus, each frame of image in the image sequence in the target streaming media is encoded, wherein the encoding bit number of at least one frame of image after encoding in different target areas is different, so that encoding is performed on different target areas in a certain frame of image in the target streaming media by adopting different encoding parameters, the bit number of data obtained after encoding in different areas is different, the stability of the data stream entering the buffer is ensured, and the situation that the buffer overflows or underflows is avoided.
As shown in fig. 3, a flowchart of an embodiment 2 of a video coding control method provided in the present application includes the following steps:
Step S301: obtaining a target streaming media;
step S301 is identical to the corresponding steps in embodiment 1, and is not described in detail in this embodiment.
Step S302: dividing an image sequence based on target streaming media into at least two target areas based on target number of preset coding units for each frame of image;
the preset coding unit is the smallest coding unit in a frame of image, such as a macro block.
Specifically, a macroblock consists of a 16×16 matrix of pixels.
Wherein, divide the preset coding unit of the goal quantity into a goal area.
The target area may be represented by a GOM (group of macroblock, macroblock group), among others.
The preset coding units contained in each target area are in whole row units, and the sizes of other target areas are equal except for the last target area.
The number of lines of preset coding units contained in each target area is preset to be A, the number of lines of preset coding units in each frame of image is preset to be B, and the number of divided target areas is as follows:
B/A=C
if the C is an integer, dividing one frame of image into C target areas with equal sizes;
if the C is a non-integer and there is a remainder D, dividing a frame of image into C+1 target areas, wherein the first C target areas are equal in size, and the C+1 is composed of the remaining coding units.
The line number selection conditions of the preset coding units contained in each target area can be set according to actual conditions.
Specifically, an upper threshold (H) and a lower threshold (L) may be set, and a formula of a number of rows (a) including a preset coding unit in each target area may be calculated, where the formula is as follows:
A=H-round((H-L)*ratio)
wherein round represents rounding, and raito is a configurable factor.
Specifically, different upper and lower threshold values can be set for different target display parameters, and the value of the configurable factor can be set according to actual conditions, and is irrelevant to the target display parameters.
For example, for 1080P streaming media, the threshold values H and L are set to 8 and 4, respectively, and the raito is set to 90%, and then the number of rows of preset coding units included in each target area is as follows:
A=8-round((8-4)*0.9)=4
it should be noted that the number of preset encoding units included in each target area in each frame of image is as follows:
S=A*D
wherein S is the number of preset codes contained in each target area, A is the number of lines of preset coding units contained in each target area, and D is the number of preset coding units contained in each line in the image.
Wherein d=number of pixels per line/16 in the image
For example, in 1080P streaming media, the number of pixels included in each line of each frame of image is 1080, and in order to ensure the integrity of the macroblock, in a specific implementation, 8 padding pixels are supplemented to use 1088 pixels for calculation.
The pixel value adopted by the filling pixel is transmitted to opposite side equipment through a transmission channel together with the encoded data, so that the opposite side equipment performs filling pixel processing on the received data based on the pixel value to obtain output data.
Specifically, in the 1080P streaming media, the number of preset coding units included in each line of each frame of image is as follows:
D=1088/16=68
correspondingly, in 1080P streaming media, the target area contained in each frame of image is 4×68 macro blocks.
For example, if the target streaming media is 1080P video, a frame of image is 1920×1088 (rows×columns) pixels, the frame of image can be divided into 120×68 macro blocks, and if a target area contains 6 rows (6×68) of preset coding units, the frame of image is divided into 20 target areas; if the preset coding units contained in one target area are 7 rows (7×68), one frame of image is divided into 18 target areas, the preset coding units contained in the 1 st to 17 th target areas are 7 rows (7×68), and the preset coding units contained in the 18 th target areas are 1 row (1×68).
As shown in fig. 4, a target area of a frame image is schematically shown, wherein a thin line frame represents one macro block 401 and a thick line frame represents one target area 402. In the left picture, a frame of image in a streaming medium is composed of 6×3 macro blocks, one target area contains 2×3 macro blocks, and the frame of image is divided into 3 target areas. In the right picture, a frame of another streaming media is formed by 7×3 macro blocks, one target area contains 2×3 macro blocks, and the frame of another streaming media is divided into 4 target areas, wherein the upper 3 target areas respectively contain 2×3 macro blocks, and the 4 th target area contains the remaining 1×3 macro blocks.
Step S303: and respectively encoding the at least two target areas.
Wherein, the number of target areas divided by each frame image in the image sequence of the streaming media is the same.
It should be noted that, since the target display parameter of one streaming media is unique, the number of pixels included in each frame image in one streaming media is the same, so the number of target areas divided for each frame image in the same streaming media is the same, and the corresponding target areas in each frame image are the same in size.
Wherein, different coding parameters can be adopted to code different target areas in a frame of image, and the coded coding bit numbers are different.
When the data amount of each frame of image in the streaming media has a gap, if each region of one frame of image adopts the same coding parameter, the fluctuation of the coded coding bit number of different frames of data with different data amounts is larger; in the scheme, because different coding parameters are adopted by different target areas in one frame of image, the number of the finally coded coding bits of the target areas is different, and the number of the coding bits of each frame of image of the streaming media can be ensured to be kept at smaller fluctuation.
In summary, the video coding control method provided in this embodiment includes: dividing each frame of image into at least two target areas based on target number of preset coding units; encoding the at least two target areas respectively; wherein, the number of target areas divided by each frame image in the image sequence of the streaming media is the same. In this embodiment, each frame of image is divided into at least two target areas based on a preset encoding unit of a target number, the number of the target areas divided by each frame of image in an image sequence of the streaming media is the same, and each target area in one frame of image is encoded respectively, so that the number of encoding bits after final encoding of different target areas in one frame of image is different, and it can be ensured that the number of encoding bits of each frame of image of the streaming media is kept at smaller fluctuation.
As shown in fig. 5, a flowchart of an embodiment 3 of a video coding control method provided in the present application includes the following steps:
step S501: obtaining a target streaming media;
step S502: dividing an image sequence based on target streaming media into at least two target areas based on target number of preset coding units for each frame of image;
Steps S501-502 are identical to the corresponding steps in embodiment 2, and are not described in detail in this embodiment.
Step S503: determining a compression factor of an ith target area of an nth frame image based on the number of encoding bits of the ith target area of the nth-1 frame image;
wherein N is an integer greater than 1 and i is a positive integer.
The compression factor of a certain target area in a certain frame image is determined based on the coding result of the target area at the corresponding position of the previous frame.
Specifically, starting from the 2 nd frame, the compression factor of a certain target area in each frame is determined based on the coding result of the target area at the corresponding position of the previous frame.
The compression factor may specifically be a compression parameter required for compressing data in the target area.
The specific process of determining the compression factor of the ith target area of the nth frame image will be described in detail in the following embodiments, which will not be described in detail in this embodiment.
As shown in fig. 6, a schematic diagram of encoding of streaming media is illustrated, where the schematic diagram is illustrated using consecutive 3-frame images, including an N-1 frame, an N-th frame, and an n+1-th frame image. Each frame of image comprises 3 target areas GOM, namely GOM0-2. After the three target areas of the N-1 frame image are respectively encoded and compressed, the compression factors of the corresponding three target areas of the N frame image are determined based on the encoding bit numbers of the encoding results, after the three target areas of the N frame image are encoded based on the compression factors, the compression factors of the three target areas of the N+1 frame image are determined based on the encoding bit numbers of the encoding results, and then the three target areas of the N+1 frame image are respectively encoded based on the compression factors, and so on, each frame image in the streaming media is sequentially encoded, so that the compression processing of the streaming media is realized.
Step S504: and encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image.
And based on the determined compression factor, encoding the corresponding target area to obtain the encoding bit number of the target area.
It should be noted that, the compression factors adopted by different target areas in a frame of image are determined based on the number of coding bits of the corresponding target areas in the previous frame of image, and because the image contents in different target areas are different, the number of coding bits after coding in different target areas in the same frame of image is different, so that the determined compression factors may be different, and the number of coding bits obtained after coding may also be different due to different compression factors and different image contents.
In summary, the video coding control method provided in this embodiment includes: determining a compression factor of an ith target area of an nth frame image based on the number of coding bits of the ith target area of the nth-1 frame image, wherein N is an integer greater than 1, and i is a positive integer; and encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image. In this embodiment, in combination with the encoding result of the target area in the previous frame image, the encoding factors of the target area in the corresponding position of the next frame are determined, the encoding bit numbers of different target areas are different, and correspondingly, the encoding factors adopted by different target areas in the next frame are different, so that the encoding bit numbers of different areas of the previous frame image are different.
As shown in fig. 7, a flowchart of an embodiment 4 of a video coding control method provided in the present application includes the following steps:
step S701: obtaining a target streaming media;
step S702: dividing an image sequence based on target streaming media into at least two target areas based on target number of preset coding units for each frame of image;
steps S701-702 are identical to the corresponding steps in embodiment 3, and are not described in detail in this embodiment.
Step S703: if the number of coding bits of the ith target area of the N-1 frame image is larger than the number of target bits, lifting a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
the coding bit number of the ith target area in the N-1 frame image is compared with the target bit number, and the following three comparison results are obtained: the number of coded bits is greater than the target number of bits, the number of coded bits is less than the target number of bits, and the number of coded bits is equal to the target number of bits.
Wherein the target number of bits characterizes the allocated transmission bandwidth for the target region.
In an implementation, the target number of bits may be a predetermined fixed value, or may be a value estimated in conjunction with the transmission process.
The setting process of the target bit number will be described in detail in the following embodiments, which will not be described in detail in this embodiment.
Specifically, if the number of encoding bits is greater than the number of target bits, the bandwidth required for representing the ith target area for transmitting the N-1 th frame image exceeds the transmission bandwidth allocated to the target area by the transmission channel, so that the compression degree needs to be increased in order to ensure the stability of the buffer, and the compression factor of the ith target area of the N-1 th frame is obtained based on the increase of the compression factor of the ith target area of the N-1 th frame.
Wherein the value of the compression factor is inversely related to the number of coded bits, which are positively related to the encoded sharpness.
Specifically, the larger the compression factor is, the larger the compression degree is, the smaller the number of coded bits obtained by coding is, and correspondingly, the lower the definition is after coding; the smaller the compression factor is, the smaller the compression degree is, the larger the number of coded bits obtained by coding is, and correspondingly, the higher the definition is after coding.
In particular, the compression factor may be a QP (Quantizer Parameter, quantization parameter) reflecting the spatial detail compression case. The smaller the value, the finer the quantization, the higher the image quality, and the longer the resulting code stream. If QP is small, most of the details will be preserved; the QP is large, some details are lost, the code rate is reduced, but the image distortion is enhanced and the quality is degraded.
Wherein the compression factor is raised based on a preset target value.
In specific implementation, the target value may take a smaller value, such as 1 or 2, and the value of the target value is not limited in the application.
It should be noted that, in order to ensure that the image distortion rate after encoding compression is within the acceptable range, an upper limit may be preset for the compression factor.
In the implementation, if the compression factor of the ith target area of the nth-1 frame image is greater than the preset upper limit of the compression factor after the target value is increased, the upper limit of the compression factor is adopted for encoding in the ith target area of the nth frame image.
Step S704: if the number of coding bits of the ith target area of the N-1 frame image is smaller than the number of target bits, reducing a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
specifically, if the number of encoding bits is smaller than the number of target bits, the bandwidth required for representing the ith target area for transmitting the nth-1 frame image is smaller than the transmission bandwidth allocated to the target area by the transmission channel, so that the compression degree needs to be reduced in order to ensure the stability of the buffer, and the compression factor of the ith target area of the nth frame is obtained based on the reduction of the compression factor of the ith target area of the nth-1 frame.
Wherein the reduction of the compression factor is performed based on a preset target value.
It should be noted that, in order to ensure the compression effect of the image, a lower limit may be preset for the compression factor.
In a specific implementation, if the target value of the reduction of the compression factor adopted by the ith target area of the nth-1 frame image is smaller than the preset lower limit of the compression factor, the lower limit value of the compression factor is adopted for encoding in the ith target area of the nth frame image.
Step S705: if the number of coding bits of the ith target area of the N-1 frame image is equal to the number of target bits, determining that the compression factor of the ith target area of the N-1 frame image is the compression factor of the ith target area of the N frame image;
specifically, if the number of the target bits, such as the number of the coded bits, indicates that the bandwidth required for transmitting the ith target area of the N-1 th frame image is equal to the transmission bandwidth allocated to the target area by the transmission channel, in order to ensure the stability of the buffer, the compression degree does not need to be adjusted, and the compression factor of the ith target area of the N-1 th frame is used as the compression factor of the ith target area of the N-1 th frame.
Step S706: and encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image.
Step S706 is identical to the corresponding step in embodiment 3, and is not described in detail in this embodiment.
In summary, the video coding control method provided in this embodiment includes: because the target bit number characterizes the transmission channel bandwidth allocated to the ith target area, based on the relation between the coding bit number of the ith target area of the N-1 frame and the target bit number, whether the coding data of the ith target area of the N-1 frame exceeds the transmission channel bandwidth allocated to the ith target area or not can be determined, if the coding bit number is larger than the target bit number, the compression factor is increased to serve as the compression factor of the ith target area of the N frame, if the coding bit number is smaller than the target bit number, the compression factor is decreased to serve as the compression factor of the ith target area of the N frame, if the coding bit number is equal to the target bit number, the compression factor is characterized to be equal, the compression factor is directly taken as the compression factor of the ith target area of the N frame, and the relation between the coding bit number of the corresponding target area of the last frame and the target bit number is realized, and the compression factor of the target area of the current frame is determined.
As shown in fig. 8, a flowchart of an embodiment 5 of a video coding control method provided in the present application includes the following steps:
Step S801: obtaining a target streaming media;
step S802: dividing an image sequence based on target streaming media into at least two target areas based on target number of preset coding units for each frame of image;
steps S801 to 802 are identical to the corresponding steps in embodiment 4, and are not described in detail in this embodiment.
Step S803: estimating a target bit number;
the target bit number compared with the coding bit number of the ith target area of the N-1 frame image is not a fixed value, but estimated.
Specifically, the estimating the target number of bits includes:
and determining the basic bit number of each target area based on the target code rate, the target frame rate and the number of the target areas in each frame of image, wherein the target code rate is related to a transmission channel for transmitting the coded target streaming media.
And setting a target code rate and a target frame rate for the target streaming media.
Wherein the target code rate is related to a transmission channel width for transmitting the target streaming media.
The target frame rate is the number of frames of the pictures in the target streaming media transmitted in 1 second of the transmission channel, and can be set by the user.
In particular, in order to ensure the output effect of the encoded target streaming media, the target frame rate set value is not less than 20, for example, may be set to 30 frames/second, 60 frames/second, etc., and the value of the target frame rate is not limited in this application.
And calculating a target code rate/target frame rate to obtain a target bit number required by the transmission channel for transmitting each frame of image.
Dividing the target bit number of each frame of image into corresponding parts based on the number of target areas contained in each frame of image to obtain the basic bit number of each target area
Wherein the basic bit number=target code rate/target frame rate/target area number in each frame of image.
If the current frame is a 1 st frame image, the target bit number of the i-th target area of the 1 st frame image is the basic bit number;
and if the current frame is an N-th frame image, the target bit number of the ith target area of the N-th frame image comprises the sum of the difference value of the target bit number of the ith target area of the N-1 th frame and the coding bit number of the ith target area of the N-1 th frame and the basic bit number.
If the current frame is the 1 st frame image, taking a preset initial compression factor as the compression factor in the 1 st frame image, and carrying out coding compression on the i-th target area in the defined frame image to obtain the coding bit number of the i-th target area of the 1 st frame.
And if the current frame is the 2 nd frame image, comparing the number of coding bits of the 1 st frame i target area with the calculated basic number of bits as the target number of bits to obtain a comparison result, and determining whether to adjust the initial compression factor to obtain the compression factor of the i target area in the 2 nd frame image based on the comparison result.
If the current frame is the nth frame image, the target bit number of the ith target area of the nth frame image is the transmission channel bandwidth which can be used by the current frame, specifically the sum of the remaining bandwidth of the ith target area transmission code of the (N-1) th frame and the preset basic bit number.
Wherein, the bandwidth remained by the transmission coding of the ith target area of the N-1 frame is the difference value between the target bit number of the ith target area of the N-1 frame and the coding bit number of the ith target area of the N-1 frame.
The difference value can be any number, if the difference value is a positive number, the transmission channel has residual bandwidth after the ith target area of the N-1 image is transmitted, and in order to ensure that the buffer does not overflow, the number of coding bits of the ith target area in the N frame image needs to be increased; if the difference is zero, the bandwidth required for transmitting the ith target area of the N-1 frame image is the same as the transmission channel allocation bandwidth, and no bandwidth remains; if the difference is negative, it means that the bandwidth required for transmitting the ith target area of the nth-1 frame image exceeds the transmission channel allocation bandwidth, and in order to ensure that the buffer does not overflow, the number of encoding bits of the ith target area in the nth frame image needs to be reduced.
And if the current frame is an N-th frame image, determining the target bit number of the i-th target area of the N-th frame image according to the proportion that the complexity of the i-th target area of the N-1-th frame accounts for the complexity of the N-1-th frame.
The Complexity (Complexity) of the target area is calculated by the sum of absolute values of the difference values of the corresponding pixels in the same target area of the reconstructed frame of the N-1 th frame after encoding and the N-th frame before encoding.
The complexity of the target area characterizes the difference between the ith target area of the Nth frame image and the ith target area of the N-1 th frame image, if the difference is larger, the bandwidth required for transmitting the ith target area of the encoded Nth frame image is more, and similarly, if the difference is smaller, the bandwidth required for transmitting the ith target area of the encoded Nth frame image is less.
Specifically, based on the proportion of the complexity of the ith target area of the nth-1 frame image to the overall complexity of the nth frame image as a calculation proportion parameter for determining the ith target area in the nth frame image, the target bit number of the ith target area of the nth frame image is calculated by combining the mode for determining the target bit number.
Wherein the Complexity of the ith target area in the N-1 th frame image is Complexity (i), and the Complexity of the N-1 th frame image is SUM (Complexity)
Correspondingly, the target bit number T of the ith target area of the nth frame Ni The calculation formula is as follows:
T Ni =(T (N-1)i -E (N-1)i +T 0 )*Complexity(i)/SUM(Complexity)
wherein T is (N-1)i A target bit number E which is the ith target area of the N-1 th frame (N-1)i Is the number of coded bits, T, of the ith target area of the N-1 th frame 0 Is the base number of bits.
It should be noted that, because the complexity of the target area characterizes the difference between the ith target area of the nth frame image and the ith target area of the N-1 frame image, the target bit number of the corresponding target area of the next frame image is calculated based on the proportion of the complexity of the target area in a certain frame image to the complexity of the frame image as a calculation proportion, so that the bit number required by the next frame image can be estimated more accurately, the encoder can encode the next frame image more effectively, and the overflow of the buffer is avoided.
Step S804: if the number of coding bits of the ith target area of the N-1 frame image is larger than the number of target bits, lifting a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
Step S805: if the number of coding bits of the ith target area of the N-1 frame image is smaller than the number of target bits, reducing a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
step S806: if the number of coding bits of the ith target area of the N-1 frame image is equal to the number of target bits, determining that the compression factor of the ith target area of the N-1 frame image is the compression factor of the ith target area of the N frame image;
step S807: and encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image.
Steps S804-807 are identical to the corresponding steps in embodiment 4, and are not described in detail in this embodiment.
In summary, in the video coding control method provided in this embodiment, the target bit number of the i-th target area of the N-1-th frame image is an estimated value, and the method further includes: estimating the target bit number specifically includes: and determining the basic bit number of each target area based on a target code rate, a target frame rate and the number of target areas in each frame of image, wherein the target code rate is related to a transmission channel for transmitting the coded target streaming media, and the target frame rate is related to the target streaming media. In this embodiment, based on the target code rate and the target frame rate related to the transmission channel for delivering the encoded target streaming media, the number of target bits in each frame of image is combined to determine the basic bit number of each target area, so as to estimate the target bit number of the i-th target area in the N-1-th frame of image based on the basic bit number, and the target bit number of each target area can be estimated more accurately in combination with the condition of the transmission channel.
Corresponding to the embodiment of the video coding control method provided by the application, the application also provides an embodiment of a device applying the video coding control method.
Fig. 9 is a schematic structural diagram of an embodiment of a video coding control device provided in the present application, where the device includes the following structures: an acquisition module 901 and an encoding module 902;
the obtaining module 901 is configured to obtain a target streaming media;
the encoding module 902 is configured to encode each frame of image in the image sequence based on the image sequence of the target streaming media, where the target streaming media meets a target display parameter;
wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
Optionally, the encoding module includes:
a dividing unit dividing into at least two target areas with a preset encoding unit based on a target number for each frame of image;
the coding unit is used for respectively coding the at least two target areas;
wherein, the number of target areas divided by each frame image in the image sequence of the streaming media is the same.
Optionally, the encoding unit includes:
a determining subunit, configured to determine, based on the number of encoding bits of the ith target area of the nth frame image, a compression factor of the ith target area of the nth frame image, where N is an integer greater than 1, and i is a positive integer;
And the coding subunit is used for coding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image to obtain the coding bit number of the ith target area of the nth frame image.
Optionally, the determining subunit is specifically configured to:
if the number of coding bits of the ith target area of the N-1 frame image is larger than the number of target bits, lifting a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
if the number of coding bits of the ith target area of the N-1 frame image is smaller than the number of target bits, reducing a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
if the number of coding bits of the ith target area of the N-1 frame image is equal to the number of target bits, determining that the compression factor of the ith target area of the N-1 frame image is the compression factor of the ith target area of the N frame image;
wherein the value of the compression factor is inversely related to the number of coded bits, which are positively related to the encoded sharpness.
Optionally, the target bit number of the i-th target area of the N-1-th frame image is a predicted value, and further includes:
And the estimating subunit is used for estimating the target bit number.
Optionally, the estimating subunit is specifically configured to:
and determining the basic bit number of each target area based on the target code rate, the target frame rate and the number of the target areas in each frame of image, wherein the target code rate is related to a transmission channel for transmitting the coded target streaming media.
Optionally, if the current frame is a 1 st frame image, the target bit number of the i-th target area of the 1 st frame image is the basic bit number;
and if the current frame is an N-th frame image, the target bit number of the ith target area of the N-th frame image comprises the sum of the difference value of the target bit number of the ith target area of the N-1 th frame and the coding bit number of the ith target area of the N-1 th frame and the basic bit number.
Optionally, if the current frame is an nth frame image, the ratio of the complexity of the ith target area of the nth-1 frame to the complexity of the nth-1 frame determines the target bit number of the ith target area of the nth frame image.
It should be noted that, please refer to the explanation in the foregoing method embodiment for each structural function of the video coding control device provided in the present embodiment, which is not described in detail in the present embodiment.
In summary, according to the video coding control device provided in this embodiment, eucalyptus is displayed based on the target streaming media meeting the target, and each frame of image in the image sequence in the target streaming media is coded, wherein the number of coding bits after coding of different target areas of at least one frame of image is different, so that coding of different target areas in a certain frame of image in the target streaming media by adopting different coding parameters is realized, the number of bits of data obtained after coding of different areas is different, the stability of the data stream entering the buffer is ensured, and the overflow or underflow of the buffer is avoided.
Corresponding to the embodiment of the video coding control method provided by the application, the application also provides the electronic equipment and the readable storage medium corresponding to the video coding control method.
Wherein, this electronic equipment includes: an encoder and a decoder;
the encoder is used for encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters;
the buffer is used for buffering the data coded by the coder and outputting the data through a transmission channel;
The encoder realizes that the number of coded bits of at least one frame of image after being coded aiming at different target areas is different at least based on the buffer result of the buffer;
the encoder is integrated in a processor of the electronic device, the buffer is a part of storage space in a memory of the electronic device, or the encoder and the buffer are integrated in a preset functional chip.
The method for implementing video coding control of the electronic device is implemented by referring to the embodiment of the video coding control method.
Corresponding to the embodiment of the video coding control method provided by the application, the application also provides a readable storage medium corresponding to the video coding control method.
Wherein the readable storage medium has stored thereon a computer program which is invoked and executed by a processor to implement the steps of the video coding control method according to any of the preceding claims.
The computer program stored in the readable storage medium is executed to implement the video coding control method, and the embodiment of the video coding control method is referred to.
In the present specification, each embodiment is described in a progressive manner, and each embodiment is mainly described in a different point from other embodiments, and identical and similar parts between the embodiments are all enough to refer to each other. The device provided in the embodiment corresponds to the method provided in the embodiment, so that the description is simpler, and the relevant points refer to the description of the method.
The previous description of the provided embodiments is provided to enable any person skilled in the art to make or use the present application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the application. Thus, the present application is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features provided herein.

Claims (10)

1. A video coding control method, comprising:
obtaining a target streaming media;
encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters;
wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
2. The method of claim 1, the encoding for each frame of image in the sequence of images comprising:
dividing each frame of image into at least two target areas based on target number of preset coding units;
encoding the at least two target areas respectively;
Wherein, the number of target areas divided by each frame image in the image sequence of the streaming media is the same.
3. The method of claim 2, the encoding the at least two target regions separately, comprising:
determining a compression factor of an ith target area of an nth frame image based on the number of coding bits of the ith target area of the nth-1 frame image, wherein N is an integer greater than 1, and i is a positive integer;
and encoding the ith target area of the nth frame image based on the compression factor of the ith target area of the nth frame image, so as to obtain the encoding bit number of the ith target area of the nth frame image.
4. A method according to claim 3, wherein the determining the compression factor of the ith target area of the nth frame image based on the number of encoding bits of the ith target area of the nth-1 frame image comprises:
if the number of coding bits of the ith target area of the N-1 frame image is larger than the number of target bits, lifting a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
if the number of coding bits of the ith target area of the N-1 frame image is smaller than the number of target bits, reducing a target value based on the compression factor of the ith target area of the N-1 frame image, and obtaining the compression factor of the ith target area of the N frame image;
If the number of coding bits of the ith target area of the N-1 frame image is equal to the number of target bits, determining that the compression factor of the ith target area of the N-1 frame image is the compression factor of the ith target area of the N frame image;
wherein the value of the compression factor is inversely related to the number of coded bits, which are positively related to the encoded sharpness.
5. The method of claim 4, the target number of bits of the i-th target region of the N-1 th frame image being an estimated value, the method further comprising:
and estimating the target bit number.
6. The method of claim 5, the predicting the target number of bits comprising:
and determining the basic bit number of each target area based on the target code rate, the target frame rate and the number of the target areas in each frame of image, wherein the target code rate is related to a transmission channel for transmitting the coded target streaming media.
7. The method according to claim 6, wherein the method comprises,
if the current frame is a 1 st frame image, the target bit number of the i-th target area of the 1 st frame image is the basic bit number;
and if the current frame is an N-th frame image, the target bit number of the ith target area of the N-th frame image comprises the sum of the difference value of the target bit number of the ith target area of the N-1 th frame and the coding bit number of the ith target area of the N-1 th frame and the basic bit number.
8. The method according to claim 5,
and if the current frame is an N-th frame image, determining the target bit number of the i-th target area of the N-th frame image according to the proportion of the complexity of the i-th target area of the N-1-th frame to the complexity of the N-1-th frame.
9. A video encoding control apparatus comprising:
the obtaining module is used for obtaining the target streaming media;
the encoding module is used for encoding each frame of image in the image sequence based on the image sequence of the target streaming media, and the target streaming media meets target display parameters;
wherein, at least one frame of image has different coded bit numbers aiming at different target areas.
10. An electronic device, comprising: an encoder, a buffer;
the encoder is used for encoding each frame of image in the image sequence based on the image sequence of the target streaming media, wherein the target streaming media meets target display parameters;
the buffer is used for buffering the data coded by the coder and outputting the data through a transmission channel;
the encoder realizes that the number of coded bits of at least one frame of image after being coded aiming at different target areas is different at least based on the buffer result of the buffer;
The encoder is integrated in a processor of the electronic device, the buffer is a part of storage space in a memory of the electronic device, or the encoder and the buffer are integrated in a preset functional chip.
CN202310341090.XA 2023-03-31 2023-03-31 Video coding control method and device and electronic equipment Pending CN116366850A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310341090.XA CN116366850A (en) 2023-03-31 2023-03-31 Video coding control method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310341090.XA CN116366850A (en) 2023-03-31 2023-03-31 Video coding control method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN116366850A true CN116366850A (en) 2023-06-30

Family

ID=86930813

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310341090.XA Pending CN116366850A (en) 2023-03-31 2023-03-31 Video coding control method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN116366850A (en)

Similar Documents

Publication Publication Date Title
RU2527740C2 (en) Video encoding control method, video encoding device and video encoding programme
US6229849B1 (en) Coding device and method
US8189660B2 (en) Bit rate control method and apparatus
US10944970B2 (en) Video coding method, computer device, and storage medium
CN101325698B (en) Bit rate control method and apparatus for intra-only video sequence coding
US20060062481A1 (en) Apparatuses, computer program product and method for bit rate control of digital image encoder
CN111131828B (en) Image compression method and device, electronic equipment and storage medium
CN102647586A (en) Code rate control method and device used in video coding system
CN111556315A (en) Data transmission method and device
US8494047B2 (en) Encoding device, method for adjusting target amount of code and record medium
EP4333433A1 (en) Video coding method and apparatus, and electronic device
US20050078756A1 (en) Encoding apparatus and encoding method
TW201933867A (en) Sending device, sending method, and program
US8780977B2 (en) Transcoder
CN116366850A (en) Video coding control method and device and electronic equipment
JP2004328150A (en) Moving picture coding apparatus and method
JP4586340B2 (en) Encoding apparatus, encoding method, and program
EP1841237B1 (en) Method and apparatus for video encoding
CN112822493A (en) Adaptively encoding video frames based on complexity
US20050031032A1 (en) Method of buffer management in video encoder
CN104025595B (en) Method for encoding images and picture coding device
CN116248895B (en) Video cloud transcoding method and system for virtual reality panorama roaming
JPH06113271A (en) Picture signal coding device
CN112312136B (en) Code stream control method and device
JP6760918B2 (en) Coding device, bit rate control method and computer program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination