Video coding method and device, bit stream generation method, electronic equipment, storage medium and program product
By judging the complexity of the video frames in video encoding and improving the encoding coding rate, the problem of unsatisfactory bit rate allocation in the transition scenarios of the hardware encoder is solved, and the subjective picture quality experience and encoding quality are improved.
Patent Information
- Application Number
- CN202411514039.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-07
AI Technical Summary
Existing hardware encoders have poor bit rate allocation in transition scenarios, which affects the subjective picture quality experience and may lead to higher transmission bandwidth costs.
By determining the intra-frame complexity and inter-frame complexity of the video frame, determine whether it is a transition frame, and when determining it is a transition frame, increase the original encoding code rate to obtain a higher encoding code rate, and perform the transition frames coding.
It effectively improves the subjective picture quality experience of the transition scene, reduces the cost of transmission bandwidth, and improves the encoding quality of transition frames that are sensitive to the human eye.
Smart Images

Figure CN119402641A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of video technology, and in particular to a video encoding method and apparatus, a bit stream generation method, an electronic device, a storage medium, and a program product. Background Art
[0002] Various electronic devices (e.g., digital televisions, laptop or desktop computers, tablet computers, digital cameras, digital recording devices, digital media players, video game consoles, smart phones, video teleconferencing devices, video streaming devices, etc.) support digital video. Electronic devices send and receive or otherwise transmit digital video data through a communication network, and / or store digital video data on a storage device. Due to the limited bandwidth capacity of the communication network and the limited storage resources of the storage device, before the video data is transmitted or stored, the video data can be compressed using a video codec according to one or more video codec standards. For example, video codec standards include general video codec (VVC), joint exploration test model (JEM), high efficiency video codec (HEVC / H.265), advanced video codec (AVC / H.264), moving picture expert group (MPEG) codec, etc. Video codecs generally use prediction methods (e.g., inter-frame prediction, intra-frame prediction, etc.) that utilize the inherent redundancy in video data. Video codecs are intended to compress video data into a form that uses a lower bit rate while avoiding or minimizing the degradation of video quality.
[0003] In videos, scene transitions are a common video scene, and the human eye is highly sensitive to the image quality of such scenes. However, in related technologies, the bitrate allocation strategies of mainstream hardware encoders for transition scenes are not ideal, which affects the subjective image quality experience. In addition, unreasonable bitrate allocation may lead to higher transmission bandwidth costs, affecting the viewing experience.
[0004] In addition, the hardware encoder can only be configured and used through the official peripheral interface. Its internal implementation mechanism is in a black box state, with limited adjustable parameters, low algorithm flexibility and accuracy, and it is unable to adaptively allocate bit rates according to video scenes. Therefore, it is also difficult to improve the subjective picture quality experience of transition scenes by configuring the hardware encoder. Summary of the invention
[0005] The present disclosure provides a video encoding method and apparatus, a bit stream generation method, an electronic device, a storage medium and a program product, so as to at least solve the problem in the related art that the encoder does not allocate the bit rate of the transition scene ideally, thus affecting the subjective picture quality experience. The technical solution of the present disclosure is as follows:
[0006] According to a first aspect of an embodiment of the present disclosure, a video encoding method is provided, the video encoding method comprising: determining an intra-frame complexity of a first video frame in a video to be encoded and an inter-frame complexity of the first video frame relative to a second video frame, wherein the second video frame is before the first video frame; determining whether the first video frame is a transition frame based on the inter-frame complexity and the intra-frame complexity of the first video frame; in response to the first video frame being a transition frame, based on an original encoding bit rate of the video to be encoded, obtaining an encoding bit rate of the transition frame by increasing the original encoding bit rate; encoding the transition frame based on the encoding bit rate of the transition frame.
[0007] Optionally, determining whether the first video frame is a transition frame based on the inter-frame complexity and intra-frame complexity of the first video frame includes: in response to a complexity difference between the inter-frame complexity and the intra-frame complexity of the first video frame exceeding a difference threshold, determining that the first video frame is a transition frame.
[0008] Optionally, the video encoding method also includes: updating the difference threshold; based on the updated difference threshold, determining whether the third video frame after the first video frame is a transition frame, wherein the updating of the difference threshold includes: in response to the number of transition frames determined in the video frame sequence of the preset window size being greater than the first preset number of transition frames, increasing the difference threshold; in response to the number of transition frames determined in the video frame sequence of the preset window size being less than the second preset number of transition frames, reducing the difference threshold, wherein the second preset number of transition frames is less than or equal to the first preset number of transition frames.
[0009] Optionally, in response to the first video frame being a transition frame, the video encoding method further includes: in response to the statistical value of the inter-frame complexity of video frames within a first preset number of frames starting from the first video frame being greater than a preset complexity, executing the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate; in response to the statistical value being less than or equal to the preset complexity, encoding the first video frame based on the original encoding bit rate.
[0010] Optionally, the video encoding method also includes: based on the original encoding bit rate of the video to be encoded, obtaining the encoding bit rate of multiple related video frames after the transition frame by improving the original encoding bit rate, wherein the encoding bit rate of the previous video frame in any adjacent video frames among the transition frame and the multiple related video frames is greater than or equal to the encoding bit rate of the next video frame in the adjacent video frames.
[0011] Optionally, the encoding bit rates of the transition frame and the multiple related video frames are gradually reduced from the encoding bit rate of the transition frame to the original encoding bit rate with a preset attenuation step size.
[0012] Optionally, the video encoding method further includes: in response to the number of transition frames determined within a second preset number of frames starting from the transition frame being greater than or equal to a preset number, encoding the transition frame based on the original encoding bit rate; in response to the number of transition frames determined within the second preset number of frames starting from the transition frame being less than the preset number, executing, for the transition frame, the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate.
[0013] Optionally, the video encoding method further includes: in response to the number of frames from the transition frame to the target transition frame being greater than a preset minimum frame interval, for the transition frame, performing a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate, wherein the target transition frame is a transition frame with an increased encoding bit rate that is closest to the transition frame before the transition frame; in response to the number of frames from the transition frame to the target transition frame being less than or equal to the preset minimum frame interval, encoding the transition frame based on the original encoding bit rate, or, based on the distance from the target transition frame, determining the encoding bit rate of the transition frame and encoding the transition frame.
[0014] Optionally, the video encoding method further includes: in response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within a first preset video frame range is greater than a first preset number of times, encoding the transition frames within a second preset video frame range after the first preset video frame range based on the original encoding bit rate, wherein the first preset video frame range is greater than the preset minimum frame interval; and / or, in response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within a time window of a preset length has reached a second preset number of times, encoding subsequent transition frames within the current time window based on the original encoding bit rate until reaching the next time window.
[0015] According to a second aspect of an embodiment of the present disclosure, a video encoding device is provided, comprising: a complexity determination unit, configured to determine the intra-frame complexity of a first video frame in a video to be encoded and the inter-frame complexity of the first video frame relative to a second video frame, wherein the second video frame is before the first video frame; a transition frame determination unit, configured to determine whether the first video frame is a transition frame according to the inter-frame complexity and the intra-frame complexity of the first video frame; a boosting unit, configured to, in response to the first video frame being a transition frame, obtain the encoding bit rate of the transition frame by boosting the original encoding bit rate based on the original encoding bit rate of the video to be encoded; and an encoding unit, configured to encode the transition frame based on the encoding bit rate of the transition frame.
[0016] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing processor-executable instructions, wherein the processor-executable instructions, when executed by the processor, enable the processor to execute the video encoding method according to the embodiment of the present disclosure.
[0017] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the video encoding method according to the embodiment of the present disclosure.
[0018] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising computer instructions, which, when executed by a processor, implement the video encoding method according to the embodiment of the present disclosure.
[0019] According to a sixth aspect of an embodiment of the present disclosure, a method for generating a bitstream is provided, comprising: generating a bitstream according to the video encoding method described in an embodiment of the present disclosure.
[0020] According to a seventh aspect of an embodiment of the present disclosure, a computer program product is provided, having instructions for storing a bit stream, wherein the bit stream includes: video data generated by the video encoding method according to the embodiment of the present disclosure.
[0021] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0022] By determining the inter-frame complexity and intra-frame complexity of the first video frame, it can be determined whether the first video frame is a transition frame. In response to the first video frame being a transition frame, the encoding bit rate of the transition frame can be obtained by improving the original encoding bit rate of the video to be encoded, so that the bit rate of the transition frame can be improved and the transition frame can be encoded at a higher bit rate, thereby solving the problem of unsatisfactory bit rate allocation for transition scenes affecting the subjective picture quality experience. The complexity analysis of the video frame and transition detection can be combined to provide more bit rates for transition frames that are sensitive to the human eye, thereby improving the subjective picture quality experience of the video containing the transition scene.
[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0025] Figure 1is a block diagram showing an exemplary system for encoding and decoding video blocks according to an exemplary embodiment of the present disclosure.
[0026] Figure 2 is a block diagram showing an exemplary video encoder according to an exemplary embodiment of the present disclosure.
[0027] Figure 3 is a block diagram showing an exemplary video decoder according to an exemplary embodiment of the present disclosure.
[0028] Figure 4 It is a schematic diagram of an example implementation scenario of a video encoding method according to an exemplary embodiment of the present disclosure.
[0029] Figure 5 The flowchart of a video encoding method is shown according to an exemplary embodiment of the present disclosure.
[0030] Figure 6 It is a flowchart of a video encoding method according to an exemplary embodiment of the present disclosure.
[0031] Figure 7 It is a schematic diagram comparing image quality before and after bit rate improvement in an application example of a video encoding method according to an exemplary embodiment of the present disclosure.
[0032] Figure 8 It is a schematic diagram of bit rate distribution after the bit rate of a transition frame is increased in an application example of a video encoding method according to an exemplary embodiment of the present disclosure.
[0033] Fig. 9 It is a schematic diagram of bit rate distribution after bit rate enhancement of a transition frame and multiple related video frames in an application example of a video encoding method according to an exemplary embodiment of the present disclosure.
[0034] Fig.10 is a block diagram showing a video encoding device according to an exemplary embodiment of the present disclosure.
[0035] Fig.11 is a block diagram of an electronic device according to an exemplary embodiment of the present disclosure.
[0036] Fig.12 is a diagram of a computing environment coupled with a user interface according to an exemplary embodiment of the present disclosure. DETAILED DESCRIPTION
[0037] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0038] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0039] It should be noted that the phrase "at least one of the items" in the present disclosure includes three types of parallel situations: "any one of the items", "a combination of any number of the items", and "all of the items". For example, "including at least one of A and B" includes the following three parallel situations: (1) including A; (2) including B; (3) including A and B. Another example is "executing at least one of step 1 and step 2" which means the following three parallel situations: (1) executing step 1; (2) executing step 2; (3) executing step 1 and step 2.
[0040] Figure 1 is a block diagram illustrating an exemplary system 10 for encoding and decoding video blocks in parallel according to some embodiments of the present disclosure. Figure 1 As shown in , system 10 includes a source device 12 that generates and encodes video data to be later decoded by a target device 14. Source device 12 and target device 14 may include any of a wide variety of electronic devices, including cloud servers, server computers, desktop or laptop computers, tablet computers, smart phones, set-top boxes, digital televisions, cameras, display devices, digital media players, video game consoles, video streaming devices, etc. In some implementations, source device 12 and target device 14 are equipped with wireless communication capabilities.
[0041] In some implementations, target device 14 may receive the encoded video data to be decoded via link 16. Link 16 may include any type of communication medium or device capable of moving the encoded video data from source device 12 to target device 14.
[0042] In some other embodiments, the encoded video data may be sent from the output interface 22 to the storage device 32. The encoded video data in the storage device 32 may then be accessed by the target device 14 via the input interface 28.
[0043] like Figure 1, source device 12 includes a video source 18, a video encoder 20, and an output interface 22. Video source 18 may include sources such as, or a combination of such sources: a video capture device (e.g., a camera), a video archive containing previously captured video, a video feed interface for receiving video from a video content provider, and / or a computer graphics system for generating computer graphics data as source video.
[0044] The captured, pre-captured, or computer-generated video may be encoded by video encoder 20. The encoded video data may be sent directly to target device 14 via output interface 22 of source device 12. The encoded video data may also (or alternatively) be stored on storage device 32 for later access by target device 14 or other devices for decoding and / or playback.
[0045] Target device 14 includes input interface 28, video decoder 30, and display device 34. Input interface 28 may include a receiver and / or a modem and receives encoded video data via link 16. The encoded video data transmitted via link 16 or provided on storage device 32 may include various syntax elements generated by video encoder 20 for use by video decoder 30 in decoding the video data. Such syntax elements may be included within the encoded video data sent over a communication medium, stored on a storage medium, or stored on a file server.
[0046] The video encoder 20 and the video decoder 30 can operate according to a proprietary standard or an industry standard (e.g., VVC, HEVC, Part 10 of MPEG-4, AVC) or an extension of such a standard. It should be understood that the present application is not limited to a specific video encoding / decoding standard and can be applied to other video encoding / decoding standards. It is generally believed that the video encoder 20 of the source device 12 can be configured to encode the video data according to any of these current standards or future standards. Similarly, it is also generally believed that the video decoder 30 of the target device 14 can be configured to decode the video data according to any of these current standards or future standards.
[0047] The video encoder 20 and the video decoder 30 may be implemented as any of a variety of suitable encoder and / or decoder circuits, such as one or more microprocessors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), discrete logic devices, software, hardware, firmware, or any combination thereof. When partially implemented in software, the electronic device may store instructions for the software in a suitable non-transitory computer-readable medium, and use one or more processors to execute the instructions in the hardware to perform the video encoding / decoding operations disclosed in the present disclosure. Each of the video encoder 20 and the video decoder 30 may be included in one or more encoders or decoders, and either of the encoders or decoders may be integrated as part of a combined encoder / decoder (CODEC) in the corresponding device.
[0048] Figure 2 is a block diagram illustrating an exemplary video encoder 20 according to some embodiments described in the present application. The video encoder 20 can perform intra-frame prediction coding and inter-frame prediction coding on video blocks within a video frame. Intra-frame prediction coding relies on spatial prediction to reduce or remove spatial redundancy in video data within a given video frame or picture. Inter-frame prediction coding relies on temporal prediction to reduce or remove temporal redundancy in video data within adjacent video frames or pictures of a video sequence. It should be noted that in the field of video coding and decoding, the term "frame" can be used as a synonym for the term "image" or "picture".
[0049] like Figure 2As shown in , the video encoder 20 includes a video data memory 40, a prediction processing unit 41, a decoded picture buffer (DPB) 64, an adder 50, a transform processing unit 52, a quantization unit 54, and an entropy coding unit 56. The prediction processing unit 41 further includes a motion estimation unit 42, a motion compensation unit 44, a segmentation unit 45, an intra-frame prediction processing unit 46, and an intra-frame block copy (BC) unit 48. In some embodiments, the video encoder 20 also includes an inverse quantization unit 58, an inverse transform processing unit 60, and an adder 62 for video block reconstruction. A loop filter 63 such as a deblocking filter can be located between the adder 62 and the DPB 64 to filter the block boundary to remove the block effect from the reconstructed video. In addition to the deblocking filter, another loop filter (e.g., a sample adaptive offset (SAO) filter, a cross-component sample adaptive offset (CCSAO) filter, and / or an adaptive loop filter (ALF)) can also be used to filter the output of the adder 62. In some examples, the loop filter may be omitted, and the decoded video blocks may be provided directly by adder 62 to DPB 64. Video encoder 20 may take the form of a fixed or programmable hardware unit, or may be distributed among one or more of the illustrated fixed or programmable hardware units.
[0050] Video data memory 40 may store video data to be encoded by components of video encoder 20. Figure 1 Video source 18 is shown obtaining video data in video data memory 40. DPB 64 is a buffer that stores reference video data (eg, reference frames or pictures) for use by video encoder 20 in encoding the video data (eg, in intra or inter prediction coding modes).
[0051] like Figure 2 As shown in , after receiving the video data, the segmentation unit 45 within the prediction processing unit 41 segments the video data into video blocks. This segmentation may also include segmenting the video frame into strips, tiles (e.g., a set of video blocks), or other larger coding units (CUs) according to a predefined splitting structure associated with the video data, such as a quadtree (QT) structure. It should be noted that the terms "block" or "video block" used herein may be a portion of a frame or picture, in particular a rectangular (square or non-square) portion. With reference to, for example, HEVC and VVC, a block or video block may be or correspond to a coding tree unit (CTU), a CU, a prediction unit (PU), or a transform unit (TU) and / or may be or correspond to a corresponding block (e.g., a coding tree block (CTB), a coding block (CB), a prediction block (PB), or a transform block (TB)) and / or a sub-block.
[0052] The prediction processing unit 41 may select one of a plurality of feasible prediction coding modes for the current video block based on the error results (e.g., coding rate and distortion level), such as one of one or more inter-frame prediction coding modes in a plurality of intra-frame prediction coding modes. The prediction processing unit 41 may provide the resulting intra-frame prediction coding block or inter-frame prediction coding block to the adder 50 to generate a residual block, and to the adder 62 to reconstruct the coding block for subsequent use as part of a reference frame. The prediction processing unit 41 also provides syntax elements (e.g., motion vectors, intra-frame mode indicators, partition information, and other such syntax information) to the entropy coding unit 56.
[0053] To select an appropriate intra-prediction coding mode for the current video block, intra-prediction processing unit 46 within prediction processing unit 41 may perform intra-prediction coding of the current video block in relation to one or more neighboring blocks in the same frame as the current block to be encoded to provide spatial prediction. Motion estimation unit 42 and motion compensation unit 44 within prediction processing unit 41 may perform inter-prediction coding of the current video block in relation to one or more prediction blocks in one or more reference frames to provide temporal prediction. Video encoder 20 may perform multiple encoding passes, for example, to select an appropriate coding mode for each block of video data.
[0054] In some embodiments, motion estimation unit 42 determines an inter-prediction mode for a current video frame by generating a motion vector according to a predetermined pattern within a sequence of video frames, the motion vector indicating the displacement of a video block within the current video frame relative to a prediction block within a reference video frame. Motion estimation performed by motion estimation unit 42 is the process of generating a motion vector that estimates the motion of a video block. For example, a motion vector may indicate the displacement of a video block within a current video frame or picture relative to a prediction block within a reference frame associated with a current block being encoded within the current frame. The predetermined pattern may designate a video frame in a sequence as a P frame or a B frame. Intra BC unit 48 may determine a vector (e.g., a block vector) for intra BC coding in a manner similar to the motion vector determined by motion estimation unit 42 for inter prediction, or may utilize motion estimation unit 42 to determine a block vector.
[0055] Regardless of whether the prediction block is from the same frame according to intra-frame prediction or from a different frame according to inter-frame prediction, the video encoder 20 can form a residual video block by subtracting the pixel values of the prediction block from the pixel values of the current video block being encoded. The pixel difference values forming the residual video block may include both luma component differences and chroma component differences.
[0056] Intra-prediction processing unit 46 may encode the current block using various intra-prediction modes, for example, during separate encoding passes, and intra-prediction processing unit 46 (or, in some examples, mode selection unit) may select an appropriate intra-prediction mode to use from the tested intra-prediction modes. Intra-prediction processing unit 46 may provide information indicating the intra-prediction mode selected for the block to entropy encoding unit 56. Entropy encoding unit 56 may encode the information indicating the selected intra-prediction mode into the bitstream.
[0057] After prediction processing unit 41 determines a prediction block for the current video block via inter-prediction or intra-prediction, adder 50 forms a residual video block by subtracting the prediction block from the current video block. The residual video data in the residual block may be included in one or more TUs and provided to transform processing unit 52. Transform processing unit 52 transforms the residual video data into residual transform coefficients using a transform (e.g., a discrete cosine transform (DCT) or a conceptually similar transform).
[0058] The transform processing unit 52 may send the resulting transform coefficients to a quantization unit 54. The quantization unit 54 quantizes the transform coefficients to further reduce the bit rate. The quantization process may also reduce the bit depth associated with some or all of the coefficients. The degree of quantization may be modified by adjusting a quantization parameter. In some examples, the quantization unit 54 may then perform a scan on the matrix including the quantized transform coefficients. Alternatively, the entropy coding unit 56 may perform the scan.
[0059] After quantization, entropy coding unit 56 entropy encodes the quantized transform coefficients into a video bitstream using, for example, context adaptive variable length coding (CAVLC), context adaptive binary arithmetic coding (CABAC), syntax-based context adaptive binary arithmetic coding (SBAC), probability interval partitioning entropy (PIPE) coding, or another entropy coding method or technique. The encoded bitstream may then be sent to a video bitstream such as a Figure 1 The video decoder 30 shown, or archived as Figure 1 The video frame may be stored in storage device 32 as shown for later transmission to or retrieval by video decoder 30. Entropy encoding unit 56 may also entropy encode motion vectors and other syntax elements for the current video frame being encoded.
[0060] Inverse quantization unit 58 and inverse transform processing unit 60 apply inverse quantization and inverse transform, respectively, to reconstruct the residual video block in the pixel domain for use in generating reference blocks for predicting other video blocks. As noted above, motion compensation unit 44 may generate a motion compensated prediction block from one or more reference blocks of a frame stored in DPB 64. Motion compensation unit 44 may also apply one or more interpolation filters to the prediction block to calculate sub-integer pixel values for use in motion estimation.
[0061] Adder 62 adds the reconstructed residual block to the motion compensated prediction block generated by motion compensation unit 44 to generate a reference block for storage in DPB 64. The reference block may then be used as a prediction block by intra BC unit 48, motion estimation unit 42, and motion compensation unit 44 to inter-predict another video block in a subsequent video frame.
[0062] Figure 3 1 is a block diagram showing an exemplary video decoder 30 according to some embodiments of the present application. The video decoder 30 includes a video data memory 79, an entropy decoding unit 80, a prediction processing unit 81, an inverse quantization unit 86, an inverse transform processing unit 88, an adder 90, and a DPB 92. The prediction processing unit 81 further includes a motion compensation unit 82, an intra-frame prediction unit 84, and an intra-frame BC unit 85. The video decoder 30 may perform the above-mentioned Figure 2 The encoding process is substantially the inverse of the decoding process described with respect to video encoder 20. For example, motion compensation unit 82 may generate prediction data based on motion vectors received from entropy decoding unit 80, and intra-prediction unit 84 may generate prediction data based on intra-prediction mode indicators received from entropy decoding unit 80.
[0063] In some examples, embodiments of the present disclosure may be dispersed in one or more of the units of the video decoder 30. For example, the intra BC unit 85 may perform embodiments of the present application alone or in combination with other units of the video decoder 30, such as the motion compensation unit 82, the intra prediction unit 84, and the entropy decoding unit 80. In some examples, the video decoder 30 may not include the intra BC unit 85, and the functions of the intra BC unit 85 may be performed by other components of the prediction processing unit 81, such as the motion compensation unit 82.
[0064] Video data memory 79 may store video data, such as an encoded video bitstream, to be decoded by other components of video decoder 30. Video data stored in video data memory 79 may be obtained, for example, from storage device 32, from a local video source (e.g., a camera), via wired or wireless network communication of video data, or by accessing a physical data storage medium (e.g., a flash drive or hard disk).
[0065] During the decoding process, the video decoder 30 receives an encoded video bitstream representing video blocks of an encoded video frame and associated syntax elements. The entropy decoding unit 80 of the video decoder 30 entropy decodes the bitstream to generate quantization coefficients, motion vectors or intra-frame prediction mode indicators, and other syntax elements. The entropy decoding unit 80 then forwards the motion vectors or intra-frame prediction mode indicators, and other syntax elements to the prediction processing unit 81.
[0066] When a video frame is encoded as an intra-prediction coded (I) frame or for intra-coded prediction blocks in other types of frames, the intra-prediction unit 84 of the prediction processing unit 81 can generate prediction data for a video block of the current video frame based on the intra-prediction mode transmitted by the signal and reference data from a previously decoded block of the current frame.
[0067] When the video frame is encoded as an inter-frame prediction coding (i.e., B or P) frame, the motion compensation unit 82 of the prediction processing unit 81 generates one or more prediction blocks for the video block of the current video frame based on the motion vector and other syntax elements received from the entropy decoding unit 80. Each of the prediction blocks can be generated from a reference frame in one of the reference frame lists. The video decoder 30 can construct the reference frame lists, i.e., List 0 and List 1, based on the reference frames stored in the DPB 92 using a default construction technique.
[0068] In some examples, when a video block is encoded according to the intra BC mode described herein, intra BC unit 85 of prediction processing unit 81 generates a prediction block for the current video block based on the block vector and other syntax elements received from entropy decoding unit 80. The prediction block may be within a reconstructed region of the same picture as the current video block as defined by video encoder 20.
[0069] Motion compensation unit 82 and / or intra BC unit 85 determine prediction information for a video block of the current video frame by parsing motion vectors and other syntax elements, and then use the prediction information to generate a prediction block for the current video block being decoded.
[0070] Motion compensation unit 82 may also perform interpolation using interpolation filters as used by video encoder 20 during encoding of the video blocks to calculate interpolated values for sub-integer pixels of reference blocks. In this case, motion compensation unit 82 may determine the interpolation filters used by video encoder 20 based on the received syntax elements and use these interpolation filters to produce the prediction blocks.
[0071] Inverse quantization unit 86 inverse quantizes the quantized transform coefficients provided in the bitstream and entropy decoded by entropy decoding unit 80, using the same quantization parameters calculated by video encoder 20 for each video block in the video frame to determine the degree of quantization. Inverse transform processing unit 88 applies an inverse transform (e.g., an inverse DCT, an inverse integer transform, or a conceptually similar inverse transform process) to the transform coefficients to reconstruct the residual block in the pixel domain.
[0072] After the motion compensation unit 82 or the intra BC unit 85 generates a prediction block for the current video block based on the vector and other syntax elements, the adder 90 reconstructs the decoded video block for the current video block by adding the residual block from the inverse transform processing unit 88 to the corresponding prediction block generated by the motion compensation unit 82 and the intra BC unit 85. A loop filter 91 (e.g., a deblocking filter, an SAO filter, a CCSAO filter, and / or an ALF) may be located between the adder 90 and the DPB 92 to further process the decoded video block. In some examples, the loop filter 91 may be omitted, and the decoded video block may be provided directly to the DPB 92 by the adder 90. The decoded video blocks in a given frame are then stored in the DPB 92, which stores reference frames for subsequent motion compensation of the next video block. The DPB 92 or a memory device separate from the DPB 92 may also store the decoded video for later presentation on a display device (e.g., Figure 1 on a display device 34).
[0073] As described above, during the video encoding process, the bit rate allocation strategies of the hardware encoder for the transition scenes are not ideal, which affects the subjective picture quality experience.
[0074] Specifically, since the content of the transitioned image has no information correlation with the previous frame, it is difficult to use temporal correlation for encoding, so more codewords are usually required. However, existing hardware encoders cannot customize the bitrate allocation strategy in different scenarios according to demand.
[0075] Taking the multimedia codec framework VideoToolbox as an example, it is mainly used for hardware-accelerated encoding and decoding of audio and video on iOS and mac operating system platforms. It provides developers with a set of application programming interfaces (APIs) and tools, allowing applications to use the hardware acceleration function of the device to perform efficient audio and video processing.
[0076] However, the multimedia codec framework exposes limited peripheral code control interfaces, limited adjustment space, and low flexibility. In addition, the multimedia codec framework cannot recognize scenes that require high bit rates, such as screen switching, and has limited effect in adaptively adjusting bit rate allocation according to different video complexity scenes.
[0077] In order to solve at least part of the above problems, exemplary embodiments of the present disclosure provide a video encoding method, a video encoding device, a bit stream generation method, an electronic device, a computer readable storage medium, and a computer program product. Figures 1 to 9 Describe in detail.
[0078] According to an exemplary embodiment of the present disclosure, a video encoding method is provided. The video encoding method can be applied to any video encoding scenario. Figure 4 An example implementation scenario of a video encoding method according to an exemplary embodiment of the present disclosure is given.
[0079] like Figure 4 As shown, when a user uses a video application client on a user terminal (e.g., mobile phone 411, desktop computer 412, tablet computer 413, etc.) to request to watch video content from a server or video distribution platform 430 through network 420, the server or video distribution platform 430 can send the requested video content to user terminals 411, 412 and / or 413 through network 420, and the user can watch the received video content through the video application client.
[0080] In the above process, the server or video distribution platform 430 needs to encode the video content to be sent. During the encoding process, the video to be sent can be encoded according to the video encoding method of the exemplary embodiment of the present disclosure. Specifically, the server or video distribution platform 430 can determine the intra-frame complexity of the first video frame in the video to be encoded and the inter-frame complexity of the first video frame relative to the second video frame, wherein the second video frame is before the first video frame; it can also determine whether the first video frame is a transition frame based on the inter-frame complexity and intra-frame complexity of the first video frame; it can also respond to the first video frame being a transition frame, based on the original encoding bit rate of the video to be encoded, obtain the encoding bit rate of the transition frame by improving the original encoding bit rate; it can also encode the transition frame based on the encoding bit rate of the transition frame.
[0081] It should be noted that although the above description uses a server or video distribution platform as an example, it is only an example. The executor of the video encoding method can be any electronic device, which may include, for example, smart phones, tablet computers, laptops, digital assistants, wearable devices, vehicle terminals, etc., which are physical devices that serve as hardware codecs, and may also include software that runs on physical devices as software video encoders.
[0082] It should also be noted that although the video encoding application scenario in which a user terminal requests to watch a video is described here as an example, it should be understood that the application scenario of the video encoding method according to the present disclosure is not limited to this, and it can also be applied to any other application scenario involving video encoding.
[0083] Figure 5 It is a flow chart of a video encoding method according to an exemplary embodiment. As described above, according to the video encoding method of the exemplary embodiment of the present disclosure, the bit rate can be increased for the transition frame (also referred to as "bit rate compensation"), and the transition frame can be encoded at a higher bit rate to solve the problem of the subjective picture quality experience being affected by the unsatisfactory bit rate allocation for the transition scene. It can combine the complexity analysis of the video frame and the transition detection to provide more bit rates for the transition frames that are sensitive to the human eye, thereby improving the subjective picture quality experience of the video containing the transition scene.
[0084] like Figure 5 As shown, the video encoding method according to an exemplary embodiment of the present disclosure may include the following steps:
[0085] In step S510, the intra-frame complexity of a first video frame in the video to be encoded and the inter-frame complexity of the first video frame relative to a second video frame may be determined, wherein the second video frame precedes the first video frame.
[0086] Here, the first video frame can be any video frame in the video to be encoded. For example, in the process of encoding the video to be encoded, each video frame can be taken as the first video frame in sequence according to the order in the video frame sequence, and its intra-frame complexity and inter-frame complexity can be determined to determine whether the video frame is a transition frame.
[0087] The second video frame may be any video frame before the first video frame, for example, may be a frame before the first video frame.
[0088] In this step, the inter-frame complexity can represent the information that needs to be encoded when the first video frame takes the second video frame as a reference; the intra-frame complexity can represent the information that needs to be encoded when the first video frame takes itself as a reference. The first video frame can be subjected to intra-frame prediction and inter-frame prediction in the encoding technology, and the codewords and distortion size required to encode the first video frame under the two prediction modes are calculated, thereby obtaining the above-mentioned intra-frame complexity and inter-frame complexity respectively. Here, the encoding complexity of the video frame can characterize the amount of information that needs to be encoded for the video frame, and the complexity can be represented by, for example, but not limited to, SAD (Sum of Absolute Difference) or SATD (Sum of Absolute Transformed Difference).
[0089] Here, for example, typical prediction methods in HEVC may be used but are not limited to perform intra-frame prediction and inter-frame prediction. As an example, the intra-frame prediction method may be but are not limited to 33 angle modes, direct current (DC) mode, planar mode, etc., and the inter-frame prediction method may be but are not limited to motion estimation, motion compensation, etc.
[0090] For example, Figure 6 As shown, the video encoding method according to the exemplary embodiment of the present disclosure can be implemented by a rate allocation model, wherein the video frames of the video to be encoded can be subjected to complexity analysis through the rate allocation model, specifically, intra-frame prediction and inter-frame prediction are performed to obtain complexity information including intra-frame complexity and inter-frame complexity for subsequent scene detection.
[0091] In addition, in step S510, as an example, in the process of determining the intra-frame complexity and the inter-frame complexity, the prediction algorithm can be optimized by fast algorithm and assembly, so as to reduce the overall complexity of the bit rate allocation, thereby ensuring that the prediction algorithm maintains a high accuracy without introducing excessive computing power consumption.
[0092] Here, the fast algorithm may include an intra-frame fast algorithm and an inter-frame fast algorithm. The intra-frame fast algorithm may reduce the types of prediction modes, for example, including but not limited to reducing the prediction types to five directions: lower left, left, upper left, upper and upper right, as well as a DC mode and a Planar mode; the inter-frame fast algorithm may reduce the number of reference frames, for example, each frame may only refer to the previous frame for motion estimation.
[0093] In addition, the fast algorithm may also include reducing the resolution of the video frame. For example, the length and width of the video frame may be reduced to 1 / 2, 1 / 4 or other proportions of the original size according to a preset configuration to reduce the amount of calculation.
[0094] In addition, the fast algorithm may also include reducing the inter-frame prediction search range. For example, during the inter-frame prediction search process, in response to the inter-frame complexity of the coding block being less than a preset threshold, the inter-frame prediction search process may be skipped.
[0095] Here, assembly optimization may include intra-frame assembly optimization and inter-frame assembly optimization. Intra-frame assembly optimization may, for example, but is not limited to, performing arm64 assembly optimization on all prediction modes to increase computational parallelism. Inter-frame assembly optimization may, for example, but is not limited to, performing single instruction multiple data (SIMD) assembly optimization on operations such as pixel interpolation in motion estimation and motion compensation, which may also increase computational parallelism.
[0096] By adding fast algorithms and assembly optimization, the calculation of this method can have no obvious impact on the overall encoding complexity, significantly improving the user experience when producing and consuming videos.
[0097] Return to reference Figure 5 In step S520, it can be determined whether the first video frame is a transition frame based on the inter-frame complexity and intra-frame complexity of the first video frame.
[0098] In this step, it can be determined whether the first video frame is a transition frame based on the complexity difference between the inter-frame complexity and the intra-frame complexity of the first video frame. Figure 6 As shown, the scene detection function of the bit rate allocation model can be used to determine whether the first video frame is a transition frame, thereby obtaining scene switching information. Specifically, the transition frame can be determined.
[0099] As an example, in response to the complexity difference exceeding the difference threshold, the first video frame may be determined to be a transition frame; in response to the complexity difference not exceeding the difference threshold, the first video frame may be determined to be a non-transition frame.
[0100] Specifically, when the inter-frame complexity is relatively large relative to the intra-frame complexity, it can be said that the first video frame does not obtain higher encoding performance by using the preceding second video frame as a reference compared to only referring to itself, indicating that the first video frame has a low correlation with the preceding second video frame, and thus it can be judged as a transition frame. By determining the transition frame by analyzing the complexity difference, the transition scene in the video can be detected more accurately, which serves as the basis for improving the bit rate of the transition scene, and is conducive to guiding the subsequent more reasonable allocation of the encoding bit rate.
[0101] Here, the complexity difference between the inter-frame complexity and the intra-frame complexity may be represented by, for example but not limited to, a ratio, a difference, or other mathematical methods. As an example, the complexity difference may be represented by the ratio in the following formula (1):
[0102]
[0103] Among them, inter_cost represents the inter-frame complexity, which represents the information that needs to be encoded when the first video frame uses the second video frame as a reference; intra_cost represents the intra-frame complexity, which represents the information that needs to be encoded when the first video frame uses itself as a reference. For this formula (1), the larger the ratio ratio is, the less information the first video frame can refer to from the second video frame, the greater the difference between the two frame scenes, the higher the inter-frame complexity, the lower the correlation between the first video frame and the second video frame, and the greater the possibility that the first video frame is a transition frame. However, the representation method of complexity difference is not limited to this formula (1), for example, it can also be represented by the inverse of the ratio ratio.
[0104] When the complexity difference is determined, the first video frame may be determined to be a transition frame in response to the complexity difference exceeding a difference threshold.
[0105] Here, the difference threshold may be an empirical value according to industry standards. Taking the above formula (1) as an example, according to the Scenecut decision algorithm in High Efficiency Video Coding (HEVC), a difference threshold scenecut_th may be set, and the difference threshold scenecut_th may be, for example, but not limited to, 40%. If the ratio ratio in the above formula (1) exceeds the difference threshold scenecut_th, it may be considered that the two frames of scenes are significantly different, and thus a transition may be considered to have occurred.
[0106] However, the difference threshold is not limited to a constant, and it may also be changed dynamically during the encoding process, or specifically, during the process of detecting transition frames.
[0107] For example, according to an embodiment of the present disclosure, in the process of determining whether the first video frame is a transition frame, the video encoding method may further include: updating a difference threshold; and determining whether a third video frame after the first video frame is a transition frame based on the updated difference threshold.
[0108] Here, the step of updating the difference threshold may include: in response to the number of transition frames determined in a video frame sequence of a preset window size being greater than a first preset number of transition frames, increasing the difference threshold; in response to the number of transition frames determined in a video frame sequence of a preset window size being less than a second preset number of transition frames, reducing the difference threshold, wherein the second preset number of transition frames is less than or equal to the first preset number of transition frames.
[0109] Specifically, according to the sequence of video frames in the video to be encoded, the transition frame can be detected for each video frame, and an initial difference can be set as a difference threshold at the time of initial detection, for example, an initial difference scenecut_th_base can be set for the above-mentioned difference threshold scenecut_th. In the sequential detection of the video frame sequence, in the preset detection window, if the number of the detected transition frames is greater than the first preset transition frame number, the difference threshold can be increased, for example, the initial difference scenecut_th_base is increased to the increased difference threshold scenecut_th_max, so that the subsequent video frames are subjected to transition frame detection based on the increased difference threshold, so that the judgment condition of the transition frame can be strengthened to avoid excessive detection of the transition frame. Until the number of the transition frames detected in the detection window is less than the second preset transition frame number, the difference threshold can be reduced, for example, the increased difference threshold scenecut_th_max can be adjusted back to the initial difference scenecut_th_base, so that the subsequent video frames are subjected to transition frame detection based on the reduced difference threshold.
[0110] The main reason for dynamically adjusting the difference threshold in this way is that the judgment of the transition frame will affect the number of times the bit rate is increased. Excessive increase will easily lead to a large increase in the final bit rate. Here, the preset window size, the first preset number of transition frames and the second preset number of transition frames can be set according to actual needs. For example, for the above formula (1), the initial difference scenecut_th_base can be set to 70%, the increased difference threshold scenecut_th_max can be 85%, the preset window size can be, for example, but not limited to 20 frames, the first preset number of transition frames can be, for example, but not limited to 4 frames, and the second preset number of transition frames can be, for example, but not limited to 3 frames. In this way, the bit rate can be increased only when the picture difference is extremely large or when the bit rate is more likely to be insufficient.
[0111] For example, if more transition frames than the first preset transition frame number b are detected within the a frame range (e.g., detection window) after the bit rate is increased, it can be considered that the current scene continues to change dramatically, and the difference threshold can be increased to reduce the number of transition detections and control the number of bit rate increases. After the difference threshold is increased, if the number of transition frames detected within the a frame range (e.g., detection window) after the bit rate is increased is lower than the second preset transition frame number c, it can be considered that the current scene has stabilized, and the difference threshold can be reduced, for example, the difference can be adjusted back to the initial difference.
[0112] By the above method, the detection threshold of the transition frame can be dynamically adjusted to avoid frequent bit rate increase caused by excessive detection of transition frames, thereby reducing the calculation pressure and communication burden. In addition, when the second preset transition frame number is set to be less than the first preset transition frame number, the situation that the difference threshold may repeatedly jump when the two are equal can be avoided, thereby improving the stability of the detection process.
[0113] Return to reference Figure 5 In step S530, in response to the first video frame being a transition frame, based on the original encoding bit rate of the video to be encoded, the encoding bit rate of the transition frame can be obtained by increasing the original encoding bit rate.
[0114] Here, the original encoding rate of the video to be encoded may be preset, for example, an expected encoding rate. The original encoding rate may be used as a benchmark for increasing the rate of the transition frame, and the rate of the transition frame may be increased based on the benchmark to obtain the encoding rate of the transition frame.
[0115] As an example, the encoding bit rate of the transition frame can be increased to n times the original encoding bit rate, where n is greater than 1. Here, the increase multiple n can be adjusted according to bandwidth conditions and storage space. However, the method of increasing the encoding bit rate is not limited to this, and other methods can also be used, as long as the encoding bit rate of the transition frame after the increase is greater than the original encoding bit rate.
[0116] For step S530, in one example, in response to the first video frame being a transition frame, the encoding bit rate of the transition frame can be directly obtained by improving the original encoding bit rate; in response to the first video frame being a non-transition frame, the original encoding bit rate can be used as the encoding bit rate of the first video frame. However, the embodiments of the present disclosure are not limited to this. In another example, the encoding complexity of the transition frame itself can be further determined, and according to the encoding complexity of the transition frame itself, it is determined whether it is necessary to perform the step of obtaining the encoding bit rate of the transition frame by improving the original encoding bit rate on the transition frame.
[0117] As an example, in response to the first video frame being a transition frame, the video encoding method may further include: in response to the statistical value of the inter-frame complexity of video frames within a first preset number of frames starting from the first video frame being greater than the preset complexity, executing the method of obtaining the encoding bit rate of the transition frame by improving the original encoding bit rate; in response to the statistical value being less than or equal to the preset complexity, encoding the first video frame based on the original encoding bit rate.
[0118] Through the above method, when the encoding complexity of the transition frame itself is relatively high, the process of improving the original encoding bit rate to obtain the encoding bit rate of the transition frame can be performed, so as to specifically improve the encoding bit rate of the transition frame and ensure the image quality of the transition frame; and for the detected transition frame, even if it belongs to the transition scene, no matter whether the picture of the transition scene is complex, if the scene is basically a static scene or there is no obvious dynamic change, the inter-frame complexity of the subsequent frames of the transition may be relatively low, and the required bit rate is not high, and the bit rate increase may not be performed on such transition frames, thereby minimizing the number of bit rate increases, improving the encoding speed, and reducing the encoding calculation amount and bandwidth cost.
[0119] In this case, whether the bit rate of the transition frame needs to be increased can be determined by measuring the inter-frame complexity level of the video frames in a video after the transition. For example, the statistical value of the inter-frame complexity of the video frames within a first preset number of frames starting from the first video frame can be calculated.
[0120] Here, the inter-frame complexity of the video frames within the first preset frame number may be, for example, information to be encoded using the previous frame as a reference. The statistical value may be, for example, but not limited to, an average value, or may be calculated using other statistical methods, such as a standard deviation or variance.
[0121] The first preset number of frames can be set according to actual needs. In one example, the first preset number of frames can be less than or equal to the maximum video frame capacity of the lookahead buffer. Specifically, in the process of encoding the video to be encoded, each video frame is sequentially stored in the lookahead buffer, and the video frames in the lookahead buffer are encoded in a first-in-first-out (Fifo) order. In this regard, when the first preset number of frames is less than or equal to the maximum video frame capacity of the lookahead buffer, the video frames in the lookahead buffer (e.g., all video frames) can be directly used to calculate the above statistical values, so that statistical calculations can be facilitated.
[0122] The preset complexity may be set according to actual needs, for example, or may be determined according to the block complexity or block size of the transition frame.
[0123] Specifically, the block complexity is related to the size of the block. The larger the block size, the more complexity information. Therefore, the preset complexity Cplx_th can also be related to the size of the block. For example, the preset complexity Cplx_th can be expressed by the following formula (2):
[0124]
[0125] Among them, s1 and s2 represent preset coefficients, which can be set according to actual needs, for example, s1 can be 7000, and s2 can be 5; Cu_count represents the number of blocks in the transition frame.
[0126] As an example, Cu_count=cu_width·cu_height, wherein cu_width represents the number of blocks in the transition frame in the width direction, and cu_height represents the number of blocks in the transition frame in the height direction.
[0127] Return to reference Figure 5 In step S540, the transition frame may be encoded based on the encoding bit rate of the transition frame.
[0128] In this step, the transition frame may be encoded based on the encoding bit rate of the transition frame, for example, by using an existing encoding method.
[0129] The above describes an example process of improving the encoding bit rate of the transition frame. As an example, in an embodiment of the present disclosure, the encoding bit rate of multiple related video frames after the transition frame can also be improved, so that the encoding bit rate of a video frame sequence starting from the transition frame is improved, thereby improving the overall viewing experience of the transition scene.
[0130] As an example, the video encoding method may further include: based on the original encoding bit rate of the video to be encoded, obtaining the encoding bit rates of a plurality of related video frames after the transition frame by increasing the original encoding bit rate.
[0131] In this example, the encoding bit rate of the previous video frame in any adjacent video frame among the transition frame and the multiple related video frames is greater than or equal to the encoding bit rate of the next video frame in the adjacent video frames.
[0132] Specifically, since the human eye has a weak ability to distinguish consecutive video frames, when watching a video, the transition frame and several video frames after the transition frame may be perceived as transition scenes. Therefore, the bit rate of the transition frame and several related video frames after the transition frame can be increased. Since the video frame closer to the transition frame has a stronger correlation with the transition, and vice versa, the encoding bit rate of the related video frames close to the transition frame can be increased more. As the distance between the related video frame and the transition frame increases, the degree of improvement of the encoding bit rate can be gradually reduced, so that the encoding bit rate gradually decreases from the transition frame until it falls back to the original encoding bit rate. In this way, the encoding quality of the transition scene can be further improved, and the viewing experience can be improved.
[0133] As an example, the encoding bitrates of the transition frame and the multiple related video frames can be gradually reduced from the encoding bitrate of the transition frame to the original encoding bitrate at a preset decay step size. For example, when the encoding bitrate of the transition frame is increased to n times the original encoding bitrate, the encoding bitrates of the related video frames after the transition frame can be expressed by the following equations (3) and (4):
[0134]
[0135] Where br represents the encoding bit rate of the current frame (i.e., the transition frame or the related video frame), BR represents the original encoding bit rate, n represents increasing the encoding bit rate of the transition frame to n times the original encoding bit rate, L represents the preset sliding window, l step represents the attenuation step length, dist represents the number of frames between the current frame and the transition frame, which can be the difference between the frame number of the current frame and the frame number of the transition frame, and floor represents rounding down. The above equations (3) and (4) indicate that within the sliding window L, the encoding bit rate of the relevant video frame after the transition frame is adjusted according to the attenuation step length l. step The bit rate is gradually reduced to the original encoding bit rate in a step-down manner.
[0136] By making the encoding bit rate of the video frames in the transition scene fall back to the original encoding bit rate in a step-like manner, the encoding bit rate of the video frames within the same attenuation step is the same, and there is no need to calculate the bit rate for each frame. Therefore, the encoding calculation amount can be minimized while improving the encoding quality of multiple video frames close to the transition scene.
[0137] Although the above describes that the encoding bit rate of the transition frame and multiple related video frames is gradually reduced in a step-like attenuation manner with a preset attenuation step length, the embodiments of the present disclosure are not limited thereto, and other reduction methods may also be used, such as linear or nonlinear reduction.
[0138] In addition, the above describes an example process of improving the encoding bit rate of the detected transition frame. As an example, in an embodiment of the present disclosure, the number of times or frequency of bit rate improvement for the transition frame can also be limited to eliminate the interference of some noisy scenes that do not require bit rate improvement. In such a noisy scene, multiple transition frames may be frequently detected. By introducing a bit rate improvement limitation mechanism, frequent bit rate improvement can be avoided, which may lead to a final exported bit rate that is too high.
[0139] In one example, a stroboscopic scene can be detected. Specifically, the video encoding method may further include: in response to the number of transition frames determined within a second preset frame number starting from the current transition frame being greater than or equal to a preset number, encoding the current transition frame based on the original encoding bit rate; in response to the number of transition frames determined within the second preset frame number starting from the current transition frame being less than a preset number, executing, for the current transition frame, a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate.
[0140] Specifically, when a transition frame is detected, it can be determined whether the number of transition frames contained in the second preset frame number starting from the transition frame is greater than the preset number. If it is greater than the preset number, it can be considered that the current transition frame may belong to a stroboscopic scene. Since the human eye has weak visual resolution for stroboscopic scenes, the bit rate of the transition frames in the stroboscopic scene does not need to be increased, thereby reducing the encoding calculation amount and bandwidth cost.
[0141] Here, the second preset frame number and the preset number can be set according to actual needs. The second preset frame number can be, for example, but not limited to, 3 frames, and the preset number can be, for example, but not limited to, 2.
[0142] As an example, the above-mentioned stroboscopic scene detection can be realized by using a pre-read buffer. Specifically, as described above, in the process of encoding the video to be encoded, each video frame is sequentially stored in the pre-read buffer, and the video frames in the pre-read buffer are encoded in a Fifo order, where the maximum video frame capacity of the pre-read buffer can be the above-mentioned second preset number of frames.
[0143] In this way, after complexity analysis of the input frame, the complexity information of each frame can be stored in the pre-read buffer in sequence. After the pre-read buffer is full, encoding can be started from the earliest frame according to the Fifo order. If multiple transition frames are detected in the pre-read buffer, it means that the current transition frame is in a stroboscopic scene, and the bit rate of the current transition frame does not need to be increased.
[0144] Specifically, in response to the number of transition frames in the pre-read buffer being greater than or equal to a preset number, the current transition frame is encoded based on the original encoding bit rate; in response to the number of transition frames in the pre-read buffer being less than a preset number, for the current transition frame, a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is executed.
[0145] In addition, as an example, the second preset frame number may be greater than or equal to the first preset frame number described above. It can be seen that in an embodiment of the present disclosure, the first preset frame number and the second preset frame number may be determined with reference to the maximum video frame capacity of the pre-read buffer, so that the number of bit rate increases may be limited in different ways, such as by limiting the inter-frame complexity statistics within the first preset frame number and limiting the number of transition frames detected within the second preset frame number.
[0146] Additionally or alternatively, in another example, the number of times or frequency of performing the bit rate increase can be limited by setting a minimum frame number interval for the bit rate increase. Specifically, the video encoding method may also include: in response to the number of frames from the transition frame to the target transition frame being greater than a preset minimum frame number interval, for the transition frame, performing a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate; in response to the number of frames from the transition frame to the target transition frame being less than or equal to a preset minimum frame number interval, encoding the transition frame based on the original encoding bit rate, or, based on the distance from the target transition frame, determining the encoding bit rate for the transition frame and encoding the transition frame.
[0147] Here, after triggering the bit rate increase of the transition frame, the frame number distance for performing the next bit rate increase can be greater than the preset minimum frame number interval, where the frame number interval can refer to the number of video frames between two video frames (excluding the two endpoint video frames). The preset minimum frame number interval can be set according to actual needs, for example, it can be 20 frames.
[0148] As an example, the preset minimum frame number interval may be greater than the number of multiple related video frames after the transition frame, for example, may be greater than the preset sliding window L described above minus 1. In this way, when the bit rate of the related video frames after the transition frame is increased, it can be avoided that the bit rate increase of the related video frames cannot be correctly performed due to the limitation of the preset minimum frame number interval being set at the same time.
[0149] In addition, when the number of frames between the current transition frame and the target transition frame is less than or equal to the preset minimum frame interval and greater than the number of multiple related video frames after the target transition frame (for example, the above L minus 1), the current transition frame can be encoded based on the original encoding bit rate.
[0150] When the number of frames between the current transition frame and the target transition frame is less than the preset minimum frame interval and less than the number of multiple related video frames after the target transition frame (for example, L minus 1 above), the current transition frame can be a frame in the related video frames after the target transition frame. In this case, the encoding bit rate of the current transition frame can be determined based on the number of frames between the current transition frame and the target transition frame, using the method of improving the encoding bit rate of the related video frames described above. For example, the encoding bit rate of the current transition frame can be determined by the above formula (3), and the number of frames between the current transition frame and the target transition frame is dist in formula (3), so that the current transition frame can be encoded based on the encoding bit rate determined thereby.
[0151] Additionally or alternatively, in another example, the video encoding method may further include: in response to the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate being performed within the first preset video frame range for a number of times greater than the first preset number of times, encoding the transition frame within the second preset video frame range after the first preset video frame range based on the original encoding bit rate.
[0152] Here, the first preset video frame range may be greater than the above-mentioned preset minimum frame number interval. Specifically, after triggering a bit rate increase, if the first preset number of bit rate increases are triggered within the first preset video frame range, the bit rate increase will no longer be performed within the second preset video frame range. Here, the first preset video frame range and the second preset video frame range may be test experience values, for example, the first preset video frame range may be 50 frames, and the second preset video frame range may be 100 frames. In this way, even if the minimum frame number interval is met, multiple compensations may occur, for example, multiple increases are performed within a range of 50 frames. In this case, the bit rate increase of a video frame range (for example, 100 frames) can be stopped, further limiting the number of bit rate increases and reducing the computational and communication burdens.
[0153] In some videos, there may be a large number of transitions that meet the conditions within a period of time. The large number of transitions mentioned here does not mean frequent strobing in a short period of time, but multiple transitions in a longer period of time, such as frequent switching of lenses in e-commerce product displays. In this case, by adopting the above-mentioned restriction method, subsequent transition scenes can be sacrificed within a certain period of time, such as the transition scenes within the above-mentioned second preset video frame range, to avoid a sudden increase in bit rate and control the encoding calculation amount of the entire video.
[0154] Additionally or alternatively, in another example, the video encoding method may further include: in response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within a time window of preset length has reached a second preset number, encoding subsequent transition frames within the current time window based on the original encoding bit rate until reaching the next time window.
[0155] Specifically, the maximum number of bit rate increases within a time window of a preset length can be set. If the number of bit rate increases within the time window reaches the upper threshold, the bit rate will no longer be increased until the next unit time window is opened.
[0156] In this way, the number of times the bit rate is increased can be limited from the time dimension, which can be used together with the above-mentioned restriction mechanisms to limit the bit rate increase from different dimensions.
[0157] It should be noted that the above-mentioned rate increase limiting mechanisms can be used alone or in any combination. In addition, all variables in each rate increase limiting mechanism have an external setting interface, so that they can be issued through upper layer control and different parameter combinations can be configured according to different scene requirements.
[0158] like Figure 6 As shown, the various rate increase restrictions described above can be implemented in the rate decision module of the rate allocation model. For example, the rate decision module can calculate the encoding rate of the video frames that need to perform rate increase based on complexity information, scene switching information and a preset original encoding rate, and input the final decision rate into the hardware encoder.
[0159] In addition, the video encoding method according to the embodiments of the present disclosure can be adapted to various hardware encoders such as Video Tool Box (VTB), MediaCodec of Android platform, etc., as long as the hardware encoder supports the real-time bit rate setting interface.
[0160] The video encoding method according to the embodiment of the present invention was verified on the iOS VideoToolBox hardware encoder. Under 100 test sequences, the average bit rate decreased by 1.23%, and the subjective evaluation index KVQ (Kuaishou VideoQuality) increased by 0.01. The picture quality improvement reached the level visible to the human eye. At the same time, the bad cases of picture quality in some transition scenes were improved, and the overall calculation complexity was extremely low. Taking the VTB hardware encoder as the reference benchmark, the complexity increased by only less than 4%, which solved the pain point that the hardware encoders on the market could not adjust the code control to improve the picture quality according to the scene requirements.
[0161] Figure 7 A schematic diagram showing comparison of image quality before and after bit rate improvement in an application example of a video encoding method according to an exemplary embodiment is shown. Figure 7 The left picture in the figure is the video screen exported by the original encoder, and the right picture is the video screen exported by the encoder after the bit rate is increased by the above video encoding method. It can be observed that the overall picture quality of the video is improved.
[0162] Figure 8 and Fig. 9 The bit rate distribution of a transition frame after the bit rate is increased and the bit rate distribution of a transition frame and a plurality of related video frames after the bit rates are increased in an application example of a video encoding method according to an exemplary embodiment are respectively shown.
[0163] from Figure 8 It can be seen that the encoding bit rate of the transition frame has been significantly improved; Fig.10 It can be seen that after the bit rate is increased, the encoding bit rates of the transition frame and subsequent multiple related video frames are improved.
[0164] According to the video encoding method of the embodiment of the present invention, a content-adaptive encoder bit rate improvement scheme is proposed. By combining the complexity information within and between frames, it is determined whether the current scene is a transition scene, so as to more reasonably allocate codewords to scenes of different complexities, thereby obtaining better subjective picture quality under the condition that the overall encoding bit rate does not change much.
[0165] Specifically, in this video encoding method, complexity analysis and transition detection can be combined to provide more bit rates for scenes with complex transitions that are sensitive to the human eye and have higher bit rate requirements, thereby improving the subjective viewing experience of videos in multiple scenarios.
[0166] In addition, according to the video encoding method of the embodiment of the present disclosure, a variety of noise scene detection mechanisms and bit rate increase limitation mechanisms can also be introduced to eliminate interference from non-target scenes such as stroboscopic light, and avoid the model frequently performing bit rate increases that lead to excessively high exported bit rates.
[0167] Fig.10 is a block diagram of a video encoding device according to an exemplary embodiment. Fig.10 The video encoding device 1000 includes a complexity determination unit 1010, a transition frame determination unit 1020, a lifting unit 1030 and an encoding unit 1040.
[0168] The complexity determination unit 1010 is configured to determine the intra-frame complexity of a first video frame in a video to be encoded and the inter-frame complexity of the first video frame relative to a second video frame, wherein the second video frame precedes the first video frame.
[0169] The transition frame determining unit 1020 is configured to determine whether the first video frame is a transition frame according to the inter-frame complexity and the intra-frame complexity of the first video frame.
[0170] The improving unit 1030 is configured to obtain the encoding bit rate of the transition frame by improving the original encoding bit rate based on the original encoding bit rate of the video to be encoded in response to the first video frame being a transition frame.
[0171] The encoding unit 1040 is configured to encode the transition frame based on the encoding bit rate of the transition frame.
[0172] As an example, the transition frame determining unit 1020 is further configured to: in response to a complexity difference between the inter-frame complexity and the intra-frame complexity of the first video frame exceeding a difference threshold, determine that the first video frame is a transition frame.
[0173] As an example, the video encoding device also includes an updating unit 1050, which is configured to: update a difference threshold; and determine whether a third video frame after the first video frame is a transition frame based on the updated difference threshold, wherein updating the difference threshold includes: increasing the difference threshold in response to the number of transition frames determined within a video frame sequence of a preset window size being greater than a first preset number of transition frames; and decreasing the difference threshold in response to the number of transition frames determined within a video frame sequence of a preset window size being less than a second preset number of transition frames, wherein the second preset number of transition frames is less than or equal to the first preset number of transition frames.
[0174] As an example, in response to the first video frame being a transition frame, the enhancement unit 1030 is further configured to: in response to the statistical value of the inter-frame complexity of video frames within a first preset number of frames starting from the first video frame being greater than the preset complexity, obtain the encoding bit rate of the transition frame by enhancing the original encoding bit rate; in response to the statistical value being less than or equal to the preset complexity, encode the first video frame based on the original encoding bit rate.
[0175] As an example, the improving unit 1030 is also configured to: based on the original encoding bit rate of the video to be encoded, obtain the encoding bit rate of multiple related video frames after the transition frame by improving the original encoding bit rate, wherein the encoding bit rate of the previous video frame in any adjacent video frames among the transition frame and the multiple related video frames is greater than or equal to the encoding bit rate of the next video frame in the adjacent video frames.
[0176] As an example, the encoding bit rates of the transition frame and the multiple related video frames are gradually reduced from the encoding bit rate of the transition frame to the original encoding bit rate with a preset attenuation step size.
[0177] As an example, the video encoding device also includes a rate increase limiting unit 1060, which is configured to: in response to the number of transition frames determined within a second preset frame number starting from the transition frame being greater than or equal to a preset number, encode the transition frame based on the original encoding bit rate; in response to the number of transition frames determined within the second preset frame number starting from the transition frame being less than the preset number, for the transition frame, perform the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate.
[0178] As an example, the bit rate increase limiting unit 1060 is also configured to: in response to the number of frames from the transition frame to the target transition frame being greater than a preset minimum frame number interval, for the transition frame, perform a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate, wherein the target transition frame is the transition frame with the increased encoding bit rate that is closest to the transition frame before the transition frame; in response to the number of frames from the transition frame to the target transition frame being less than or equal to the preset minimum frame number interval, encode the transition frame based on the original encoding bit rate, or, based on the number of frames from the target transition frame, determine the encoding bit rate of the transition frame and encode the transition frame.
[0179] As an example, the bit rate increase limiting unit 1060 is also configured to: in response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within the first preset video frame range is greater than the first preset number of times, based on the original encoding bit rate, encode the transition frames within the second preset video frame range after the first preset video frame range, wherein the first preset video frame range is greater than the preset minimum frame interval; and / or, in response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within a time window of a preset length has reached a second preset number of times, based on the original encoding bit rate, encode the subsequent transition frames within the current time window until the next time window is reached.
[0180] Regarding the device in the above embodiment, the specific manner in which each unit performs the operation has been described in detail in the embodiment of the method, and will not be elaborated here.
[0181] Fig.11 FIG. 1 is a block diagram of an electronic device according to an exemplary embodiment. Fig.11 As shown, the electronic device 1100 includes a processor 1110 and a memory 1120 for storing processor executable instructions. Here, when the processor executable instructions are executed by the processor, the processor executes the video encoding method as described in the above exemplary embodiments.
[0182] As an example, the electronic device 1100 may be a single device, or may be any device or circuit that can execute the above instructions (or instruction sets) individually or jointly. The processor 1110 may include a central processing unit (CPU), a graphics processing unit (GPU), a programmable logic device, a dedicated processor system, a microcontroller, or a microprocessor. The processor 1110 may run instructions or codes stored in the memory 1120. Instructions and data may also be sent and received over a network via a network interface device, which may use any known transmission protocol.
[0183] The memory 1120 may be integrated with the processor 1110. The memory 1120 and the processor 1110 may be operatively coupled or may communicate with each other, for example, via an I / O port, a network connection, etc. In addition, the electronic device 1100 may further include a video display and a user interaction interface.
[0184] In an exemplary embodiment, a computer-readable storage medium may also be provided. When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can perform the video encoding method as described in the above exemplary embodiment. The computer-readable storage medium may be, for example, a memory including instructions. Optionally, the computer-readable storage medium may be: a read-only memory (ROM), a random access memory (RAM), a random access programmable read-only memory (PROM), an electrically erasable programmable read-only memory (EEPROM), a dynamic random access memory (DRAM), a static random access memory (SRAM), a flash memory, a non-volatile memory, a CD-ROM, a CD-R, a CD+R, a CD-RW, a CD+RW, a DVD-ROM, a DVD-R, a DVD+R, a DVD-RW, a DVD+RW, a DVD-RAM, a BD-ROM, a BD-R, a BD-R LTH, BD-RE, Blu-ray or optical disk storage, hard disk drive (HDD), solid state drive (SSD), card storage (such as, MultiMediaCard, Secure Digital (SD) card or Extreme Digital (XD) card), magnetic tape, floppy disk, magneto-optical data storage device, optical data storage device, hard disk, solid state disk and any other device, any other device configured to store the computer program and any associated data, data files and data structures in a non-transitory manner and provide the computer program and any associated data, data files and data structures to a processor or computer so that the processor or computer can execute the computer program.
[0185] In an exemplary embodiment, a computer program product may also be provided. The computer program product includes computer instructions. When the computer instructions are executed by a processor, the video encoding method as described in the exemplary embodiment above is implemented.
[0186] In an exemplary embodiment, a method for generating a bitstream may be provided. The method includes: generating a bitstream according to the video encoding method as described in the exemplary embodiment above.
[0187] In an exemplary embodiment, a computer program product may also be provided, having instructions for storing a bit stream, the bit stream comprising: video data generated according to the video encoding method as described in the above exemplary embodiments.
[0188] Fig.12A computing environment 1210 is shown coupled to a user interface 1250. The computing environment 1210 may be part of a data processing server. The computing environment 1210 includes a processor 1220, a memory 1230, and an input / output (I / O) interface 1240.
[0189] The processor 1220 generally controls the overall operation of the computing environment 1210, such as operations associated with display, data acquisition, data communication, and image processing. The processor 1220 may include one or more processors for executing instructions to perform all or some of the steps in the above method. In addition, the processor 1220 may include one or more modules that facilitate the interaction between the processor 1220 and other components.
[0190] The memory 1230 is configured to store various types of data to support the operation of the computing environment 1210. The memory 1230 may include predetermined software 1232. Examples of such data include instructions for any application or method operating on the computing environment 1210, video data sets, image data, etc. The memory 1230 may be implemented using any type of volatile or non-volatile memory device or a combination thereof.
[0191] I / O interface 1240 provides an interface between processor 1220 and peripheral interface modules (e.g., keyboard, click wheel, buttons, etc.). Buttons may include, but are not limited to, a home button, a start scan button, and a stop scan button. I / O interface 1240 may be coupled to an encoder and a decoder.
[0192] In an embodiment, a non-transitory computer-readable storage medium including, for example, a plurality of programs in a memory 1230 and / or storing a bit stream generated by the above encoding method or a bit stream to be decoded by the above decoding method is also provided, wherein the plurality of programs can be executed by a processor 1220 in a computing environment 1210 to perform the above method. In one example, the plurality of programs can be executed by a processor 1220 in a computing environment 1210 to (for example, from Figure 2 The video encoder 20 in the computing environment 1210 receives a bit stream or data stream including encoded video information (e.g., video blocks representing encoded video frames, and / or one or more associated syntax elements, etc.), and can also be executed by the processor 1220 in the computing environment 1210 to perform the above decoding method according to the received bit stream or data stream. In another example, the multiple programs can be executed by the processor 1220 in the computing environment 1210 to perform the above encoding method to encode the video information into a bit stream or data stream, and can also be executed by the processor 1220 in the computing environment 1310 to (e.g., to Figure 3Alternatively, a non-transitory computer-readable storage medium may store the bit stream or data stream generated by the encoder (e.g., Figure 2 The video encoder 20 in FIG. 1 generates a video signal for a decoder (eg, Figure 3 A bitstream or data stream including encoded video information used by the video decoder 30 in FIG. 3 when decoding video data.
[0193] In an embodiment, a bit stream generated by the above encoding method or a bit stream to be decoded by the above decoding method is provided. In an embodiment, a bit stream including encoded video information generated by the above encoding method or encoded video information to be decoded by the above decoding method is provided.
[0194] In an embodiment, a computing device is also provided, which includes: one or more processors (e.g., processor 1220); and a non-transitory computer-readable storage medium or memory 1230 in which multiple programs that can be executed by the one or more processors are stored, wherein the one or more processors are configured to perform the above-mentioned method when executing the multiple programs.
[0195] In an embodiment, a computer program product having instructions for storing or transmitting a bitstream is also provided, wherein the bitstream includes the encoded video information generated by the above encoding method or the encoded video information to be decoded by the above decoding method. In an embodiment, a computer program product including, for example, a plurality of programs in a memory 1230 is also provided, wherein the plurality of programs can be executed by a processor 1220 in a computing environment 1210 for performing the above method. For example, the computer program product may include a non-transitory computer-readable storage medium.
[0196] In an embodiment, a method for storing a bit stream is also provided, comprising: storing the bit stream on a digital storage medium, wherein the bit stream comprises encoded video information generated by the above encoding method or encoded video information to be decoded by the above decoding method.
[0197] In an embodiment, a method for transmitting a bit stream generated by the above encoder is also provided. In an embodiment, a method for receiving a bit stream to be decoded by the above decoder is also provided.
[0198] The description of the present disclosure has been presented for purposes of illustration and is not intended to be exhaustive or limited to the present disclosure. Many modifications, variations, and alternative embodiments will be apparent to one of ordinary skill in the art having the benefit of the teachings presented in the foregoing description and the associated drawings.
[0199] Unless otherwise specifically stated, the order of steps of the method according to the present disclosure is intended to be illustrative only, and the steps of the method according to the present disclosure are not limited to the order specifically described above, but can be changed according to actual conditions. In addition, at least one of the steps of the method according to the present disclosure can be adjusted, combined or deleted according to actual needs.
[0200] The examples are chosen and described in order to explain the principles of the present disclosure and to enable other persons skilled in the art to understand the various embodiments of the present disclosure and to best utilize the basic principles and various embodiments with various modifications suitable for the specific use contemplated. Therefore, it will be understood that the scope of the present disclosure is not limited to the specific examples of the disclosed embodiments, and modifications and other embodiments are intended to be included within the scope of the present disclosure.
[0201] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0202] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A video encoding method, characterized in that: The video encoding method comprises: Determine an intra-frame complexity of a first video frame in a video to be encoded and an inter-frame complexity of the first video frame relative to a second video frame, wherein the second video frame precedes the first video frame; Determining whether the first video frame is a transition frame according to the inter-frame complexity and the intra-frame complexity of the first video frame; In response to the first video frame being a transition frame, based on an original encoding bit rate of the video to be encoded, obtaining an encoding bit rate of the transition frame by increasing the original encoding bit rate; The transition frame is encoded based on the encoding bit rate of the transition frame.
2. The video encoding method according to claim 1, characterized in that: The determining, according to the inter-frame complexity and the intra-frame complexity of the first video frame, whether the first video frame is a transition frame includes: In response to a complexity difference between the inter-frame complexity and the intra-frame complexity of the first video frame exceeding a difference threshold, the first video frame is determined to be a transition frame.
3. The video encoding method according to claim 2, characterized in that: The video encoding method further comprises: updating the difference threshold; Based on the updated difference threshold, determining whether a third video frame after the first video frame is a transition frame, Wherein, updating the difference threshold comprises: in response to the number of transition frames determined in the video frame sequence of the preset window size being greater than the first preset number of transition frames, increasing the difference threshold; In response to the number of transition frames determined within the video frame sequence of the preset window size being less than a second preset number of transition frames, reducing the difference threshold, Wherein, the second preset transition frame number is less than or equal to the first preset transition frame number.
4. The video encoding method according to claim 1, characterized in that: In response to the first video frame being a transition frame, the video encoding method further includes: In response to a statistical value of the inter-frame complexity of video frames within a first preset number of frames starting from the first video frame being greater than a preset complexity, obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed; In response to the statistical value being less than or equal to the preset complexity, the first video frame is encoded based on the original encoding bit rate.
5. The video encoding method according to claim 1, characterized in that: The video encoding method further comprises: Based on the original encoding bit rate of the video to be encoded, the encoding bit rates of a plurality of related video frames after the transition frame are obtained by increasing the original encoding bit rate, The encoding bit rate of the transition frame and a previous video frame in any adjacent video frames among the multiple related video frames is greater than or equal to the encoding bit rate of the subsequent video frame in the adjacent video frames.
6. The video encoding method according to claim 5, characterized in that: The encoding bit rates of the transition frame and the multiple related video frames are gradually reduced from the encoding bit rate of the transition frame to the original encoding bit rate at a preset attenuation step.
7. The video encoding method according to any one of claims 1 to 6, characterized in that: The video encoding method further comprises: In response to the number of transition frames determined within a second preset number of frames starting from the transition frame being greater than or equal to a preset number, encoding the transition frame based on the original encoding bit rate; In response to the number of transition frames determined within the second preset number of frames starting from the transition frame being less than the preset number, the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed for the transition frame.
8. The video encoding method according to any one of claims 1 to 6, characterized in that: The video encoding method further comprises: In response to the number of frames between the transition frame and the target transition frame being greater than a preset minimum frame number interval, for the transition frame, performing a step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate, wherein the target transition frame is a transition frame with an increased encoding bit rate that is closest to the transition frame before the transition frame; In response to the number of frames between the transition frame and the target transition frame being less than or equal to the preset minimum frame number interval, the transition frame is encoded based on the original encoding bit rate, or the encoding bit rate of the transition frame is determined based on the number of frames between the transition frame and the target transition frame, and the transition frame is encoded.
9. The video encoding method according to claim 8, characterized in that: The video encoding method further comprises: In response to the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate being performed within a first preset video frame range for a number of times greater than a first preset number, encoding the transition frame within a second preset video frame range after the first preset video frame range based on the original encoding bit rate, wherein the first preset video frame range is greater than the preset minimum frame number interval; and / or, In response to the number of times the step of obtaining the encoding bit rate of the transition frame by increasing the original encoding bit rate is performed within a time window of preset length has reached a second preset number, based on the original encoding bit rate, subsequent transition frames within the current time window are encoded until the next time window is reached.
10. A video encoding device, characterized in that: The video encoding device comprises: a complexity determination unit, configured to determine an intra-frame complexity of a first video frame in the video to be encoded and an inter-frame complexity of the first video frame relative to a second video frame, wherein the second video frame is before the first video frame; a transition frame determining unit, configured to determine whether the first video frame is a transition frame according to the inter-frame complexity and the intra-frame complexity of the first video frame; an improving unit, configured to obtain the encoding bit rate of the transition frame by improving the original encoding bit rate based on the original encoding bit rate of the video to be encoded in response to the first video frame being a transition frame; The encoding unit is configured to encode the transition frame based on the encoding bit rate of the transition frame.
11. An electronic device, characterized in that: The electronic device comprises: Processor; and a memory for storing processor executable instructions, When the processor executable instructions are executed by the processor, the processor executes the video encoding method according to any one of claims 1 to 9.
12. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform the video encoding method according to any one of claims 1 to 9.
13. A computer program product comprising computer instructions, characterized in that: When the computer instructions are executed by a processor, the video encoding method according to any one of claims 1 to 9 is implemented.
14. A method for generating a bit stream, characterized in that: include: A bit stream is generated according to the video encoding method according to any one of claims 1 to 9.
15. A computer program product having instructions for storing a bit stream, characterized in that The bit stream includes: video data generated according to the video encoding method according to any one of claims 1 to 9.