Video Encoding Method, Apparatus, Device, and Storage Medium

By predefined frame types and encoding parameters in video encoding, the encoding delay problem is solved and a more efficient encoding process is achieved.

CN113973202BActive Publication Date: 2025-08-05BIGO TECH PTE LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111188246.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-12
Publication Date
2025-08-05
Estimated Expiration
2041-10-12

AI Technical Summary

Technical Problem

In the prior art, the video encoding process requires waiting for the input of multiple reference image frames, resulting in a large encoding delay.

Method used

When the number of reference image frames in the target image frame does not meet the analysis conditions, the frame type and encoding parameters are directly determined through a predefined method to avoid waiting for the number of reference image frames to meet the analysis requirements.

Benefits of technology

The encoding delay is reduced, the waiting time caused by waiting for multiple reference image frames of the target image frame is eliminated, and the encoding efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113973202B_ABST
    Figure CN113973202B_ABST
Patent Text Reader

Abstract

The embodiments of the present application disclose a video encoding method, apparatus, device and storage medium, which belong to the field of digital signal processing technology. The method includes: obtaining a target image frame to be encoded; when the number of reference image frames of the target image frame does not meet the analysis conditions, determining the frame type and encoding parameters of the target image frame according to a first method; wherein the first method refers to a method of determining the frame type and encoding parameters not based on the reference image frame; encoding the target image frame according to the frame type and encoding parameters of the target image frame. This method eliminates the waiting process of the encoding device to obtain a sufficient number of reference image frames when the number of reference image frames of the image frame to be encoded does not meet the analysis conditions, reduces the waiting time of the encoding device, and can effectively reduce the encoding delay without introducing too many parameters and complex calculation methods.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of digital signal processing technology, and in particular to a video encoding method, apparatus, device and storage medium. Background Art

[0002] Before video data is transmitted, in order to reduce the amount of transmitted data, shorten the transmission time, etc., the encoding device needs to encode the video image frames, compress the data amount of the video image frames, and increase the transmission speed.

[0003] In related technologies, before encoding a target image frame, the frame type and encoding parameters of the target image frame must be predicted based on multiple other reference image frames. By calculating the coding losses associated with different encoding methods for the target image frame, the most appropriate frame type and encoding parameters for the target image frame are determined. The encoding device then encodes the target image frame based on the determined frame type and encoding parameters, obtaining the corresponding bitstream for the target image frame. By predicting the target image frame's frame type and encoding parameters and encoding based on the predicted results, stable video playback quality can be achieved.

[0004] However, in some cases, when encoding an image frame to be encoded based on multiple other reference image frames, it is necessary to wait for these reference image frames to be input into the encoding device, which will cause a large encoding delay. Summary of the Invention

[0005] The embodiments of the present application provide a video encoding method, apparatus, device, and storage medium that help reduce encoding delays during the encoding process. The technical solution is as follows:

[0006] According to one aspect of an embodiment of the present application, a video encoding method is provided, the method comprising:

[0007] Obtaining a target image frame to be encoded;

[0008] If the number of reference image frames of the target image frame does not meet the analysis condition, determine the frame type and encoding parameters of the target image frame in a first manner; wherein the first manner is a manner of determining the frame type and encoding parameters not based on the reference image frame;

[0009] The target image frame is encoded according to the frame type and encoding parameters of the target image frame.

[0010] According to one aspect of an embodiment of the present application, a video encoding apparatus is provided, the apparatus comprising:

[0011] An image frame acquisition module, used to acquire a target image frame to be encoded;

[0012] a first encoding determination module, configured to determine, if the number of reference image frames of the target image frame does not satisfy an analysis condition, a frame type and encoding parameters of the target image frame in a first manner; wherein the first manner is a manner of determining the frame type and encoding parameters not based on the reference image frames;

[0013] The image frame encoding module is used to encode the target image frame according to the frame type and encoding parameters of the target image frame.

[0014] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the processor executes the computer program to implement the above-mentioned video encoding method.

[0015] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is configured to be executed by a processor to implement the above-mentioned video encoding method.

[0016] According to one aspect of the present application, a computer program product is provided. When the computer program product is run on a computer device, the computer device is enabled to perform the above-mentioned video encoding method.

[0017] The technical solutions provided in the embodiments of the present application can bring the following beneficial effects:

[0018] When the target image frame to be encoded does not meet the analysis conditions, the target image frame is directly encoded without waiting for the number of reference image frames of the target image frame to meet the analysis requirements. This eliminates the waiting time caused by waiting for multiple other reference image frames of the target image frame and reduces the encoding delay. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0020] Figure 1 It is a schematic diagram of an implementation environment provided by an embodiment of the present application;

[0021] Figure 2 This is a flowchart of a video encoding method provided by one embodiment of the present application;

[0022] Figure 3 is a flowchart of a video encoding method provided by another embodiment of the present application;

[0023] Figure 4 is a schematic diagram of a video encoding method provided by another embodiment of the present application;

[0024] Figure 5 is a schematic diagram of a video encoding method provided by another embodiment of the present application;

[0025] Figure 6 is a schematic diagram of a video encoding process provided by another embodiment of the present application;

[0026] Figure 7 is a block diagram of a video encoding device provided by one embodiment of the present application;

[0027] Figure 8 This is a block diagram of a video encoding device provided by another embodiment of the present application. DETAILED DESCRIPTION

[0028] Before introducing the technical solutions of this application, we first introduce and explain some of the background technologies involved in this application. The following related technologies can be combined with the technical solutions of the embodiments of this application as optional solutions, and they all fall within the scope of protection of the embodiments of this application. The embodiments of this application include at least some of the following contents.

[0029] First, the nouns that may appear in this application are introduced.

[0030] A frame is a still image in a video.

[0031] FPS (Frames Per Second) refers to the number of frames refreshed per second, or the number of times a graphics processor refreshes per second. A higher frame rate means more images are refreshed per second, resulting in more realistic video and smoother motion.

[0032] Data Rate (DR) refers to the amount of data used by a video file per unit time. A higher DR means a lower compression ratio and higher picture quality. A higher DR also means a higher sampling rate per unit time, resulting in higher data flow and precision. The resulting file is closer to the original, resulting in better and clearer image quality, and requires higher decoding capabilities from the playback device.

[0033] Video coding refers to the process of removing redundant information from video images through specific compression technology.

[0034] GOP (Group of Picture, key frame period) refers to the distance between two adjacent I frames (Intra Picture, internal picture) frames, that is, the maximum number of frames in a frame group. The decoding process is performed in units of GOP.

[0035] QP (Quantizer Parameter) reflects the compression of spatial detail. A smaller QP value results in finer quantization, greater image detail preservation, and higher image quality, but also results in a longer bitstream, meaning a larger data volume. A larger QP value results in greater loss of detail, and lower bitrates result in greater image distortion.

[0036] The following introduces and explains the Y (Lumina, brightness), U (Chrominance, chrominance), and V (Chroma, chrominance) signals.

[0037] YUV is a digital color representation format, where Y represents the grayscale value of a pixel, and U and V represent the pixel's color, including its hue and saturation. Because the human eye is less sensitive to changes in hue than brightness, greater compression can be achieved in the chroma dimension during video encoding, resulting in a smaller bitrate.

[0038] The sampling formats of YUV images include:

[0039] (1) 4:4:4, that is, the sampling rate of the three YUV channels is the same. In the generated image, the three components of each pixel are complete (each component is usually 8 bits), and each uncompressed pixel occupies 3 bytes. For example, there are four pixels: [Y0U0V0], [Y1U1V1], [Y2U2V2], and [Y3U3V3]. The corresponding bitstream after sampling is: Y0U0V0; Y1U1V1; Y2U2V2; Y3U3V3.

[0040] (2) 4:2:2, that is, the sampling rate of each chrominance channel is half that of the luminance channel. Therefore, the horizontal chrominance sampling rate is only half of that of 4:4:4. For an uncompressed 8-bit quantized image, each macropixel consisting of two horizontally adjacent pixels requires 4 bytes of memory (2 bytes for luminance and 1 byte for each of the two chrominances). For example, there are four pixels: [Y0U0V0], [Y1U1V1], [Y2U2V2], and [Y3U3V3]. The corresponding bitstream after sampling is: Y0U0; Y1V1; Y2U2; Y3V3.

[0041] (3) 4∶2∶0, that is, for each scan line, only one chrominance component is stored at a sampling rate of 2:1. Adjacent scan lines store different chrominance components. For example, if the first scan line is 4:2:0, the second scan line is 4:0:2, the third scan line is 4:2:0, and so on. For each chrominance component, the horizontal and vertical sampling rates are both 2:1, which is equivalent to a chrominance sampling rate of 4:1. For uncompressed 8-bit quantized video, each macropixel consisting of 2x2 adjacent pixels in 2 rows and 2 columns requires 6 bytes of memory (4 bytes for luminance and 1 byte for each of the two chrominance components). For example, there are eight pixels: [Y0 U0V0], [Y1 U1 V1], [Y2 U2 V2], [Y3 U3 V3], [Y5 U5 V5], [Y6 U6 V6], [Y7 U7 V7] and [Y8 U8V8]. The sampled code stream is: Y0 U0; Y1; Y2 U2; Y3; Y5V5; Y6; Y7V7; Y8.

[0042] The following is an introduction and description of the frame types.

[0043] Frame types mainly include the following categories:

[0044] (1) I-frame: Also known as a keyframe, an I-frame is used to represent details of the image background and moving subjects, and it occupies a relatively large amount of data. During the encoding process, the I-frame has the lowest compression rate. During decoding, the I-frame does not rely on other frames for decoding and can serve as a reference image frame in the decoding process of other frame types. The I-frame is the base frame of the GOP (the first frame in the GOP), and a group of GOPs contains one I-frame.

[0045] (2) IDR (Instantaneous Decoding Refresh) Frame: An IDR frame is a type of I-frame. Before decoding an IDR frame, the decoding device clears the forward and backward reference buffers (the reference buffer is used to store image frames that serve as references during the decoding process). This prevents any frame after the IDR frame from being decoded by referencing any frame before the IDR frame. The IDR frame serves as a random access point for video security, preventing the transmission of erroneous image frames from affecting the decoding results of other frames in the long term.

[0046] (3) P (Predictive-coded Picture) Frame: A P frame records the difference between the current image frame and several previous frames. During the encoding process, P frames have a higher compression rate. The decoding process of a P frame requires reference to some information in the previously cached picture to decode and generate the picture.

[0047] (4) Bidirectionally Predicted Picture (B) frames record the differences between the current frame and the preceding and following frames, representing the maximum compression during the encoding process. When decoding a B frame, it is necessary to reference the preceding and / or following I or P frames. Forward frames refer to image frames that appear earlier in time than the current frame.

[0048] Next, the video encoding method is introduced and explained.

[0049] Video coding includes predictive coding, transform coding, quantization, and entropy coding, among which predictive coding includes intra-frame predictive coding and inter-frame predictive coding. Intra-frame predictive coding uses the correlation in the video spatial domain to compare adjacent macroblocks within the same frame. Inter-frame predictive coding uses the correlation in the video temporal space. Inter-frame predictive coding uses pixels from adjacent encoded image frames to predict the pixels corresponding to the encoded pixels of the current image frame to obtain a residual signal. Inter-frame predictive coding includes motion estimation, MV prediction, weighted prediction, motion compensation, etc. Among them, motion estimation is used to match the macroblock of the current image frame with the closest macroblock in the reference image frame. Motion estimation uses a search algorithm to find macroblocks in the reference image frame and uses matching criteria such as minimum mean square error and minimum mean absolute error to determine the macroblock in the reference image frame that is most similar to the macroblock of the current image frame.

[0050] Quantization refers to the processing of a signal that is discrete in time so that it is also discrete in amplitude. Quantization can be divided into uniform quantization and non-uniform quantization, among which non-uniform quantization is better for small signals.

[0051] The system architecture and business scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. A person skilled in the art will appreciate that, with the evolution of the system architecture and the emergence of new business scenarios, the technical solutions provided in the embodiments of the present application are equally applicable to similar technical problems.

[0052] Please refer to Figure 1 , which shows a schematic diagram of an implementation environment provided by one embodiment of the present application. The implementation environment may include an encoding device 10 and a decoding device 20.

[0053] The encoding device 10 is a device with functions such as video encoding, video data storage, and video data transmission and reception. The encoding device 10 can be a device such as a computer, mobile phone, tablet computer, smart TV, camera, or vehicle-mounted system. The encoding device 10 encodes a target image frame to be encoded. Optionally, the encoding device 10 directly specifies encoding parameters for the target image frame and encodes the target image frame according to the specified encoding parameters. Optionally, the encoding device 10 first predicts the frame type and encoding parameters of the target image frame based on other reference image frames, and then encodes the target image frame according to the encoding parameters. After encoding the target image frame, the encoding device 10 generates a code stream and sends it to the decoding device 20 in the form of a video data stream.

[0054] The decoding device 20 is a device with functions such as video encoding and video data transmission and reception. The decoding device can be a server or a terminal device. The server can be a background server running a target application. The target application includes video applications, live broadcast applications, and social applications with video communication functions. The types of applications are not limited here. The encoding device 20 can be a server, a server cluster composed of multiple servers, or a cloud computing service center. The target application runs on the terminal device. In addition to the function of decoding the video data stream, the terminal device has at least one other function, such as video playback function, information sending function, etc.

[0055] Please refer to Figure 2 , which shows a flowchart of a video encoding method provided by an embodiment of the present application. The execution subject of each step of the method may be an encoding device. The method may include at least one of the following steps (210-230):

[0056] Step 210: Obtain a target image frame to be encoded.

[0057] An image frame is a still image. Multiple frames are continuously switched to form a video. In some embodiments, the image frames are YUV format signals. Encoding refers to the process by which an encoding device compresses an image in one format to obtain an image in another format. The amount of data obtained through encoding is smaller than the original image data before encoding.

[0058] The encoding device obtains the target image frame to be encoded and encodes the obtained target image frame. Optionally, the encoding device obtains the target image frame from a video file in a video database; optionally, the encoding device obtains the target image frame through a device with a video picture acquisition function, such as a camera. The target image frame can be a frame in a video file, or a frame of a scene picture captured by a picture acquisition device during a live video broadcast or a video call. The source and type of the image frame are determined according to the actual situation and are not limited here. In one example, in the application scenario of video playback, the encoding device can be set on the background server of the target application, and the encoding device obtains a target image frame to be encoded from the database of the server, wherein the target image frame comes from the video file corresponding to the received playback instruction command. In another example, in the application scenario of live video broadcast, the camera captures a frame of the scene every 25ms, and the encoding device obtains the target image frame to be encoded through the camera.

[0059] Step 220 , when the number of reference image frames of the target image frame does not meet the analysis condition, determine the frame type and encoding parameters of the target image frame according to a first method; wherein the first method refers to a method of determining the frame type and encoding parameters not based on the reference image frame.

[0060] The reference image frame and the target image frame are image frames in the same video file, or image frames acquired from the same image acquisition device within a certain time interval. The reference image frame can be an image frame that has been encoded, or it can be an image frame that has not been encoded. In some embodiments, the reference image frame and the target image frame have some of the same features, and the target image frame can be encoded based on the information in the reference image frame. In some embodiments, the reference image frame is stored in the encoding device. The analysis condition refers to the condition used to determine the frame type of the target image frame and the encoding parameter determination method. The frame type is used to characterize the degree of compressibility of the target image frame. The frame types include I frames, P frames, and B frames. For details about the frame types, please refer to the above and will not be repeated here. The encoding parameters include bit rate control parameters. The encoding parameters are used to keep the bit rate stable during the encoding process and reduce the distortion rate of the image frame during the encoding process.

[0061] In some embodiments, the analysis condition refers to the number of reference image frames of the target image frame being greater than or equal to a first threshold. In some embodiments, after acquiring the target image frame to be encoded, the encoding device determines an encoding method for acquiring the target image frame based on the number of reference image frames in the encoding device. If the number of reference image frames of the target image frame does not meet the analysis condition, the encoding device uses a first method to determine the frame type and encoding parameters of the target image frame. Conversely, if the number of reference image frames of the target image frame meets the analysis condition, the encoding device uses a method other than the first method to determine the frame type and encoding parameters of the target image frame.

[0062] In some embodiments, after obtaining the target image frame to be encoded, it also includes: adding the target image frame to a pre-encoding queue; when the length of the pre-encoding queue is less than the rated length, determining that the number of reference image frames of the target image frame does not meet the analysis conditions; when the length of the pre-encoding queue is equal to the rated length, determining that the number of reference image frames of the target image frame meets the analysis conditions.

[0063] The length of the precoding queue refers to the number of image frames stored in the precoding queue. In some embodiments, the rated length is equal to the size of the precoding queue, and the size of the precoding queue refers to the maximum number of image frames that can be accommodated in the predefined queue. That is, before the number of image frames stored in the precoding queue reaches the size of the precoding queue, the encoding device adopts a first method to determine the frame type and encoding parameters of the acquired target image frame. In some embodiments, after acquiring the target image frame to be encoded, the encoding device adds the target image frame to the precoding queue, and the multiple image frames stored in the precoding queue serve as reference image frames for the target image frame. In some embodiments, the encoding device stores the frame type and encoding parameters of the target image frame to be encoded in the precoding queue. For example, the encoding device stores the target image frame to be encoded and the corresponding frame type and encoding parameters in the same unit of the precoding queue; for another example, the encoding device stores the frame type and encoding parameters of a target image frame to be encoded separately in a unit of the precoding queue, and the unit has a mapping relationship with the unit used to store the target image frame. The encoding device determines the frame type and encoding parameters corresponding to the target image frame through the mapping relationship.

[0064] Step 230 : Encode the target image frame according to the frame type and encoding parameters of the target image frame.

[0065] In some embodiments, the encoding device encodes the target image frame based on the frame type and encoding parameters of the target image frame, obtains a corresponding code stream for the target image frame, and outputs the corresponding code stream for the target image frame. For details on how the encoding device encodes a target image frame based on the frame type and encoding parameters of the target image frame to be encoded, please refer to the relevant background introduction and will not be elaborated here.

[0066] To sum up, for the target image frame to be encoded whose number of reference image frames does not meet the analysis conditions, this method determines the frame type and encoding parameters of the target image frame through the first method. Since the first method does not need to determine the frame type and encoding parameters of the target image frame based on the reference image frame of the target image frame, it eliminates the waiting time consumed by the encoding device to obtain a sufficient number of reference image frames when the number of reference image frames of the target image frame does not meet the analysis. This method does not need to introduce too many parameters and complex calculation methods to effectively reduce the encoding delay.

[0067] The video encoding process provided by this method is introduced and explained through several embodiments.

[0068] Please refer to Figure 3 , which shows a flowchart of a video encoding method provided by another embodiment of the present application.

[0069] Step 310: Obtain a target image frame to be encoded.

[0070] In some embodiments, after obtaining the target image frame to be encoded, it also includes: adding the target image frame to a pre-encoding queue; when the length of the pre-encoding queue is less than the rated length, the encoding device determines that the number of reference image frames of the target image frame does not meet the analysis conditions; when the length of the pre-encoding queue is equal to the rated length, the encoding device determines that the number of reference image frames of the target image frame meets the analysis conditions.

[0071] Step 320 : When the number of reference image frames of the target image frame does not satisfy the analysis condition, a predefined frame type is determined as the frame type of the target image frame.

[0072] In some embodiments, the predefined frame type is stored in the encoding device, or the predefined frame type is determined based on a picture acquisition tool or the video to be encoded. The predefined frame type can be determined based on actual application conditions such as network transmission delay, the encoding capability of the encoding device, and video playback quality requirements, which are not limited in this application. In some embodiments, if the number of reference image frames of the target image frame does not meet the analysis condition, the encoding device determines the frame type of the target image frame based on the predefined frame type.

[0073] Among them, step 320, in one possible implementation, includes step 322, obtaining a predefined frame type arrangement, which refers to a predetermined arrangement of frame types corresponding to multiple image frames; determining the frame type of the target image frame from the predefined frame type arrangement based on the sequence number of the target image frame; step 320, in another possible implementation, includes step 324, obtaining predefined frame type configuration information, the predefined frame type configuration information includes a configuration quantity of at least one frame type; determining the frame type of the target image frame based on the frame type of the encoded image frame and the predefined frame type configuration information.

[0074] In some embodiments, the predefined frame type arrangement is stored in the encoding device. In some embodiments, the predefined frame type configuration information includes I frames and at least one of P frames and B frames. For example, the predefined frame type arrangement may include: IIIIIIIIII, IPPPIPPPIP, IBPBPIBPP, etc. The predefined frame type arrangement can be set based on experience, actual video playback requirements and other factors, and this application does not limit it here. In some embodiments, the serial number of the target image frame is determined according to the order in which the encoding device obtains the target image frame. For example, if a target image frame is the 9th image frame obtained by the encoding device, the serial number of the target image frame is 9. In some embodiments, after the encoding device obtains the target image frame, it obtains the predefined frame type arrangement, and the encoding device determines the frame type of the target image based on the predefined frame type arrangement and the serial number of the target image. For example, the encoding device obtains a target image frame to be encoded, and the target image frame is the first target image frame obtained by the encoding device, then the serial number of the target image frame is 1, and when the number of reference image frames of the target image frame does not meet the analysis conditions, the predefined frame type arrangement stored in the encoding device is IPPBPP, and the encoding device determines that the frame type of the target image frame is an I frame based on the serial number of the target image frame and the predefined frame type arrangement.

[0075] In some embodiments, the length of the predefined frame type arrangement is determined according to the length of the precoding queue. For example, if the size of the precoding queue is 10 frames, the length of the predefined frame type arrangement is greater than or equal to 10. The sequence number of the target image is determined according to the number of image frames stored in the precoding queue. In some embodiments, after obtaining a target image frame to be encoded, the encoding device adds the target image frame to the precoding queue. The encoding device determines that the length of the precoding queue is less than the rated length by judgment. The encoding device determines the frame type and encoding parameters of the target image frame according to the predefined frame type arrangement and the sequence number of the target image frame. For example, if the encoding device obtains the predefined frame type arrangement as IBPBPIBPP, and after the encoding device obtains a target image frame to be analyzed, the number of image frames stored in the precoding queue is 4, then the sequence number of the target image frame is 4, and therefore the frame type of the target image frame is a B frame.

[0076] The frame type of an encoded image frame refers to the frame type of an image frame that has been encoded by an encoding device. In some embodiments, the encoding device counts the frame types of the encoded image frames using variables. For example, the encoding device is provided with a first variable, a second variable, and a third variable, wherein the first variable is used to record the number of encoded image frames whose frame type is I-frame, the second variable is used to record the number of encoded image frames whose frame type is P-frame, and the third variable is used to record the number of encoded image frames whose frame type is B-frame. After encoding the target image frame, the encoding device updates the value of the variable corresponding to the frame type. For example, if the current value of the second variable is 3, after the encoding device encodes a target image frame whose frame type is P-frame, the value of the second variable is updated to 4. In some embodiments, the predefined configuration information is determined by the encoding device based on requirements such as encoding quality and video playback quality. The method for determining the predefined frame type configuration information depends on the actual situation and is not limited in this application. In some embodiments, the predefined frame type configuration information includes 5 I frames, and the encoded image frames include 1 I frame. The encoding device obtains a target image frame to be encoded and stores the encoding device in a precoding queue. If the number of image frames in the precoding queue is less than the size of the precoding queue, the encoding device determines that the frame type of the target image frame is an I frame based on the preconfigured frame type configuration information. In some embodiments, when the encoding device stores the obtained target image frame in the precoding queue, the encoding device determines the frame type of the target image frame based on the preconfigured frame type configuration information, the frame type of the encoded image frame, and the length of the precoding queue. For example, if the preconfigured frame type configuration information includes 3 I frames, the encoded image frames include 2 I frames, the length of the precoding queue is 8, and the size of the precoding queue is 10, the encoding device determines that the frame type of the target image frame is an I frame based on the above information.

[0077] In some embodiments, the predefined frame type configuration information includes the number of at least one frame type and the ratio of two different frame type data. For example, a certain predefined frame type configuration information includes 3 I frames and the number of I frames / the number of P frames is less than or equal to 4. In some embodiments, the encoding device, for reasons of compression rate of video encoding and other aspects, configures the predefined frame type configuration information to include 3 I frames, and the number of I frames / the number of P frames is less than or equal to 4. The encoded image frames include 3 I frames and 6 P frames. The encoding device obtains a target image frame to be encoded, and when the number of reference image frames of the target image frame does not meet the analysis condition, the encoding device determines the frame type of the target image frame as a P frame based on the above information.

[0078] Step 330 : When the number of reference image frames of the target image frame does not satisfy the analysis condition, a predefined frame type is determined as the frame type of the target image frame.

[0079] Among them, step 330 includes the following sub-steps: step 332, obtaining predefined encoding parameter configuration information, the encoding parameter configuration information includes at least one set of correspondence between frame types and encoding parameters; step 334, determining the encoding parameters corresponding to the frame type of the target image frame from the encoding parameter configuration information as the encoding parameters of the target image frame.

[0080] Encoding parameters include bit rate, QP, etc.

[0081] In some embodiments, the encoding device obtains a target image frame to be encoded and stores the target image frame in a pre-encoding queue. When the length of the pre-encoding queue is less than the rated length, the encoding device determines the frame type of the target image frame through the predefined frame type arrangement IPPIPP and the sequence number 5 of the target image frame, and determines the encoding parameters of the target image frame through predefined encoding parameters.

[0082] In some embodiments, an encoding device obtains a target image frame to be encoded and stores the target image frame in a pre-encoding queue. The encoding device determines whether a reference image frame for the target image frame satisfies encoding conditions, i.e., whether the number of image frames stored in the pre-encoding queue reaches the size of the pre-encoding queue. If the number of reference image frames for the target image frame does not meet the encoding conditions, i.e., the number of image frames in the pre-encoding queue is less than the size of the pre-encoding queue, the encoding device determines predefined encoding parameters as the encoding parameters for the target image frame.

[0083] In some embodiments, the encoding device obtains encoding parameters of the target image frame through a rate control model. For details on how the encoding device determines the encoding parameters of the target image frame through the rate control model, please refer to the embodiment of encoding the target image frame using the second method below.

[0084] Step 340, when the frame type of the target image frame is a key frame, the target image frame is encoded according to the encoding parameters of the target image frame using the intra-frame prediction mode; or, when the frame type of the target image frame is a non-key frame, the target image frame is encoded according to the encoding parameters of the target image frame using the inter-frame prediction mode.

[0085] In some embodiments, the encoding device encodes the target image frame using the frame type and encoding parameters of the target image frame. For the specific encoding process, please refer to the detailed description in the background technology and will not be described in detail here. Different encoding methods can be used to encode the target image frame based on the signal type of the target image frame and the encoding characteristics of the encoding device. This application does not limit the specific encoding method.

[0086] Please refer to Figure 4 , which shows a schematic diagram of a video encoding method provided by another embodiment of the present application. In some embodiments, the encoding device obtains a target image frame to be encoded, and determines by judging that the number of reference image frames of the target image frame does not meet the analysis condition, such as Figure 4 As shown, the encoding device obtains the third image frame to be encoded. The number of reference image frames for the third image frame is 2 (the reference image frames for the third image frame include the first and second frames). The analysis condition is 30. The encoding device determines the frame type of the third image frame as an I frame (key frame) using the first method and obtains the encoding parameters corresponding to the third image frame using the rate control model. The encoding device performs intra-frame prediction encoding on the third image frame to obtain a residual value. After performing encoding processing such as quantization and entropy encoding, the encoding device ultimately obtains the code stream corresponding to the third image frame. The encoding device outputs the code stream corresponding to the target image frame and prepares to obtain a new target image frame.

[0087] In some embodiments, after obtaining a target image frame to be encoded, the encoding device adds the target image frame to a pre-encoding queue; when the pre-encoding queue does not meet the rated length, the encoding device uses the first method to determine that the frame type of the target image frame is a P frame, and determines the encoding parameters corresponding to the target image frame through a rate prediction model; the encoding device adds the frame type and encoding parameters of the target image frame to the pre-encoding queue; the encoding device performs inter-frame prediction on the target image frame, obtains a residual value, and finally obtains a code stream corresponding to the key frame through encoding processing such as quantization and entropy coding, and the encoding device outputs the code stream corresponding to the target image frame. Optionally, when the length of the pre-encoding queue is less than the rated length, the target image frame that has completed encoding is stored in the encoding queue.

[0088] When the number of reference image frames of the target image frame does not meet the analysis conditions, the encoding device does not use the image frames of the target image to predict the frame type and encoding parameters of the target image frame, but directly determines the frame type of the target image frame through a predefined frame type arrangement, which can save the time of the encoding device in determining the frame type of the target image frame and avoid the situation where the encoding device cannot predict the frame type and encoding parameters of the target image frame until it obtains a sufficient number of reference image frames when the number of reference image frames of the target image frame does not meet the analysis conditions.

[0089] The following describes a video encoding method in which the number of reference image frames of a target image frame meets an analysis condition through several embodiments.

[0090] In some embodiments, after obtaining the target image frame to be encoded, it also includes: when the number of reference image frames meets the analysis conditions, determining the frame type and encoding parameters of the target image frame according to the second method; wherein the second method refers to a method of determining the frame type and encoding parameters based on the reference image frame.

[0091] The second method means that before formally encoding the target image frame, the encoding device needs to predict the frame type and encoding parameters of the target image frame based on the target image frame and the reference image frame, so as to obtain a better compression rate and reduce the distortion caused by video encoding, and ensure that the code stream obtained after video encoding can produce a video picture with a stable bit rate after decoding.

[0092] In some embodiments, after acquiring a target image frame, the encoding device adds the target image frame to a pre-encoding queue. If the length of the pre-encoding queue meets a specified length, the encoding device determines the frame type and encoding parameters of the target image frame using a second method. In some embodiments, in addition to the target image frame added by the encoding device, the other multiple image frames in the pre-encoding queue are already encoded image frames. Optionally, the pre-encoding queue includes the frame types and encoding parameters of the other multiple image frames. In some embodiments, all image frames in the pre-encoding queue, except for the target image frame, serve as reference image frames for the target image frame.

[0093] In some embodiments, the frame type and encoding parameters of the target image frame are determined according to a second method, including: determining the frame type of the target image frame based on a reference image frame of the target image frame; encoding parameters of the target image frame based on configuration parameters and / or the frame type of the target image frame, wherein the configuration parameters are used to constrain the bit rate of the target image frame.

[0094] In some embodiments, determining the frame type of a target image frame based on a reference image frame includes: generating multiple frame type arrangements, each frame type arrangement including an assumed frame type of the target image frame and at least one frame type located after the assumed frame type; calculating the distortion rates corresponding to the multiple frame type arrangements; wherein the distortion rates corresponding to the frame type arrangements are determined by encoding the target image frame and at least one reference image frame according to the frame type arrangements; determining the target frame type arrangement with the smallest distortion rate from the multiple frame type arrangements; and determining the assumed frame type in the target frame type arrangement as the frame type of the target image frame.

[0095] In some embodiments, an assumed frame type of the target image frame includes an I frame, a P frame, and a B frame. At least one frame type located after the assumed frame type refers to the assumed frame type of the reference image frame determined based on the assumed frame type of the target image frame. In the process of determining the frame type of a target image frame to be encoded based on the reference image frame, the encoding device first assumes a frame type of the target image frame, and determines the assumed frame types of the reference image frames one by one based on the assumed frame type of the target image frame, and finally obtains multiple frame type arrangements. Since the assumed frame type of the target image frame will affect the assumed frames determined by subsequent reference image frames, setting different assumed frame types for the target image frame will produce multiple different frame type arrangements. For example, a target image frame to be encoded has 5 reference image frames. The assumed frame type of the target image frame is determined to be an I frame. Based on the picture content of the target image frame and the target image frame, the assumed frame type of the target image frame is determined to be an I frame. The assumed frame type of the target image frame is determined, and the assumed frame type of the first reference image frame is determined to be a B frame. The assumed frame type of the second reference image frame is determined to be a B frame based on the picture content of the target image frame, the assumed frame type of the target image frame, the picture content of the first reference image frame, and the assumed frame type of the first reference image frame. The above steps are repeated until the assumed frame types of all reference image frames of the target image frame are determined. The final frame type arrangement is IBBPBB; the frame type of the target image frame is determined to be a B frame, and the above steps are repeated to determine the assumed frame types of all reference image frames. The final frame type arrangement is BIPBPP.

[0096] The encoding device calculates the distortion rates corresponding to a plurality of frame type arrangements, wherein the distortion rates corresponding to the frame type arrangements are determined by the encoding device by roughly encoding the target image frame and the reference image frame based on the frame type arrangements. The smaller the distortion rate corresponding to the frame type arrangement, the better the encoding quality of the frame type arrangement. The encoding device selects the frame type arrangement with the smallest distortion rate as the target frame type sequence, and uses the assumed frame type of the target image frame in the target frame type arrangement as the frame type of the target image frame. In some embodiments, the encoding parameters of the target image frame are determined by a rate control model.

[0097] Since the transformation frequency between adjacent video image frames is low in video files or real-time live broadcast scenes, predicting the frame type of the target image frame through the forward reference image frame of the target image frame can obtain a more reliable frame type prediction result.

[0098] In some embodiments, the encoding parameters of the target image frame include at least a bit rate and a quantization parameter of the target image frame. Determining the encoding parameters of the target image frame based on configuration parameters and / or a frame type of the target image frame includes determining the bit rate of the target image frame based on the configuration parameters and determining the quantization parameter of the target image frame based on the frame type of the target image frame. Alternatively, determining the bit rate and quantization parameter of the target image frame based on the configuration parameters.

[0099] The encoding device can set different configuration parameters according to different encoding requirements. In some embodiments, in order to maintain the stability of the encoded video bit rate, the encoding device adopts the ABR (Average Bitrate) control model as a configuration parameter. The encoding device can also adopt CRF (Constant Rate Factor), CQP (Constant Quantizer Parameter), and R-QP (Rate-Quantization Parameter) and other rate control models as configuration parameters. The configuration parameters are determined according to conditions such as network communication quality and encoding requirements, and are not limited in this application.

[0100] In some embodiments, the encoding device determines the configuration parameters based on the R-QP rate control model, including the initial QP and the code rate R of the secondary model. i Calculation formula:

[0101]

[0102] Among them, R i Indicates the bit rate of the target image frame, a0, a1 and a i Used to represent information related to the content of the target image frame, Q i It refers to the distortion rate obtained after encoding the target image frame according to the initial QP.

[0103] After obtaining the bit rate of the target frame type, the encoding device determines the QP of the target image frame according to the frame type of the target image frame during the RDO (Rate-Distortion Optimization) process.

[0104] In some embodiments, the encoding device determines configuration parameters based on the CQP. According to the CQP method, the encoding device configures a fixed QP in the configuration parameters. Optionally, the encoding device configures different QPs for different frame types. For example, the encoding device configures the QP of a target image frame of a P-frame type to a first fixed QP. The encoding device calculates the bitrate of the target image frame based on the fixed QP in the configuration parameters.

[0105] It should be noted that, during the pre-encoding process of a video file, all methods for determining the bit rate and quantization parameters of a target image frame can be used in this application.

[0106] Please refer to Figure 5 , which shows a schematic diagram of a video encoding method provided by another embodiment of the present method.

[0107] After acquiring a target image frame, the encoding device adds the target image frame to a pre-encoding queue. The length of the pre-encoding queue is n, and the nominal length is n, where n is a positive integer. During the time period 0-T1, the number of frames in the pre-encoding queue is less than n. For a target image frame to be encoded, the encoding device uses a first method to determine the frame type and encoding parameters of the target image frame. In one example, the first frame is input into the pre-encoding queue. The number of frames in the pre-encoding queue is 1, which is less than n and does not meet the analysis conditions. The encoding device uses the first method to determine the frame type of the target image frame as an I frame, determines the encoding parameters corresponding to the first frame based on the rate control model, and encodes the first frame. After encoding, a code stream corresponding to the first frame is obtained and output. After time T1, the encoding device acquires the nth target image frame. At this time, the length of the pre-encoding queue is n, which meets the analysis conditions. The encoding device uses a second method to determine the frame type and encoding parameters of the nth target image frame. In another example, the encoding device adds the n+1th frame to the pre-encoding queue. The pre-encoding queue includes any frame from the second to the n+1th frames. The encoding device generates m frame type permutations from frames 2 to (n+1), where m is a positive integer. It calculates the coding distortion rates corresponding to each of the m frame type permutations, identifies the frame type permutation with the lowest distortion rate as the target frame type permutation, and determines the target image type for frame (n+1) based on this target image type permutation. The encoding device then uses a rate control model to determine the coding parameters for frame (n+1). The encoding device encodes frame (n+1) based on the predicted frame type and coding parameters, obtains the codestream corresponding to frame (n+1), and outputs the codestream. The encoding device removes frame 2 from the pre-coding queue and waits for frame (n+2) to be encoded to enter the pre-coding queue.

[0108] Please refer to Figure 6 , which shows a schematic diagram of a video encoding process provided by another embodiment of the present application.

[0109] In a real-time live broadcast application scenario, the encoding device obtains a target image frame to be encoded through a picture acquisition device; the encoding device adds the target image frame to a pre-encoding queue; the encoding device determines whether the length of the pre-encoding queue meets the analysis requirements. In some embodiments, the analysis requirement is that the number of image frames stored in the pre-encoding queue is the same as the size of the encoding queue; when the length of the pre-encoding queue does not meet the analysis requirements, the encoding device uses the first method to determine the frame type and encoding parameters of the target image frame, the encoding device adds the frame type and encoding parameters of the target image to the pre-encoding queue, and encodes the target image frame according to the frame type and encoding parameters to obtain a corresponding code stream, and outputs the code stream; when the length of the pre-encoding queue meets the analysis requirements, the encoding device uses the second method to predict the frame type and encoding parameters of the target image frame, so that the frame type of the target image frame obtained by prediction can minimize the distortion generated during the encoding process. The encoding device adds the frame type and encoding parameters of the target image to the pre-encoding queue, encodes the target image frame according to the frame type and encoding parameters, obtains the corresponding code stream, and outputs the code stream; after the encoding device obtains the frame type and encoding parameters of the target image frame by the second method, it removes the image frame that was first added to the pre-encoding queue from the pre-encoding queue, ensuring that the encoding device can add the next target image frame obtained from the picture acquisition device to the pre-encoding queue. After the encoding device completes encoding a frame of the target image, it needs to determine whether to continue repeating the above encoding process. If the encoding device receives an exit instruction, such as an exit instruction triggered by the user exiting the video playback interface on the terminal device, or an exit instruction triggered by the picture acquisition device ending its work, the encoding device stops the above encoding process.

[0110] In summary, when the number of reference image frames of the target image frame does not meet the analysis conditions, the present method uses the first method to directly determine the frame type and encoding parameters of the target image frame, thereby reducing the waiting time of the encoding device and reducing the encoding delay; when the number of reference image frames of the target image frame meets the analysis conditions, the second method is used to predict the frame type of the target image through the reference image frame, which helps to maintain the stability of the bit rate of the encoding process and avoid fluctuations in quality between frames. Since the content switching rate of image frames in video files or image frames of live scenes is low, that is, the scene switching occurs less frequently, there is a strong correlation between the target image frame and the adjacent reference image frame. Therefore, in the present method, the second method is adopted, that is, using the forward reference image frame to predict the frame type of the target image frame, which can achieve an effect similar to using the backward reference image frame to predict the target image frame type, and reduces the encoding delay.

[0111] Although, when the first method is used to directly determine the frame type and encoding parameters of the target image frame, fluctuations in inter-frame quality will be caused, during the encoding process of the video stream, the number of image frames whose frame types and encoding parameters are determined according to the first method is much smaller than the number of image frames whose frame types and encoding parameters are determined according to the second method. Therefore, a reasonable bit rate control model is established by using this method, which can reduce the fluctuations in inter-frame quality in a very short period of time at the beginning of video playback, and can maintain the stability of the inter-frame quality of the video picture thereafter, and has low encoding delay, and is highly usable in scenarios such as live broadcast and RTC.

[0112] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.

[0113] Please refer to Figure 7 , which shows a block diagram of a video encoding device provided by one embodiment of the present application. The device has the function of implementing the above-mentioned video encoding method. The function can be implemented by hardware or by hardware executing corresponding software. The device can be the electronic device described above, or it can be provided in an electronic device. The device 700 may include: an image frame acquisition module 710, a first encoding determination module 720, and an image frame encoding module 730.

[0114] The image frame acquisition module 710 is configured to acquire a target image frame to be encoded.

[0115] The first encoding determination module 720 is used to determine the frame type and encoding parameters of the target image frame according to a first method when the number of reference image frames of the target image frame does not meet the analysis conditions; wherein the first method refers to a method of determining the frame type and encoding parameters not based on the reference image frame.

[0116] The image frame encoding module 730 is configured to encode the target image frame according to the frame type and encoding parameters of the target image frame.

[0117] In some embodiments, as Figure 8 As shown, the first encoding determination module 720 includes: a first frame type determination unit 722, used to determine the predefined frame type as the frame type of the target image frame; a first parameter determination unit 724, used to determine the predefined encoding parameters as the encoding parameters of the target image frame.

[0118] In some embodiments, the first frame type determination unit 722 is used to: obtain a predefined frame type arrangement, the predefined frame type arrangement refers to an arrangement of frame types corresponding to a plurality of predetermined image frames; determine the frame type of the target image frame from the predefined frame type arrangement based on the sequence number of the target image frame; or obtain predefined frame type configuration information, the predefined frame type configuration information includes a configuration quantity of at least one frame type; determine the frame type of the target image frame based on the frame type of the encoded image frame and the predefined frame type configuration information.

[0119] In some embodiments, the first parameter determination unit 724 is used to: obtain predefined encoding parameter configuration information, where the encoding parameter configuration information includes at least one set of correspondence between frame types and encoding parameters; and determine, from the encoding parameter configuration information, the encoding parameters corresponding to the frame type of the target image frame as the encoding parameters of the target image frame.

[0120] The image frame encoding module 730 is used to: when the frame type of the target image frame is a key frame, use the intra-frame prediction mode to encode the target image frame according to the encoding parameters of the target image frame; or when the frame type of the target image frame is a non-key frame, use the inter-frame prediction mode to encode the target image frame according to the encoding parameters of the target image frame.

[0121] In some embodiments, as Figure 8 As shown, the device 700 also includes a second encoding determination module 740, which is used to determine the frame type and encoding parameters of the target image frame according to a second method when the number of the reference image frames meets the analysis condition; wherein the second method refers to a method of determining the frame type and encoding parameters based on the reference image frame.

[0122] In some embodiments, the second encoding determination module 740 includes: a second frame type determination unit 742, used to determine the frame type of the target image frame based on the reference image frame of the target image frame; a second parameter determination unit 744, used to determine the encoding parameters of the target image frame based on the configuration parameters and / or the frame type of the target image frame, and the configuration parameters are used to constrain the bit rate of the target image frame.

[0123] In some embodiments, the second frame type determination unit 742 is used to: generate multiple frame type arrangements, each frame type arrangement includes an assumed frame type of the target image frame and at least one frame type located after the assumed frame type; calculate the distortion rates corresponding to the multiple frame type arrangements; wherein the distortion rates for the frame type arrangements are determined by encoding the target image frame and at least one reference image frame according to the frame type arrangement; determine the target frame type arrangement with the smallest distortion rate from the multiple frame type arrangements; and determine the assumed frame type in the target frame type arrangement as the frame type of the target image frame.

[0124] In some embodiments, as Figure 8 As shown, the device 700 also includes an image frame adding module 750, which is used to: add the target image frame to the pre-coding queue; when the length of the pre-coding queue is less than the rated length, determine that the number of reference image frames of the target image frame does not meet the analysis condition; when the length of the pre-coding queue is equal to the rated length, determine that the number of reference image frames of the target image frame meets the analysis condition.

[0125] It should be noted that the apparatus provided in the above embodiments, when implementing its functions, is only illustrated by the division of the above functional modules. In actual applications, the above functions can be assigned to different functional modules as needed, that is, the content structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus and method embodiments provided in the above embodiments are based on the same concept. The specific implementation process is detailed in the method embodiment and will not be repeated here.

[0126] In an exemplary embodiment, a computer device is further provided, the computer device comprising a processor and a memory, wherein a computer program is stored in the memory, and the computer program is configured to be executed by one or more processors to implement the above-mentioned video encoding method.

[0127] In an exemplary embodiment, a computer-readable storage medium is further provided, wherein a computer program is stored in the storage medium. When the computer program is executed by a processor of a computer device, the computer program implements the above-mentioned video encoding method.

[0128] Optionally, the computer-readable storage medium may be a storage device such as a ROM (Read-Only Memory) or a RAM (Random Access Memory).

[0129] In an exemplary embodiment, a computer program product is further provided. When the computer program product is run on a computer device, the computer device is enabled to perform the above-mentioned video encoding method.

[0130] It should be understood that the "multiple" mentioned in this article refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. In addition, the step numbers described in this article only illustrate a possible execution sequence between the steps. In some other embodiments, the above steps may not be executed in the order of the numbers, such as two steps with different numbers are executed at the same time, or two steps with different numbers are executed in the opposite order to the diagram. The embodiments of the present application do not limit this.

[0131] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.

Claims

1. A video encoding method, characterized in that: The method comprises: Obtaining a target image frame to be encoded; If the number of reference image frames of the target image frame does not meet an analysis condition, determining a predefined frame type as the frame type of the target image frame, and determining a predefined encoding parameter as the encoding parameter of the target image frame, wherein the analysis condition is that the number of reference image frames of the target image frame is greater than or equal to a first threshold, and the frame type of the target image frame includes an I frame, a P frame, and a B frame; The target image frame is encoded according to the frame type and encoding parameters of the target image frame.

2. The method according to claim 1, characterized in that The step of determining the predefined frame type as the frame type of the target image frame includes: Obtaining a predefined frame type arrangement, wherein the predefined frame type arrangement refers to an arrangement of frame types corresponding to a plurality of predetermined image frames; determining the frame type of the target image frame from the predefined frame type arrangement based on the sequence number of the target image frame; or, Predefined frame type configuration information is obtained, where the predefined frame type configuration information includes a configuration quantity of at least one frame type; and a frame type of the target image frame is determined based on the frame type of the encoded image frame and the predefined frame type configuration information.

3. The method according to claim 2, characterized in that The step of determining the predefined encoding parameters as the encoding parameters of the target image frame includes: Obtaining predefined encoding parameter configuration information, where the encoding parameter configuration information includes at least one set of correspondences between frame types and encoding parameters; From the encoding parameter configuration information, encoding parameters corresponding to the frame type of the target image frame are determined as encoding parameters of the target image frame.

4. The method according to claim 1, wherein The step of encoding the target image frame according to the frame type and encoding parameters of the target image frame includes: In a case where the frame type of the target image frame is a key frame, encoding the target image frame according to the encoding parameters of the target image frame using an intra-frame prediction mode; or, In a case where the frame type of the target image frame is a non-key frame, the target image frame is encoded according to the encoding parameters of the target image frame using an inter-frame prediction mode.

5. The method according to claim 1, characterized in that After obtaining the target image frame to be encoded, the method further includes: In the case where the number of reference image frames meets the analysis condition, a plurality of frame type arrangements are generated, each frame type arrangement including an assumed frame type of the target image frame and at least one frame type located after the assumed frame type; the distortion rates corresponding to the plurality of frame type arrangements are calculated, wherein the distortion rates corresponding to the frame type arrangements are determined by encoding the target image frame and at least one reference image frame according to the frame type arrangement; from the plurality of frame type arrangements, a target frame type arrangement with the smallest distortion rate is determined; the assumed frame type in the target frame type arrangement is determined as the frame type of the target image frame; and the encoding parameters of the target image frame are determined according to configuration parameters and / or the frame type of the target image frame, wherein the configuration parameters are used to constrain the bit rate of the target image frame.

6. The method according to any one of claims 1 to 5, characterized in that After obtaining the target image frame to be encoded, the method further includes: Adding the target image frame to a pre-encoding queue; When the length of the pre-encoding queue is less than a rated length, determining that the number of reference image frames of the target image frame does not meet an analysis condition; In a case where the length of the pre-encoding queue is equal to the rated length, it is determined that the number of reference image frames of the target image frame meets an analysis condition.

7. A video encoding device, characterized in that: The device comprises: An image frame acquisition module, used to acquire a target image frame to be encoded; a first encoding determination module, configured to, if the number of reference image frames of the target image frame does not satisfy an analysis condition, determine a predefined frame type as the frame type of the target image frame, and determine a predefined encoding parameter as the encoding parameter of the target image frame, wherein the analysis condition is that the number of reference image frames of the target image frame is greater than or equal to a first threshold, and the frame type of the target image frame includes an I frame, a P frame, and a B frame; The image frame encoding module is used to encode the target image frame according to the frame type and encoding parameters of the target image frame.

8. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The storage medium stores a computer program, which is loaded and executed by a processor to implement the method according to any one of claims 1 to 6.

10. A computer program product, characterized in that When the computer program product is run on a computer device, the computer device is caused to perform the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Video coding and decoding method and device

    CN102413326A