CN111918066B - Video encoding method, device, equipment and storage medium - Google Patents

Video encoding method, device, equipment and storage medium Download PDF

Info

Publication number
CN111918066B
CN111918066B CN202010935057.6A CN202010935057A CN111918066B CN 111918066 B CN111918066 B CN 111918066B CN 202010935057 A CN202010935057 A CN 202010935057A CN 111918066 B CN111918066 B CN 111918066B
Authority
CN
China
Prior art keywords
quantization parameter
original image
region
parameter offset
interest
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.)
Active
Application number
CN202010935057.6A
Other languages
Chinese (zh)
Other versions
CN111918066A (en
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.)
Beijing ByteDance Network Technology Co Ltd
Original Assignee
Beijing ByteDance Network Technology Co 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 Beijing ByteDance Network Technology Co Ltd filed Critical Beijing ByteDance Network Technology Co Ltd
Priority to CN202010935057.6A priority Critical patent/CN111918066B/en
Publication of CN111918066A publication Critical patent/CN111918066A/en
Application granted granted Critical
Publication of CN111918066B publication Critical patent/CN111918066B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/167Position within a video image, e.g. region of interest [ROI]
    • 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/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • 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
    • H04N19/176Methods 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 the region being a block, e.g. a macroblock

Landscapes

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

Abstract

The embodiment of the disclosure provides a video coding method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring a video to be coded, wherein the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region; aiming at each frame of original image, adjusting the quantization parameter of the region of interest of the original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the non-region of interest of the original image by adopting a second quantization parameter offset; and coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target image code stream, wherein the code rate of the target code stream is the same as that of the original image. The embodiment of the disclosure can avoid the problem that the instantaneous code rate of the video fluctuates to influence the image quality when the region of interest changes in the video playing process.

Description

Video encoding method, device, equipment and storage medium
Technical Field
The disclosed embodiments relate to the field of video technologies, and in particular, to a video encoding method, apparatus, device, and storage medium.
Background
In the video field, in order to facilitate storage and transmission of video, it is often necessary to perform coding compression on original video to remove redundancy in spatial and temporal dimensions. In view of that users often pay more attention to important image regions, currently, a region of interest (ROI) technology is adopted to sacrifice the image quality of non-ROI regions, and only high-definition video coding is performed on ROI regions, so as to meet the requirement of high-definition video monitoring of users.
The ROI technology is used for distributing more code rates to an ROI area by manually adjusting the distribution of bits in a picture, so that the overall subjective image quality of a video is improved. Since the picture quality of video coding is inversely related to the quantization parameter QP, i.e., the picture quality is better when the QP is smaller, the current ROI coding scheme generally reduces the QP of the ROI region to improve the picture quality. However, the quantization parameter QP is inversely related to the video rate, i.e. the smaller the QP, the higher the video rate. Therefore, the current ROI coding scheme makes the bitrate of the entire video frame large. In order to reduce the bitrate of the whole video frame, the current ROI coding scheme reduces the bitrate of the whole video frame by increasing the overall QP of the subsequent frame.
However, when the ROI region changes, such as appears or disappears, and becomes larger or smaller, the instantaneous code rate of the video greatly fluctuates, causing picture jitter to affect the picture quality.
Disclosure of Invention
The disclosed embodiments provide a video encoding method, apparatus, device and storage medium, so as to overcome the problem that when a ROI region changes, such as appears or disappears, becomes larger or smaller, the instantaneous code rate of a video will fluctuate greatly, thereby causing picture jitter to affect the image quality.
In a first aspect, an embodiment of the present disclosure provides a video encoding method, including:
acquiring a video to be coded, wherein the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region;
aiming at each frame of original image, adjusting the quantization parameter of the region of interest of the original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset;
and coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target image code stream, wherein the code rate of the target code stream is the same as that of the original image.
In a second aspect, an embodiment of the present disclosure provides a video encoding apparatus, including:
the device comprises an acquisition module, a coding module and a decoding module, wherein the acquisition module is used for acquiring a video to be coded, the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region;
the adjusting module is used for adjusting the quantization parameter of the region of interest of each frame of original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset;
and the coding module is used for coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target code stream, wherein the code rate of the target code stream is the same as that of the original image.
In a third aspect, an embodiment of the present disclosure provides an electronic device, including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the video encoding method as described above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, the embodiments of the present disclosure provide a computer-readable storage medium, in which computer-executable instructions are stored, and when a processor executes the computer-executable instructions, the video encoding method according to the first aspect and various possible designs of the first aspect are implemented.
The method comprises the steps of firstly obtaining a video to be coded, wherein the video to be coded comprises a plurality of frames of original images, each frame of original image comprises an interested area and a non-interested area, then aiming at each frame of original image, adjusting quantization parameters of the interested area of the original image by adopting a first quantization parameter offset, adjusting the quantization parameters of the non-interested area of the original image by adopting a second quantization parameter offset, then coding the original image according to the quantization parameters after the interested area is adjusted and the quantization parameters after the non-interested area is adjusted to obtain a target code stream, and after the target code stream is processed, the code rate of the target code stream is the same as that of the original image; and finally, carrying out video coding according to the target code stream corresponding to each frame of original image. The embodiment can avoid the problem that the instantaneous code rate of the video greatly fluctuates when the ROI changes, such as appears or disappears, becomes larger or smaller, so that the picture jitter affects the image quality in the video playing process.
Drawings
In order to more clearly illustrate the embodiments of the present disclosure or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present disclosure, and for those skilled in the art, other drawings can be obtained according to the drawings without inventive exercise.
Fig. 1 is an exemplary diagram of a video encoder provided by an embodiment of the present disclosure;
fig. 2 is a first flowchart of a video encoding method according to an embodiment of the disclosure;
FIG. 3 is a schematic diagram of image partitioning provided by an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a video encoding method according to an embodiment of the disclosure;
fig. 5 is a schematic diagram of an implementation manner for determining a code rate of an estimated code stream according to an embodiment of the present disclosure;
fig. 6 is a schematic diagram of a correspondence relationship between video identifiers and quantization parameter sets according to an embodiment of the present disclosure;
fig. 7 is a schematic encoding diagram of a video encoder provided in an embodiment of the present disclosure;
fig. 8 is a block diagram of a video encoding apparatus according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
To make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described clearly and completely with reference to the drawings in the embodiments of the present disclosure, and it is obvious that the described embodiments are some, but not all embodiments of the present disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Macroblock (Macroblock): is a basic concept in video coding technology, which implements different compression strategies for different image positions by dividing a picture into blocks of different sizes. In video coding, a coded picture is usually divided into macroblocks, a macroblock consisting of a block of luminance pixels and additionally two blocks of chrominance pixels. In general, a luminance block is a 16 × 16 pixel block, and the size of two chrominance image pixel blocks depends on the sampling format of its image, such as: for a YUV420 sample image, the chroma block is a block of pixels 8x8 in size. In each image, a plurality of macro blocks are arranged in a form of a slice, and a video coding algorithm codes the macro blocks one by taking the macro blocks as units to organize a continuous video code stream.
Fig. 1 is an exemplary diagram of a video encoder provided in an embodiment of the present disclosure. As shown in fig. 1, the video encoder 10 includes: an encoder code rate control module 11, an ROI code control module 12 and an encoding module 13; the encoder rate control module 11 is configured to output a quantization parameter QP of each macroblock in each frame of image according to a target of rate control of the entire input video; the ROI code control module 12 is configured to perform ROI coding, for example, modify a quantization parameter QP of each frame of image output by the encoder code control module 11 to reduce the QP of the ROI area and improve image quality, so as to facilitate subsequent video compression; and the encoding module 13 is configured to perform other encoding processes according to the modified QP, and output the encoded video code stream.
In the prior art, in the ROI encoding process, a QP offset is usually added on the basis of the QP of the ROI output by the encoder rate control module 11, so as to reduce the QP of the ROI and improve the image quality of the ROI, but at the same time, the rate of the current image is also increased, which affects the compression effect. In order to obtain a good compression effect, in the prior art, the QP of the subsequent frame image is usually controlled according to the code rate control target of the whole input video, and the code rate of the whole video frame is reduced to be basically consistent with the code rate control target. Although the code rate of the whole video can be guaranteed to be unchanged, if the ROI area changes, for example appears or disappears, and becomes larger or smaller, the instantaneous code rate of the video greatly fluctuates, and the image quality is affected. In some real-time video scenes, such as live broadcast, live communication, etc., the playing is paused, and the user experience is affected.
In view of the above technical problems, the embodiment of the present disclosure increases the QP of the current frame image while decreasing the QP of the ROI region of the current frame image, so that the code rate of the current frame image is consistent with the original code rate for each frame image, thereby avoiding the problem that the image quality is affected by a large fluctuation of the instantaneous code rate of the video if the ROI region changes, such as appears or disappears, becomes larger or smaller, for the entire video.
Fig. 2 is a first flowchart of a video encoding method according to an embodiment of the disclosure. The method of this embodiment can be applied to a video encoder, as shown in fig. 2, and the video encoding method includes:
s201, obtaining a video to be coded.
The video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested area and a non-interested area.
Fig. 3 is a schematic diagram of image division provided in the embodiment of the present disclosure. As shown in fig. 3, one frame image 30 includes an ROI region 31 and a non-ROI region 32; the ROI is an image region selected from the image, and the region is a key region concerned by image analysis, which may be a foreground region of the image or a small region in the foreground region; the non-ROI region refers to the remaining image region except for the ROI region in the image. It should be understood that the box representation of the ROI in fig. 3 is only an exemplary illustration, and in practice, the ROI may be delineated by a circle, an ellipse, an irregular polygon, etc.
Before this step, the ROI region and the non-ROI region of the original image also need to be detected. Alternatively, the ROI region and the non-ROI region of the original image may be detected by some existing ROI region detection algorithm, or may be detected by an ROI region detection model. The ROI area detection model is obtained by training a neural network according to a large number of sample images and labeling information (labeling ROI areas and non-ROI areas).
It should be understood that the type of ROI region detection algorithm is not specifically limited by the embodiments of the present disclosure, as any algorithm capable of detecting ROI regions is within the scope of the present disclosure.
S202, aiming at each frame of original image, adjusting the quantization parameter of the interested area of the original image by adopting a first quantization parameter offset, and adjusting the non-interested area of the original image by adopting a second quantization parameter offset.
In this embodiment, the code rate of the original image is pre-allocated or allocated in real time before step S202, and it may be allocated according to the code rate control target of the whole video, and how to allocate the code rate of each frame of image in the whole video is not described in detail herein.
Referring to fig. 1, after outputting the QP of each macroblock, the encoder rate control module outputs an initial quantization parameter of the ROI area and an initial quantization parameter of the non-ROI area, where the initial quantization parameter of each macroblock of the ROI area may be the same or different, and similarly, the initial quantization parameter of each macroblock of the non-ROI area may be the same or different, which depends on the rate control algorithm and the rate control target adopted by the encoder rate control module.
In this embodiment, adjusting the quantization parameter of the region of interest of the original image by using the first quantization parameter offset includes: a first quantization parameter offset is added on the basis of the initial quantization parameter for each macroblock of the region of interest. Specifically, it can be expressed as the following formula (1):
QPROI=QPROI0+QP1; (1)
in formula (1), QPROIFor adjusting the quantization parameter of the ROI area, QPROI0For the initial quantization parameter, QP, of the ROI area1Is firstThe parameter offset is quantized.
Similarly, the adjusting the quantization parameter of the non-interesting region of the original image by using the second quantization parameter offset comprises: and adding a second quantization parameter offset on the basis of the initial quantization parameter of each macro block of the non-interested region. Specifically, it can be expressed as the following formula (2):
QPfROI=QPfROI0+QP2
in formula (2), QPfROIFor the adjusted quantization parameter of the non-ROI region, QPfROI0Initial quantization parameter, QP, for non-ROI regions2Is a second quantization parameter offset.
S203, encoding the original image according to the quantization parameters adjusted for the interested region and the quantization parameters adjusted for the non-interested region to obtain a target code stream.
The initial quantization parameter of the region of interest of the original image and the initial quantization parameter of the non-region of interest of the original image are respectively adjusted in the step S202, the first quantization parameter offset can improve the image quality of the current frame image and reduce the code rate of the current frame image, and the second quantization parameter offset can reduce the code rate of the current frame image, so that after the initial quantization parameter of the region of interest of the original image and the initial quantization parameter of the non-region of interest of the original image are respectively adjusted in the step S202, the code rate of the obtained target code stream can be kept the same as the code rate of the original image.
In this step, other encoding processes are performed on each frame of original image after the quantization parameter is adjusted, so as to obtain a final video code stream (target code stream). The finally obtained video code stream can be provided for a client to play videos, or perform video storage, video transmission and the like.
The method includes the steps of obtaining a video to be coded, wherein the video to be coded includes multiple frames of original images, each frame of original image includes an interested area and a non-interested area, then, aiming at each frame of original image, adjusting quantization parameters of the interested area of the original image by adopting a first quantization parameter offset, adjusting quantization parameters of the non-interested area of the original image by adopting a second quantization parameter offset, and then, coding the original image according to the quantization parameters adjusted for the interested area and the quantization parameters adjusted for the non-interested area to obtain a target code stream, wherein the first quantization parameter offset aims to improve the image quality of a current frame image, the first quantization parameter offset can also improve the code rate of the current frame image, the second quantization parameter offset aims to reduce the code rate of the current frame image, and the target code stream is obtained by processing the interested area of the original image, After the initial quantization parameter of the non-interesting region is adjusted, the code rate of the target code stream is kept the same as that of the original image, so that in the video playing process, even if the ROI changes, such as appears or disappears, and becomes larger or smaller, the instantaneous code rate of the video does not fluctuate, and the picture stability is ensured.
Referring to fig. 4, fig. 4 is a schematic flowchart illustrating a video encoding method according to an embodiment of the disclosure. In this embodiment, a process of determining a first quantization parameter offset before adjusting a quantization parameter of a region of interest of each frame of an original image by using the first quantization parameter offset is described in detail, where the video encoding method includes:
s401, determining the offset of the first sub-quantization parameter.
The first sub-quantization parameter offset is used for adjusting the original image to reduce the code rate of the estimated code stream, and the estimated code stream is obtained by estimating the code stream after the quantization parameter of the region of interest is adjusted by adopting the second sub-quantization parameter offset.
S402, determining a second sub-quantization parameter offset.
The second sub-quantization parameter offset is used for adjusting the quantization parameter of the region of interest of the original image to improve the image quality of the region of interest, and is determined according to the image quality difference between the region of interest and the non-region of interest.
Optionally, the second sub-quantization parameter offset is determined according to a difference between image quality of the region of interest and the region of non-interest, and the difference between image quality can be measured by using the quantization parameter QP, so that the second sub-quantization parameter offset can be determined according to a difference between the quantization parameter of the region of interest and the quantization parameter of the region of non-interest.
In this embodiment, the second sub-quantization parameter offset is a system input of the video encoder, and for how to specifically determine the quantization parameter difference between the region of interest and the region of no interest, reference may be made to the description of the existing video encoding method, and this embodiment will not be described in detail here.
And S403, determining a first quantization parameter offset according to the difference value of the first sub-quantization parameter offset and the second sub-quantization parameter offset.
This embodiment can be expressed as the following equation (3):
QP1=QP11-QP12; (3)
in formula (3), QP1For the first quantization parameter offset, QP11For the first sub-quantization parameter offset, QP12Is the second sub-quantization parameter offset.
In an embodiment of the present disclosure, on the basis of the embodiment of fig. 4, step S401 specifically includes:
s4011, obtaining the code rate of the original image.
In this embodiment, the code rate of the original image is predetermined and stored in the storage component, and the code rate of the original image may be allocated according to a code rate control target of the whole video, and specifically, how to allocate the code rate of each frame of image in the whole video may refer to introduction of video coding in the prior art, and details are not described here.
S4012, determining the code rate of the estimated code stream.
After the initial quantization parameter of the ROI region of the current frame original image is adjusted, the code rate of the original image may change, and the original image with the changed code rate is referred to as an estimated code stream in the embodiment of the present disclosure. In order to facilitate the control of the code rate of the entire estimated code stream, so as to reduce the code rate of the entire estimated code stream to the code rate of the original image, the code rate of the estimated code stream also needs to be obtained. Specifically, determining the code rate of the estimated code stream may have at least three different implementation manners:
in one embodiment of the present disclosure, determining a bitrate for an intermediate image comprises:
step a1, determining the area ratio of the interested area in the original image.
The method for determining the area ratio of the region of interest in the original image comprises the following steps: and determining the area ratio of the region of interest in the original image according to the ratio of the area of the region of interest to the area of the original image.
Optionally, the ratio of the area of the region of interest to the area of the original image may be determined according to the ratio of the number of pixels included in the region of interest to the number of pixels included in the original image. For example, the ratio of the number of pixels included in the region of interest to the number of pixels included in the original image is used as the ratio of the area of the region of interest to the area of the original image.
Optionally, the ratio of the area of the region of interest to the area of the original image may also be determined according to the ratio of the number of macroblocks included in the region of interest to the number of macroblocks included in the original image. For example, the ratio of the number of macroblocks of the region of interest to the number of macroblocks of the original image is taken as the ratio of the area of the region of interest to the area of the original image.
Step a2, determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the area ratio of the region of interest in the original image and the code rate of the original image.
Specifically, step a2 can be expressed as the following formula (4):
Figure BDA0002671633190000081
in the formula (4), B1To estimate the code rate of the code stream, B is the code rate of the original image, a is the area ratio of the interested region in the original image, Q12Is the second sub-quantization parameter offset.
The method is suitable for scenes with the same complexity of the region of interest and the region of non-interest, however, in practical application, the complexity of the region of interest and the complexity of the region of non-interest are often different, and as an engineering approximation, the complexity of the region of interest and the complexity of the region of non-interest can be considered to be the same, that is, the method of the embodiment is also suitable for scenes with different complexity of the region of interest and the complexity of the region of non-interest.
In another embodiment of the present disclosure, determining a bitrate for an intermediate image comprises:
and b1, determining the area ratio of the region of interest in the original image.
The specific implementation process of step b1 can be referred to the specific implementation process of step a1, and the description of this embodiment is not repeated here.
And b2, determining the complexity parameter.
Wherein the complexity parameter is used to represent the complexity of the region of interest with respect to the original image. In an alternative embodiment, the complexity parameter may be determined using the following formula: the complexity parameter is ROI region complexity/original image complexity constant b.
In another alternative embodiment, the complexity parameter may also be predetermined according to an experimental value, or may be determined by performing complexity analysis on each frame of the original image. The complexity analysis of each frame of original image may use an existing complexity analysis algorithm, and the embodiment of the present disclosure is not described in detail herein.
And b3, determining the code rate of the estimated code stream according to the offset of the second sub-quantization parameter, the complexity parameter, the area ratio of the region of interest in the original image and the code rate of the original image.
Specifically, step b3 can be expressed as the following formula (5):
Figure BDA0002671633190000091
in the formula (5), B1To estimate the code rate of the code stream, B is the code rate of the original image, c is the complexity parameter, a is the area ratio of the interested area in the original image, Q12Quantizing parameters for the second sub-partA number offset.
In the two embodiments, the code rate of the estimated code stream is estimated, and in order to make the code rate of the estimated code stream more accurate, in a further embodiment of the present disclosure, the determining the code rate of the estimated code stream may further include:
and c1, inputting the original image processed by the first quantization parameter offset to the quantization parameter of the region of interest into the video encoder.
And step c2, determining the code rate of the estimated code stream according to the output of the video encoder.
Fig. 5 is a schematic diagram of an implementation manner for determining a code rate of an estimated code stream according to the embodiment of the present disclosure. As shown in fig. 5, after the estimated code stream is obtained in step c1, the estimated code stream may be input into the encoding module, and the code rate of the estimated code stream may be determined by the intermediate code rate output after the encoding module encodes the estimated code stream. And the code rate of the estimated code stream is fed back to the ROI code control module, so that the code control module further executes the step of determining the offset of the first sub-quantization parameter according to the code rate of the estimated code stream and the code rate of the original image.
Step S4013, determining a first sub-quantization parameter offset according to the code rate of the original image and the code rate of the estimated code stream.
This embodiment can be expressed as the following formula (6):
Figure BDA0002671633190000101
in formula (6), QP1For the first quantization parameter offset, QP11For the first sub-quantization parameter offset, QP12Is the second sub-quantization parameter offset.
In one embodiment of the present disclosure, the second quantization parameter offset may be a first sub-quantization parameter offset. For how to determine the offset of the first sub-quantization parameter, reference may be made to the description of the above embodiments, and details are not described here.
In this embodiment, the quantization parameter of the adjusted ROI region can also be expressed as the following manner (7):
QPROI=QPROI0+QP11-QP12; (7)
in formula (7), QPROIFor adjusting the quantization parameter of the ROI area, QPROI0For the initial quantization parameter, QP, of the ROI area11For the first sub-quantization parameter offset, QP12Is the second sub-quantization parameter offset.
The quantization parameter of the adjusted non-ROI region can also be expressed as follows (8):
QPfROI=QPfROI0+QP11; (8)
in formula (8), QPfROIFor the adjusted quantization parameter of the non-ROI region, QPfROI0Initial quantization parameter, QP, for non-ROI regions11Is the first sub-quantization parameter offset.
As can be seen from the above equations (7) and (8), after the quantization parameter adjustment of the embodiment of the present disclosure, the quantization parameter difference between the region of interest and the non-region of interest is still QP12QP of12The method and the device are used for representing the image quality difference between the interested area and the non-interested area, so that after the quantization parameter adjustment of the embodiment of the disclosure, the image quality difference between the interested area and the non-interested area in the target image is the same as the image quality difference between the interested area and the non-interested area in the original image, and thus, the final code rate can be ensured to be stable, and meanwhile, the image quality difference between the interested area and the non-interested area is also kept stable.
The method and the device are also suitable for scenes with the same complexity of the interested region and the non-interested region and scenes with different complexity of the interested region and the non-interested region, and the determined accuracy of the estimated code stream can be higher by adding the complexity parameter.
The above embodiment is suitable for a scene in which a video to be coded cannot be taken in advance, in the scene, the video to be coded, the second quantization sub-parameter offset of each frame of original image in the video to be coded and the code rate of each frame of original image are obtained, then the second quantization sub-parameter offset of each frame of original image in the video to be coded and the code rate of each frame of original image in the video to be coded are input into a video encoder, so that the video encoder determines the area ratio of an interested area in the original image according to the video to be coded, and calculates the first quantization sub-parameter offset according to the area ratio of the interested area in the original image and the second quantization sub-parameter offset to determine the first quantization parameter offset for adjusting the quantization parameter of the interested area and the second quantization parameter offset for adjusting the quantization parameter of a non-interested area, therefore, for scenes in which the video to be coded cannot be taken in advance, the problem that the picture quality is affected by picture jitter caused by large fluctuation of the instantaneous code rate of the video when the ROI changes, such as appearance or disappearance, becomes large or small is avoided.
In an embodiment of the present disclosure, for a scene in which a video to be encoded can be taken in advance, in order to reduce the amount of calculation of the ROI coding control module and increase the speed of video encoding, the first quantization parameter offset and the second quantization parameter offset determined in the foregoing embodiment may also be stored in the storage unit in advance, and the storage unit stores the correspondence between the video identifier and the quantization parameter offset set. Specifically, fig. 6 is a schematic diagram of a correspondence relationship between video identifiers and quantization parameter offset sets according to an embodiment of the present disclosure. As shown in fig. 6, the video identifier includes an image identifier of each frame of image in the video, and the quantization parameter offset set includes a first quantization parameter offset and a second quantization parameter offset of each frame of image in the video, and thus, the correspondence relationship between the video identifier and the quantization parameter offset set may further include: and the corresponding relation between the image identification and the quantization parameter offset.
Fig. 7 is a schematic encoding diagram of a video encoder according to an embodiment of the present disclosure. As shown in fig. 7, in the video encoding process, after the video to be encoded is obtained, the video to be encoded corresponds to the video identifier, the corresponding quantization parameter offset set may be directly obtained from the storage component 14 according to the video identifier corresponding to the video to be encoded, and the corresponding quantization parameter offsets (including the first quantization parameter offset and the second quantization parameter offset) may be obtained according to the image identifiers of each frame of image in the video to be encoded. Step S202 of the embodiment of fig. 2 is executed again.
Specifically, on the basis of the above embodiment of fig. 2, before the step S202, for each frame of the original image, adjusting the initial quantization parameter of the region of interest of the original image by using the first quantization parameter offset, and adjusting the initial quantization parameter of the region of non-interest of the original image by using the second quantization parameter offset, the method further includes: and acquiring a first quantization parameter offset and a second quantization parameter offset corresponding to the image identifier according to the image identifier of the original image and the corresponding relationship between the image identifier and the quantization parameter offset.
The first quantization parameter offset is determined according to a difference value of the first sub-quantization parameter offset and the second sub-quantization parameter offset, the first sub-quantization parameter offset is determined according to a difference value of quantization parameters of an interested region and a non-interested region, the second sub-quantization parameter offset is determined according to a code rate of an original image and a code rate of an estimated code stream, and the estimated code stream is a code stream obtained by estimating the code stream after the interested region is adjusted by the second sub-quantization parameter offset.
According to the image identification of the original image and the corresponding relation between the image identification and the quantization parameter offset, the first quantization parameter offset and the second quantization parameter offset corresponding to the image identification are directly obtained and are used for adjusting the quantization parameter of the original image of the current frame.
Fig. 8 is a block diagram of a video encoding apparatus according to an embodiment of the present disclosure, corresponding to the video encoding method of the foregoing embodiment. For ease of illustration, only portions that are relevant to embodiments of the present disclosure are shown. Referring to fig. 8, the apparatus 800 includes: an acquisition module 801, an adjustment module 802 and an encoding module 803.
The acquiring module 801 is configured to acquire a video to be encoded, where the video to be encoded includes multiple frames of original images, and each frame of original image includes an interested region and a non-interested region; an adjusting module 802, configured to adjust, for each frame of original image, a quantization parameter of an interested region of the original image by using a first quantization parameter offset, and adjust a quantization parameter of a non-interested region of the original image by using a second quantization parameter offset; and an encoding module 803, configured to encode the original image according to the quantization parameter adjusted for the region of interest and the quantization parameter adjusted for the region of no interest, so as to obtain a target code stream, where a code rate of the target code stream is the same as a code rate of the original image.
In one embodiment of the present disclosure, each frame of original image corresponds to an image identifier, and there is a corresponding relationship between the image identifier and a quantization parameter offset, where the quantization parameter offset includes a first quantization parameter offset and a second quantization parameter offset; the obtaining module 801 is further configured to: acquiring a first quantization parameter offset and a second quantization parameter offset corresponding to the image identifier according to the image identifier of the original image and the corresponding relationship between the image identifier and the quantization parameter offset; the first quantization parameter offset is determined according to a difference value between a first sub-quantization parameter offset and a second sub-quantization parameter offset, the first sub-quantization parameter offset is determined according to a difference value between quantization parameters of the region of interest and the region of no interest, the second sub-quantization parameter offset is determined according to a code rate of the original image and a code rate of an intermediate image code stream, and the estimated code stream is a code stream obtained by estimating the code stream after the quantization parameters of the region of interest are adjusted by the second sub-quantization parameter offset.
In one embodiment of the present disclosure, the apparatus 800 further comprises: a determination module 804;
the determining module 804 is configured to determine a first sub-quantization parameter offset, where the first sub-quantization parameter offset is used to adjust the original image to reduce a code rate of an estimated code stream, and the estimated code stream is a code stream obtained by estimating a code stream obtained by adjusting the quantization parameter of the region of interest using the second sub-quantization parameter offset;
the obtaining module 801 is further configured to obtain a second sub-quantization parameter offset, where the second sub-quantization parameter offset is used to adjust a quantization parameter of an interested region of the original image and is determined according to an image quality difference between the interested region and the non-interested region;
the determining module 804 is further configured to determine the first quantization parameter offset according to a difference between the first sub-quantization parameter offset and the second sub-quantization parameter offset.
In an embodiment of the present disclosure, the obtaining module 801 is further configured to obtain a code rate of the original image; the determining module 804 is specifically configured to determine a code rate of the estimated code stream; and determining the offset of the first sub-quantization parameter according to the code rate of the original image and the code rate of the estimated code stream.
In an embodiment of the present disclosure, the determining module 804 is specifically configured to determine an area ratio of the region of interest in the original image; and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the area ratio of the region of interest in the original image and the code rate of the original image.
In an embodiment of the present disclosure, the determining module 804 is specifically configured to determine an area ratio of the region of interest in the original image; determining a complexity parameter for representing the complexity of the region of interest relative to the original image; and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the complexity parameter, the area ratio of the region of interest in the original image and the code rate of the original image.
In an embodiment of the present disclosure, the determining module 804 is specifically configured to input, to a video encoder, an original image obtained by processing the quantization parameter of the region of interest by using the first quantization parameter offset; and determining the code rate of the estimated code stream according to the output of the video encoder.
The video encoding apparatus provided in this embodiment may be used to implement the technical solutions of the above method embodiments, and the implementation principles and technical effects thereof are similar, and this embodiment is not described herein again.
Referring to fig. 9, a schematic structural diagram of an electronic device 900 suitable for implementing the embodiment of the present disclosure is shown, where the electronic device 900 may be a terminal device or a server. Among them, the terminal Device may include, but is not limited to, a mobile terminal such as a mobile phone, a notebook computer, a Digital broadcast receiver, a Personal Digital Assistant (PDA), a tablet computer (PAD), a Portable Multimedia Player (PMP), a car terminal (e.g., car navigation terminal), etc., and a fixed terminal such as a Digital TV, a desktop computer, etc. The electronic device shown in fig. 9 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 9, the electronic device 900 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 901, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 902 or a program loaded from a storage means 908 into a Random Access Memory (RAM) 903. In the RAM 903, various programs and data necessary for the operation of the electronic apparatus 900 are also stored. The processing apparatus 901, the ROM902, and the RAM 903 are connected to each other through a bus 904. An input/output (I/O) interface 905 is also connected to bus 904.
Generally, the following devices may be connected to the I/O interface 905: input devices 906 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 907 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 908 including, for example, magnetic tape, hard disk, etc.; and a communication device 909. The communication device 909 may allow the electronic apparatus 900 to perform wireless or wired communication with other apparatuses to exchange data. While fig. 9 illustrates an electronic device 900 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication device 909, or installed from the storage device 908, or installed from the ROM 902. The computer program performs the above-described functions defined in the methods of the embodiments of the present disclosure when executed by the processing apparatus 901.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.
Computer program code for carrying out operations for aspects of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of Network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. Where the name of a unit does not in some cases constitute a limitation of the unit itself, for example, the first retrieving unit may also be described as a "unit for retrieving at least two internet protocol addresses".
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In a first aspect, according to one or more embodiments of the present disclosure, there is provided a video encoding method, including:
acquiring a video to be coded, wherein the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region;
aiming at each frame of original image, adjusting the quantization parameter of the region of interest of the original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset;
and coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target image code stream, wherein the code rate of the target code stream is the same as that of the original image.
According to one or more embodiments of the present disclosure, each frame of original image corresponds to an image identifier, and there is a correspondence between the image identifier and a quantization parameter offset, where the quantization parameter offset includes a first quantization parameter offset and a second quantization parameter offset;
before each frame of original image is obtained, adjusting the quantization parameter of the region of interest of the original image by using a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by using a second quantization parameter offset, the method further includes:
acquiring a first quantization parameter offset and a second quantization parameter offset corresponding to the image identifier according to the image identifier of the original image and the corresponding relationship between the image identifier and the quantization parameter offset;
the first quantization parameter offset is determined according to a difference value between a first sub-quantization parameter offset and a second sub-quantization parameter offset, the first sub-quantization parameter offset is determined according to a difference value between quantization parameters of the region of interest and the region of no interest, the second sub-quantization parameter offset is determined according to a code rate of the original image and a code rate of an intermediate image code stream, and the estimated code stream is a code stream obtained by estimating the code stream after the quantization parameters of the region of interest are adjusted by the second sub-quantization parameter offset.
According to one or more embodiments of the present disclosure, before the adjusting, for each frame of the original image, the quantization parameter of the region of interest of the original image by using the first quantization parameter offset, the method further includes:
determining a first sub-quantization parameter offset, wherein the first sub-quantization parameter offset is used for adjusting the original image to reduce the code rate of an estimated code stream, and the estimated code stream is a code stream obtained by pre-estimating an image code stream obtained by adjusting the quantization parameter of the region of interest by using a second sub-quantization parameter offset;
acquiring a second sub-quantization parameter offset, wherein the second sub-quantization parameter offset is used for adjusting the quantization parameter of the region of interest of the original image and is determined according to the image quality difference between the region of interest and the non-region of interest;
and determining the first quantization parameter offset according to the difference value of the first sub-quantization parameter offset and the second sub-quantization parameter offset.
According to one or more embodiments of the present disclosure, the determining the first sub-quantization parameter offset includes:
acquiring the code rate of the original image;
determining a code rate of an intermediate image code stream, wherein the intermediate image is an image obtained by adjusting the original image by using the second sub-quantization parameter, and the second sub-quantization parameter is determined according to the image quality difference between the interested area and the non-interested area;
and determining the offset of the first sub-quantization parameter according to the code rate of the original image and the code rate of the estimated code stream.
According to one or more embodiments of the present disclosure, the determining a code rate of an intermediate image code stream includes:
determining the area proportion of the region of interest in the original image;
and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the area ratio of the region of interest in the original image and the code rate of the original image.
According to one or more embodiments of the present disclosure, the determining a code rate of an intermediate image code stream includes:
determining the area proportion of the region of interest in the original image;
determining a complexity parameter for representing the complexity of the region of interest relative to the original image;
and determining the code rate of the intermediate image code stream according to the second sub-quantization parameter offset, the complexity parameter, the area ratio of the region of interest in the original image and the code rate of the original image.
According to one or more embodiments of the present disclosure, the determining a code rate of an intermediate code stream includes:
inputting the original image processed by the first quantization parameter offset to the quantization parameter of the region of interest into a video encoder;
and determining the code rate of the estimated code stream according to the output of the video encoder.
According to one or more embodiments of the present disclosure, the second quantization parameter offset is a first sub-quantization parameter offset.
In a second aspect, according to one or more embodiments of the present disclosure, there is provided a video encoding apparatus including:
the device comprises an acquisition module, a coding module and a decoding module, wherein the acquisition module is used for acquiring a video to be coded, the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region; the adjusting module is used for adjusting the quantization parameter of the region of interest of each frame of original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset; and the coding module is used for coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target code stream, wherein the code rate of the target code stream is the same as that of the original image.
In one embodiment of the present disclosure, each frame of original image corresponds to an image identifier, and there is a corresponding relationship between the image identifier and a quantization parameter offset, where the quantization parameter offset includes a first quantization parameter offset and a second quantization parameter offset; the obtaining module is further configured to: acquiring a first quantization parameter offset and a second quantization parameter offset corresponding to the image identifier according to the image identifier of the original image and the corresponding relationship between the image identifier and the quantization parameter offset; the first quantization parameter offset is determined according to a difference value between a first sub-quantization parameter offset and a second sub-quantization parameter offset, the first sub-quantization parameter offset is determined according to a difference value between quantization parameters of the region of interest and the region of no interest, the second sub-quantization parameter offset is determined according to a code rate of the original image and a code rate of an intermediate image code stream, and the estimated code stream is a code stream obtained by estimating the code stream after the quantization parameters of the region of interest are adjusted by the second sub-quantization parameter offset.
In one embodiment of the present disclosure, the apparatus further comprises: a determination module; the determining module is configured to determine a first sub-quantization parameter offset, where the first sub-quantization parameter offset is used to adjust the original image to reduce a code rate of an estimated code stream, and the estimated code stream is a code stream obtained by estimating a code stream obtained by adjusting the quantization parameter of the region of interest using the second sub-quantization parameter offset;
the obtaining module is further configured to obtain a second sub-quantization parameter offset, where the second sub-quantization parameter offset is used to adjust a quantization parameter of an interested region of the original image and is determined according to an image quality difference between the interested region and the non-interested region;
the determining module is further configured to determine the first quantization parameter offset according to a difference between the first sub-quantization parameter offset and the second sub-quantization parameter offset.
In one or more embodiments of the present disclosure, the obtaining module is further configured to obtain a code rate of the original image; the determining module is specifically configured to determine a code rate of the estimated code stream; and determining the offset of the first sub-quantization parameter according to the code rate of the original image and the code rate of the estimated code stream.
In one or more embodiments of the present disclosure, the determining module is specifically configured to determine an area ratio of the region of interest in the original image; and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the area ratio of the region of interest in the original image and the code rate of the original image.
In one or more embodiments of the present disclosure, the determining module is specifically configured to determine an area ratio of the region of interest in the original image; determining a complexity parameter for representing the complexity of the region of interest relative to the original image; and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the complexity parameter, the area ratio of the region of interest in the original image and the code rate of the original image.
In one or more embodiments of the present disclosure, the determining module is specifically configured to input, to a video encoder, an original image obtained by processing the quantization parameter of the region of interest with the first quantization parameter offset; and determining the code rate of the estimated code stream according to the output of the video encoder.
In a third aspect, according to one or more embodiments of the present disclosure, there is provided an electronic device including: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the video encoding method as described above in the first aspect and various possible designs of the first aspect.
In a fourth aspect, according to one or more embodiments of the present disclosure, there is provided a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, implement the video encoding method as set forth in the first aspect and various possible designs of the first aspect.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.

Claims (10)

1. A video encoding method, comprising:
acquiring a video to be coded, wherein the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region;
aiming at each frame of original image, adjusting the quantization parameter of the region of interest of the original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset; the first quantization parameter offset is determined according to a difference value between a first sub-quantization parameter offset and a second sub-quantization parameter offset, the second sub-quantization parameter offset is determined according to a difference value between quantization parameters of the region of interest and the region of no interest, the first sub-quantization parameter offset is determined according to a code rate of the original image and a code rate of an estimated code stream, and the estimated code stream is a code stream obtained by estimating a code stream obtained by adjusting the quantization parameters of the region of interest by using the second sub-quantization parameter offset; the second quantization parameter offset is a first sub-quantization parameter offset;
and coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target code stream, wherein the code rate of the target code stream is the same as that of the original image.
2. The method of claim 1, wherein each frame of original image corresponds to an image identifier, and there is a correspondence between the image identifier and a quantization parameter offset, and the quantization parameter offset comprises the first quantization parameter offset and the second quantization parameter offset;
before the adjusting, for each frame of original image, the quantization parameter of the region of interest of the original image by using the first quantization parameter offset and the quantization parameter of the region of non-interest of the original image by using the second quantization parameter offset, the method further includes:
and acquiring a first quantization parameter offset and a second quantization parameter offset corresponding to the image identifier according to the image identifier of the original image and the corresponding relationship between the image identifier and the quantization parameter offset.
3. The method of claim 1, before adjusting, for each frame of original image, the quantization parameter of the region of interest of the original image with a first quantization parameter offset, the method further comprising:
determining a first sub-quantization parameter offset, wherein the first sub-quantization parameter offset is used for adjusting the original image to reduce the code rate of an estimated code stream, and the estimated code stream is a code stream obtained by pre-estimating the code stream after the quantization parameter of the region of interest is adjusted by adopting a second sub-quantization parameter offset;
acquiring a second sub-quantization parameter offset, wherein the second sub-quantization parameter offset is used for adjusting the quantization parameter of the region of interest of the original image and is determined according to the image quality difference between the region of interest and the non-region of interest;
and determining the first quantization parameter offset according to the difference value of the first sub-quantization parameter offset and the second sub-quantization parameter offset.
4. The method of claim 3, the determining a first sub-quantization parameter offset, comprising:
acquiring the code rate of the original image;
determining the code rate of the estimated code stream;
and determining the offset of the first sub-quantization parameter according to the code rate of the original image and the code rate of the estimated code stream.
5. The method of claim 4, wherein the determining a code rate of the estimated code stream comprises:
determining the area proportion of the region of interest in the original image;
and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the area ratio of the region of interest in the original image and the code rate of the original image.
6. The method of claim 4, wherein the determining a code rate of the estimated code stream comprises:
determining the area proportion of the region of interest in the original image;
determining a complexity parameter for representing the complexity of the region of interest relative to the original image;
and determining the code rate of the estimated code stream according to the second sub-quantization parameter offset, the complexity parameter, the area ratio of the region of interest in the original image and the code rate of the original image.
7. The method of claim 4, wherein the determining a code rate of the estimated code stream comprises:
inputting the original image processed by the second sub-quantization parameter offset to the quantization parameter of the region of interest into a video encoder;
and determining the code rate of the estimated code stream according to the output of the video encoder.
8. A video encoding device, comprising:
the device comprises an acquisition module, a coding module and a decoding module, wherein the acquisition module is used for acquiring a video to be coded, the video to be coded comprises a plurality of frames of original images, and each frame of original image comprises an interested region and a non-interested region;
the adjusting module is used for adjusting the quantization parameter of the region of interest of each frame of original image by adopting a first quantization parameter offset, and adjusting the quantization parameter of the region of non-interest of the original image by adopting a second quantization parameter offset; the first quantization parameter offset is determined according to a difference value between a first sub-quantization parameter offset and a second sub-quantization parameter offset, the second sub-quantization parameter offset is determined according to a difference value between quantization parameters of the region of interest and the region of no interest, the first sub-quantization parameter offset is determined according to a code rate of the original image and a code rate of an estimated code stream, and the estimated code stream is a code stream obtained by estimating a code stream obtained by adjusting the quantization parameters of the region of interest by using the second sub-quantization parameter offset; the second quantization parameter offset is a first sub-quantization parameter offset;
and the coding module is used for coding the original image according to the quantization parameter adjusted for the interested region and the quantization parameter adjusted for the non-interested region to obtain a target code stream, wherein the code rate of the target code stream is the same as that of the original image.
9. An electronic device, comprising: at least one processor and memory;
the memory stores computer-executable instructions;
the at least one processor executing the computer-executable instructions stored by the memory causes the at least one processor to perform the method of any of claims 1-7.
10. A computer-readable storage medium having computer-executable instructions stored thereon which, when executed by a processor, implement the method of any one of claims 1 to 7.
CN202010935057.6A 2020-09-08 2020-09-08 Video encoding method, device, equipment and storage medium Active CN111918066B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010935057.6A CN111918066B (en) 2020-09-08 2020-09-08 Video encoding method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010935057.6A CN111918066B (en) 2020-09-08 2020-09-08 Video encoding method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111918066A CN111918066A (en) 2020-11-10
CN111918066B true CN111918066B (en) 2022-03-15

Family

ID=73267356

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010935057.6A Active CN111918066B (en) 2020-09-08 2020-09-08 Video encoding method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111918066B (en)

Families Citing this family (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112596843B (en) * 2020-12-29 2023-07-25 北京元心科技有限公司 Image processing method, device, electronic equipment and computer readable storage medium
CN113068034B (en) * 2021-03-25 2022-12-30 Oppo广东移动通信有限公司 Video encoding method and device, encoder, equipment and storage medium
CN113038127B (en) * 2021-03-30 2022-03-22 福州大学 ROI-based real-time video multi-path parallel transmission code rate control method
CN112929668B (en) * 2021-04-07 2024-04-26 百果园技术(新加坡)有限公司 Video coding method, device, equipment and storage medium
CN113489993A (en) * 2021-07-22 2021-10-08 Oppo广东移动通信有限公司 Encoding method, apparatus, encoder, device, and computer-readable storage medium
CN113810720A (en) * 2021-08-09 2021-12-17 北京博雅慧视智能技术研究院有限公司 Image processing method, device, equipment and medium
CN113766274A (en) * 2021-09-23 2021-12-07 阿里云计算有限公司 Image encoding method, image decoding method, electronic device, and storage medium
CN116320529A (en) * 2021-12-10 2023-06-23 深圳市中兴微电子技术有限公司 Video code rate control method and device and computer readable storage medium
CN115002512B (en) * 2022-05-23 2023-11-28 北京市商汤科技开发有限公司 Video transcoding method and device, electronic equipment and storage medium
CN115442636A (en) * 2022-07-19 2022-12-06 广州博冠信息科技有限公司 Live video stream conversion method, device, equipment and storage medium
CN115396683B (en) * 2022-08-22 2024-04-09 广州博冠信息科技有限公司 Video optimization processing method and device, electronic equipment and computer readable medium
WO2024040535A1 (en) * 2022-08-25 2024-02-29 深圳市大疆创新科技有限公司 Video processing method and apparatus, device, and computer storage medium
CN115643405A (en) * 2022-09-29 2023-01-24 上海哔哩哔哩科技有限公司 ROI (region of interest) detection-based video coding method and device and computing equipment
CN115988214A (en) * 2022-12-01 2023-04-18 北京首都在线科技股份有限公司 Video frame encoding method, video frame display method and device
CN116760988B (en) * 2023-08-18 2023-11-10 瀚博半导体(上海)有限公司 Video coding method and device based on human visual system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101945275A (en) * 2010-08-18 2011-01-12 镇江唐桥微电子有限公司 Video coding method based on region of interest (ROI)
CN105744271A (en) * 2016-02-17 2016-07-06 浙江大华技术股份有限公司 Video coding method and device
CN106488241A (en) * 2016-10-13 2017-03-08 千目聚云数码科技(上海)有限公司 A kind of area-of-interest method to set up
CN106791856A (en) * 2016-12-28 2017-05-31 天津天地伟业生产力促进有限公司 A kind of method for video coding based on self adaptation area-of-interest
CN110708570A (en) * 2019-10-21 2020-01-17 腾讯科技(深圳)有限公司 Video coding rate determining method, device, equipment and storage medium
CN111479113A (en) * 2020-04-15 2020-07-31 腾讯科技(深圳)有限公司 Code rate control method and device, storage medium and electronic equipment

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103974071A (en) * 2013-01-29 2014-08-06 富士通株式会社 Video coding method and equipment on basis of regions of interest
CN104539962B (en) * 2015-01-20 2017-12-01 北京工业大学 It is a kind of merge visually-perceptible feature can scalable video coding method
CN105049850B (en) * 2015-03-24 2018-03-06 上海大学 HEVC bit rate control methods based on area-of-interest
JP6690254B2 (en) * 2016-01-22 2020-04-28 沖電気工業株式会社 Image coding apparatus, method and program

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101945275A (en) * 2010-08-18 2011-01-12 镇江唐桥微电子有限公司 Video coding method based on region of interest (ROI)
CN105744271A (en) * 2016-02-17 2016-07-06 浙江大华技术股份有限公司 Video coding method and device
CN106488241A (en) * 2016-10-13 2017-03-08 千目聚云数码科技(上海)有限公司 A kind of area-of-interest method to set up
CN106791856A (en) * 2016-12-28 2017-05-31 天津天地伟业生产力促进有限公司 A kind of method for video coding based on self adaptation area-of-interest
CN110708570A (en) * 2019-10-21 2020-01-17 腾讯科技(深圳)有限公司 Video coding rate determining method, device, equipment and storage medium
CN111479113A (en) * 2020-04-15 2020-07-31 腾讯科技(深圳)有限公司 Code rate control method and device, storage medium and electronic equipment

Also Published As

Publication number Publication date
CN111918066A (en) 2020-11-10

Similar Documents

Publication Publication Date Title
CN111918066B (en) Video encoding method, device, equipment and storage medium
CN108833938B (en) Method and apparatus for selecting video covers
US9325985B2 (en) Reference and non-reference video quality evaluation
US20200396460A1 (en) Video encoding method and apparatus, video decoding method and apparatus, computer device, and storage medium
CN108810545B (en) Method, apparatus, computer readable medium and electronic device for video encoding
CN111182303A (en) Encoding method and device for shared screen, computer readable medium and electronic equipment
CN108600783B (en) Frame rate adjusting method and device and terminal equipment
CN110166796B (en) Video frame processing method and device, computer readable medium and electronic equipment
US9984504B2 (en) System and method for improving video encoding using content information
KR20190061073A (en) Code rate allocation method for intra frame coded frames, computer equipment, and storage medium
CN111263243B (en) Video coding method and device, computer readable medium and electronic equipment
CN112887739A (en) Electronic device, system and control method thereof
WO2018153161A1 (en) Video quality evaluation method, apparatus and device, and storage medium
CN115761090A (en) Special effect rendering method, device, equipment, computer readable storage medium and product
CN110740316A (en) Data coding method and device
CN110418134B (en) Video coding method and device based on video quality and electronic equipment
CN111767428A (en) Video recommendation method and device, electronic equipment and storage medium
CN116980604A (en) Video encoding method, video decoding method and related equipment
CN111182310A (en) Video processing method and device, computer readable medium and electronic equipment
CN110290381B (en) Video quality evaluation method and device, electronic equipment and computer storage medium
CN116567247A (en) Video encoding method, real-time communication method, device, equipment and storage medium
CN115396672B (en) Bit stream storage method, device, electronic equipment and computer readable medium
CN114567778B (en) Video coding method and system
KR19980025576A (en) Data Compression Device and Data Reduction Method Using Motion Characteristics of Video Object in Content-based Coding of Video
CN114615496A (en) Method, device, storage medium and system for obtaining quantization parameter

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
GR01 Patent grant
GR01 Patent grant