Video coding method, apparatus and device, storage medium, and program product
By using low-complexity encoding algorithms on still video frames and skipping part of the encoding process, the problem of low video encoding efficiency in the prior art is solved, and efficient and high-quality video encoding is achieved.
Patent Information
- Application Number
- PCT/CN2024/106015
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-08-14
- Filing Date
- 2024-07-17
- Publication Date
- 2025-02-20
AI Technical Summary
While ensuring the quality of video, existing video encoding technology has low encoding efficiency, resulting in waste of resources and poor user experience.
When the video frame is relatively stationary, a low-complexity encoding algorithm is used, and partial encoding processes are skipped, such as pixel search and pixel reference information generation, and video frame encoding is instead based on the gradually increasing quantization parameter values. .
It significantly improves video encoding efficiency, while ensuring video encoding quality, reducing resource consumption and delay.
Smart Images

Figure CN2024106015_20022025_PF_FP_ABST
Abstract
Description
Video encoding method, device, equipment, storage medium and program product
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on August 14, 2023, with application number 202311020356.7, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The embodiments of the present application relate to the field of video processing technology, and in particular to a video encoding method, apparatus, device, storage medium, and program product. Background Art
[0003] During video processing, video frames are encoded using an encoder to compress the video stream. For video streams, encoder performance and video bitrate are important factors affecting video lag and user viewing experience.
[0004] Because video images are highly correlated, they contain a large amount of redundant information. This redundant information can be divided into spatial redundant information and temporal redundant information. When using an encoder to encode a video stream, the encoder can reasonably remove redundant information to compress the video stream data volume. In related technologies, when encoding videos using encoders, in order to ensure video quality, complex algorithms and relatively time-consuming processes are usually used for encoding. This results in reduced encoding efficiency and needs to be improved.
[0005] Summary of the Invention
[0006] The embodiments of the present application provide a video encoding method, apparatus, device, storage medium and program product. When the video frame is relatively static, a low-complexity encoding algorithm is adopted and part of the encoding process is skipped, thereby significantly improving the encoding efficiency while ensuring the video encoding quality.
[0007] In a first aspect, an embodiment of the present application provides a video encoding method, the method comprising:
[0008] Obtaining a video frame sequence to be encoded, and determining motion types of video frames in the video frame sequence;
[0009] When the motion type of the video frame is a still type, performing pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm, where the complexity of the first preset algorithm is lower than the complexity of a standard encoding algorithm;
[0010] For the video frames after the preset time length, sub-pixel search and generation of sub-pixel reference information are skipped, and video frame encoding is performed based on gradually increasing minimum quantization parameter values.
[0011] In a second aspect, an embodiment of the present application further provides a video encoding device, including:
[0012] A video encoding device, characterized by comprising:
[0013] a type determination module configured to obtain a video frame sequence to be encoded and determine a motion type of a video frame in the video frame sequence;
[0014] a pixel search module configured to, when the motion type of the video frame is a still type, perform a pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm;
[0015] An encoding configuration module configured to skip sub-pixel search and generation of sub-pixel reference information for video frames after the preset time length;
[0016] The encoding processing module is configured to encode video frames based on gradually increasing minimum quantization parameter values.
[0017] In a third aspect, an embodiment of the present application further provides a video encoding device, the device comprising:
[0018] one or more processors;
[0019] a storage device for storing one or more programs,
[0020] When the one or more programs are executed by the one or more processors, the one or more processors implement the video encoding method described in the embodiment of the present application.
[0021] In a fourth aspect, an embodiment of the present application further provides a non-volatile storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the video encoding method described in the embodiment of the present application when executed by a computer processor.
[0022] In a fifth aspect, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device executes the video encoding method described in the embodiment of the present application.
[0023] In an embodiment of the present application, a sequence of video frames to be encoded is obtained, the motion type of the video frames in the sequence is determined, and if the motion type satisfies the static encoding condition, a pixel-by-pixel search is performed on the video frames of a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. For video frames after the preset duration, the pixel-by-pixel search and the generation of pixel-by-pixel reference information are skipped, and the video frames are encoded based on gradually increasing quantization parameter values. This solution uses a low-complexity encoding algorithm when the video frames are relatively static, while skipping part of the encoding process. This significantly improves encoding efficiency while ensuring video encoding quality. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] FIG1 is a flowchart of a video encoding method provided by an embodiment of the present application;
[0025] FIG2 is a flowchart of another video encoding method provided by an embodiment of the present application;
[0026] FIG3 is a flowchart of a method for determining the motion type of a P frame image provided by an embodiment of the present application;
[0027] FIG4 is a flowchart of a method for determining the motion type of an I-frame image provided by an embodiment of the present application;
[0028] FIG5 is a flowchart of another video encoding method provided by an embodiment of the present application;
[0029] FIG6 is a structural block diagram of a video encoding device provided in an embodiment of the present application;
[0030] FIG7 is a schematic structural diagram of a video encoding device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0031] The following is a further detailed description of the embodiments of the present application in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the embodiments of the present application, and are not intended to limit the embodiments of the present application. It should also be noted that, for ease of description, the accompanying drawings only illustrate portions of the embodiments of the present application, rather than all structures.
[0032] The terms "first," "second," and the like in the specification and claims of this application are used to distinguish similar objects, and are not used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this application can be implemented in an order other than that illustrated or described herein, and that the objects distinguished by "first," "second," and the like are generally of the same type, and do not limit the number of objects; for example, the first object can be one or more. In addition, the term "and / or" in the specification and claims refers to at least one of the connected objects, and the character " / " generally indicates that the objects connected are in an "or" relationship.
[0033] The video encoding method provided in the embodiments of the present application can be executed by a computing device such as a server, a smart phone, a tablet computer, a laptop computer, etc. It can be applied to scenarios where video stream encoding is required, such as video encoding processing of live video streams and video encoding processing of recorded videos.
[0034] FIG1 is a flow chart of a video encoding method provided in an embodiment of the present application, as shown in FIG1 , which specifically includes the following steps:
[0035] Step S101: Acquire a video frame sequence to be encoded, and determine the motion type of the video frames in the video frame sequence.
[0036] The video frame sequence is a sequence of multiple continuous video frames. When performing video encoding, the video frame sequence is obtained, and a corresponding video encoding method is determined based on the subsequent motion of the video frames in the video frame sequence.
[0037] The motion type of a video frame represents the relative motion of the video frame. Optionally, it can be divided into a still type, a slow motion type, and a fast motion type. The still type represents the relative stillness of the video frame, the slow motion type represents the relative slow motion of the video frame, and the fast motion type represents the relative fast motion of the video frame.
[0038] Step S102: When the motion type of the video frame is a still type, perform pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm.
[0039] In one embodiment, when determining the motion type of video frames in a video sequence, if the motion type of the video frames in the video sequence is a still type, a pixel-by-pixel search is performed on the video frames within a preset duration based on a first preset algorithm. Optionally, the motion type of the video frames in the video sequence being a still type may be that multiple consecutive video frames within the preset duration in the video sequence are still types. If a video frame in the video sequence is determined to be a still type as a starting point, all video frames within 2 consecutive seconds are still types.
[0040] Among them, the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. Optionally, the first preset algorithm for performing pixel-by-pixel search of video frames can be a bilinear interpolation algorithm, and the standard encoding algorithm can be a 6-tap interpolation algorithm. In the process of video encoding processing, the video sampled by various methods does not contain pixel-by-pixels itself, and the pixel-by-pixels must be obtained by certain interpolation calculations of whole pixels. Therefore, between whole-pixel motion estimation and pixel-by-pixel motion estimation, pixel-by-pixel interpolation calculations need to be performed within the search range of the reference frame image. In this calculation process, the first preset algorithm is used to perform calculation processing on the static type video frames of the continuous preset time length in the aforementioned video frame sequence.
[0041] Step S103 : for the video frames after the preset time length, skip the sub-pixel search and the generation of sub-pixel reference information, and perform video frame encoding based on gradually increasing minimum quantization parameter values.
[0042] In one embodiment, when it is determined that the motion type of a video frame is a still type, the sub-pixel search and the generation of sub-pixel reference information are skipped for video frames after a preset duration. The sub-pixel reference information is information that needs to be calculated during the video encoding process and is used as a reference for the current frame when encoding other video frames. At this time, when the still type is satisfied, the sub-pixel search and the generation of sub-pixel reference information are skipped for video frames after the preset duration to optimize video encoding. For example, for a video frame sequence containing 45 frames, when it is determined that the corresponding video frames for a continuous preset duration are a still type (e.g., the 0th to 40th frame images), the first preset algorithm is used to perform a sub-pixel search for the 0th to 40th frame images. For still type video frames after the preset duration, such as the 41st, 42nd, and 43rd frame images, the sub-pixel search and the generation of sub-pixel reference information are skipped, and video frame encoding is performed based on gradually increasing minimum quantization parameter values.
[0043] The quantization parameter is a parameter that reflects the compression of spatial detail during video encoding. A smaller quantization parameter value indicates finer quantization, higher image quality, and a longer bitstream. A small quantization parameter value preserves most details in the video image. However, increasing the quantization parameter value can result in loss of some details, a lower bitrate, and increased image distortion and quality. For example, according to the encoder's default settings, a minimum quantization parameter value of 0 indicates the finest quantization; conversely, a maximum quantization parameter value of 51 indicates the coarsest quantization. In one embodiment, for still video frames after a preset duration, video frame encoding is performed based on gradually increasing minimum quantization parameter values, while skipping sub-pixel search and generation of sub-pixel reference information. Optionally, the minimum quantization parameter value can be increased by a predetermined value for each frame after encoding, and then encoding is performed on the corresponding frame. For example, the predetermined value can be 1. In one embodiment, an upper limit for the minimum quantization parameter value can be set, and the minimum quantization parameter value can no longer be increased after reaching the upper limit.
[0044] In one embodiment, for a video frame in a video frame sequence to be encoded, if it is determined that the motion type of the video frame in the video frame sequence is a fast motion type, the minimum quantization parameter value of the original size is restored, and video encoding of the video frame is performed based on this.
[0045] As can be seen from the above, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, and when the motion type meets the static encoding condition, a pixel-by-pixel search is performed on the video frames within a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. For video frames after the preset duration, the pixel-by-pixel search and the generation of pixel-by-pixel reference information are skipped, and the video frames are encoded based on gradually increasing quantization parameter values. This solution uses a low-complexity encoding algorithm when the video frames are relatively static, while skipping part of the encoding process. This significantly improves encoding efficiency while ensuring video encoding quality.
[0046] Based on the above technical solution, the method further includes: selecting a skip mode frame for the video frames after the preset duration; and using a preset skip mode to perform video encoding of the skip mode frame. That is, for the still type video frames in the video sequence, for the still type video frames after the preset duration, while skipping the sub-pixel search and the generation of sub-pixel reference information, the pre-set skip mode is used to perform video encoding of the skip mode frame for the selected skip mode frame. The skip mode frame can be selected by randomly selecting from the still type video frames or selecting odd or even frames therein as skip mode frames. The pre-set skip mode can be a skip mode set by the encoder itself during the design process, and the skip mode is defined in the video coding standard. Exemplarily, the pre-set skip mode can be the Skip mode defined in the HEVC coding standard. By using the skip mode, a large amount of coding time can be saved, and a large amount of bit rate can also be saved, further improving the efficiency of video coding.
[0047] FIG2 is a flow chart of another video encoding method provided by an embodiment of the present application. As shown in FIG2 , a method for determining a video frame type is provided, which includes:
[0048] Step S201: Obtain a sequence of video frames to be encoded, and determine the motion type of the video frames based on the row encoding costs and column encoding costs of the encoding blocks in the video frames.
[0049] In one embodiment, when determining the motion type of a video frame, the motion type of the video frame is determined based on the row coding cost and column coding cost of the coding block in the video frame. A coding block is an independent coding unit used to divide a video frame image during the video encoding process. A video frame image can be divided into multiple rows and columns of coding blocks. The motion type is determined by obtaining the row coding cost and column coding cost of the coding block in the video frame. Optionally, the row coding cost and column coding cost of the coding block are calculated and stored accordingly during the preprocessing process of the video encoding, and can be directly obtained here.
[0050] In one embodiment, different methods are used to determine the motion type of different types of video frames. Optionally, as shown in FIG3 , FIG3 is a flow chart of a method for determining the motion type of a P-frame image provided by an embodiment of the present application, specifically including:
[0051] Step S2011: When the video frame is a P-frame image, obtain the row coding cost of each row of the P-frame image and the column coding cost of the middle column.
[0052] Step S2012: Compare the row coding cost and column coding cost of each row with the first cost threshold set correspondingly, and determine whether the P-frame image is a stationary type according to the comparison result.
[0053] In one embodiment, for a P-frame image, obtain the row coding cost of each row of the P-frame image and the column coding cost of the middle column. When there are two columns in the middle column, one of them can be randomly selected or selected according to the set selection method as the middle column.
[0054] Exemplarily, as shown in the following table:
[0055] Among them, the P-frame image is divided into m rows and n columns, and its coding blocks are marked exemplarily as shown in the above table. The coding cost of the coding block in the first row and the first column is denoted as inter-00, the coding cost of the first row and the second column is denoted as inter-01, the coding cost of the second row and the first column is denoted as inter-10, and so on.
[0056] Among them, when calculating the row coding cost, calculate the sum of the coding costs of each coding block in the row as the row coding cost of the row (exemplarily denoted as intercost-rx, where x ranges from 0 to m), and the coding cost of the middle column is the sum of the corresponding coding blocks in the middle column as the column coding cost (exemplarily denoted as intercost-c).
[0057] Optionally, when determining the motion type of a video frame, it includes determining whether it is a stationary type or a slow motion type. If it is neither a stationary type nor a slow motion type, determine it as a fast motion type. When determining whether it is a stationary type, compare the row coding cost and column coding cost of each row with the first cost threshold set correspondingly, and determine whether the P-frame image is a stationary type according to the comparison result. Among them, the first cost threshold can be a fixed value or a value calculated based on different numbers of rows and columns. Optionally, for the row coding cost, the comparison threshold can be denoted as n*TH1_STILL, and for the column coding cost, the comparison threshold can be denoted as m*TH1_STILL. Optionally, the judgment method can be that if intercost-rx < n*TH1_STILL and intercost-c < m*TH1_STILL, then determine that the P-frame image is a stationary type. Through this method of determining the motion type of a video frame based on coding cost, the motion type of a video frame can be determined quickly without a complex calculation and comparison process, and the determination speed of the motion type can be significantly improved.
[0058] Optionally, when the video frame is an I-frame image, a method for determining its motion type is shown in FIG4 . FIG4 is a flowchart of a method for determining the motion type of an I-frame image provided in an embodiment of the present application, including:
[0059] Step S2013: When the video frame is an I-frame image, obtain the row coding cost of each row of the I-frame image and the column coding cost of the middle column.
[0060] Step S2014: Obtain the row coding cost of each row of the previous frame image of the I frame image, and the column coding cost of the middle column.
[0061] Step S2015: Determine whether the I frame image is a static type based on the row coding cost and column coding cost of each row of the I frame image and the row coding cost and column coding cost of each row of the previous frame image.
[0062] In one embodiment, when the video frame is an I-frame image and the previous frame is a P-frame image and is of a still type, when obtaining the row coding cost of each row of the I-frame image and the column coding cost of the middle column, the row coding cost of each row of the previous frame image of the I-frame image and the column coding cost of the middle column are correspondingly obtained. By comparing the row coding cost and column coding cost of each row of the I-frame image with the row coding cost and column coding cost of each row of the previous frame image, it is determined whether the I-frame image is of a still type.
[0063] Optionally, a method for determining whether an I-frame image is of a still type may be to determine whether the absolute value of the difference between the coding cost of each row of the I-frame image and the coding cost of the corresponding row of the previous frame image is less than a first absolute threshold, and whether the absolute value of the difference between the coding cost of the column of the I-frame image and the coding cost of the column of the previous frame image is less than a second absolute threshold. For example, the first absolute threshold may be recorded as n*TH2_STILL, and the second absolute threshold may be recorded as m*TH2_STILL. When the absolute value of the difference between the coding cost of each row of the I-frame image and the coding cost of the corresponding row of the previous frame image is less than the first absolute threshold, and the absolute value of the difference between the coding cost of the column of the I-frame image and the coding cost of the column of the previous frame image is less than the second absolute threshold, the I-frame image is determined to be of a still type.
[0064] Optionally, when determining whether a video frame is of a slow motion type, the following method may be used: if the row coding cost of any row in the video frame is greater than the second cost threshold and less than the third cost threshold, and the coding costs of all other rows are less than the first cost threshold, the video frame is determined to be of a slow motion type. That is, if the row coding cost of one or more rows is greater than the second cost threshold and less than the third cost threshold, the video frame is determined to be of a slow motion type. The second cost threshold is greater than or equal to the first cost threshold, and the third cost threshold is greater than the second cost threshold. Optionally, if the row coding cost of a row is greater than the third cost threshold, the video frame is determined to be of a fast motion type.
[0065] Step S202: When the motion type of the video frame is a still type, perform pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm.
[0066] Step S203 : for the video frames after the preset time length, skip the sub-pixel search and the generation of sub-pixel reference information, and perform video frame encoding based on gradually increasing minimum quantization parameter values.
[0067] As can be seen from the above, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, and when the motion type meets the static encoding condition, a pixel-by-pixel search is performed on the video frames within a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. For video frames after the preset duration, the pixel-by-pixel search and the generation of pixel-by-pixel reference information are skipped, and the video frames are encoded based on gradually increasing quantization parameter values. This solution uses a low-complexity encoding algorithm when the video frames are relatively static, while skipping part of the encoding process. This significantly improves encoding efficiency while ensuring video encoding quality.
[0068] FIG5 is a flowchart of another video encoding method provided in an embodiment of the present application, as shown in FIG5 , including:
[0069] Step S301: Acquire a video frame sequence to be encoded, and determine the motion type of the video frames in the video frame sequence.
[0070] Step S302: When the motion type of the video frame is a still type, perform pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm.
[0071] Step S303: for the video frames after the preset time length, skip the sub-pixel search and the generation of sub-pixel reference information, and perform video frame encoding based on the gradually increasing minimum quantization parameter value.
[0072] Step S304: When the motion type of the video frame is a slow motion frame type, perform pixel-by-pixel search on the slow motion frame type video frame based on a first preset algorithm.
[0073] Step S305: determining an algorithm to be used for the next slow motion frame type video frame based on the set feedback framework, and performing pixel-by-pixel search based on the determined algorithm.
[0074] In one embodiment, for video frames of the slow motion frame type, a pixel-by-pixel search is performed on the video frames of the slow motion frame type based on a first preset algorithm, and at the same time, the algorithm adopted by the next video frame of the slow motion frame type is determined by using a set feedback framework, such as whether to adopt the first preset algorithm or the standard encoding algorithm, and a pixel-by-pixel search is performed based on the determined algorithm.
[0075] Optionally, the process of determining the algorithm to be used for the next slow motion frame type video frame based on the set feedback framework may be: obtaining the actual encoding cost of the recorded current slow motion frame type video frame, and when the actual encoding cost is greater than a preset cost threshold, determining that the next slow motion frame type video frame uses a standard encoding algorithm. That is, the encoding quality is measured by comparing the actual encoding cost with the preset cost threshold. If the actual encoding cost is greater than the set preset cost threshold, the next slow motion frame type video frame uses the standard encoding algorithm for pixel search, otherwise the first preset algorithm continues to be used for pixel search. The preset cost threshold can be adaptively set according to actual needs. By setting the feedback framework to compare the actual encoding cost with the preset cost threshold, adaptive algorithm switching can be achieved, and a suitable algorithm can be selected for pixel search according to different actual encoding situations to ensure encoding quality while improving encoding efficiency.
[0076] Optionally, for fast motion video frames, video encoding is performed using the original settings of the encoder, such as using a standard encoding algorithm and a default minimum quantization parameter value to perform video encoding.
[0077] As can be seen from the above, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, and when the motion type meets the static encoding condition, a pixel-by-pixel search is performed on the video frames within a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. For video frames after the preset duration, the pixel-by-pixel search and the generation of pixel-by-pixel reference information are skipped, and the video frames are encoded based on gradually increasing quantization parameter values. This solution uses a low-complexity encoding algorithm when the video frames are relatively static, while skipping part of the encoding process. This significantly improves encoding efficiency while ensuring video encoding quality.
[0078] FIG6 is a block diagram of a video encoding device provided by an embodiment of the present application. As shown in FIG6 , the device is used to execute the video encoding method provided by the above embodiment, and has the corresponding functional modules and beneficial effects of the execution method. As shown in FIG6 , the device specifically includes: a type determination module 101, a pixel search module 102, a coding configuration module 103, and a coding processing module 104, wherein:
[0079] The type determination module 101 is configured to obtain a video frame sequence to be encoded and determine the motion type of the video frames in the video frame sequence;
[0080] a pixel search module 102 configured to, when the motion type of the video frame is a still type, perform a pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm;
[0081] The encoding configuration module 103 is configured to skip sub-pixel search and generation of sub-pixel reference information for video frames after the preset time length;
[0082] The encoding processing module 104 is configured to encode the video frames based on gradually increasing minimum quantization parameter values.
[0083] As can be seen from the above, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, and when the motion type meets the static encoding condition, a pixel-by-pixel search is performed on the video frames within a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm. For video frames after the preset duration, the pixel-by-pixel search and the generation of pixel-by-pixel reference information are skipped, and the video frames are encoded based on gradually increasing quantization parameter values. This solution uses a low-complexity encoding algorithm when the video frames are relatively static, while skipping part of the encoding process. This significantly improves encoding efficiency while ensuring video encoding quality.
[0084] In a possible embodiment, the type determination module 101 is specifically configured as follows:
[0085] The motion type of the video frame is determined based on row coding costs and column coding costs of coding blocks in the video frame.
[0086] In a possible embodiment, the type determination module 101 is specifically configured as follows:
[0087] In the case where the video frame is a P-frame image, obtaining a row coding cost of each row of the P-frame image and a column coding cost of a middle column;
[0088] The row coding costs and the column coding costs of the rows are compared with the corresponding first cost thresholds, and whether the P frame image is of a still type is determined according to the comparison result.
[0089] In a possible embodiment, the type determination module 101 is specifically configured as follows:
[0090] In the case where the video frame is an I-frame image, obtaining a row coding cost of each row of the I-frame image and a column coding cost of a middle column;
[0091] Obtaining the row coding cost of each row of the previous frame image of the I frame image, and the column coding cost of the middle column;
[0092] Whether the I frame image is of a still type is determined based on the row coding cost and the column coding cost of each row of the I frame image and the row coding cost and the column coding cost of each row of the previous frame image.
[0093] In a possible embodiment, the type determination module 101 is specifically configured as follows:
[0094] If the row coding cost of any row in the video frame is greater than the second cost threshold and less than the third cost threshold, and the coding costs of other rows are all less than the first cost threshold, the video frame is determined to be a slow motion type.
[0095] In a possible embodiment, the pixel search module 102 is further configured to:
[0096] When the motion type of the video frame is a slow motion frame type, performing pixel-by-pixel search on the video frame of the slow motion frame type based on the first preset algorithm;
[0097] An algorithm to be used for the next slow motion frame type video frame is determined based on the set feedback framework, and pixel-by-pixel search is performed based on the determined algorithm.
[0098] In a possible embodiment, the pixel search module 102 is further configured to:
[0099] Get the actual encoding cost of the recorded video frame of the current slow motion frame type;
[0100] When the actual encoding cost is greater than the preset cost threshold, it is determined that the next slow motion frame type video frame uses a standard encoding algorithm.
[0101] In a possible embodiment, the encoding processing module 104 is configured to:
[0102] For the video frames after the preset time length, when encoding each frame, the minimum quantization parameter value is sequentially increased by the preset size value, and then video encoding of the corresponding video frame is performed.
[0103] In a possible embodiment, the encoding processing module 104 is further configured to:
[0104] After the minimum quantization parameter value is increased by the preset size value in sequence and video encoding of the corresponding video frame is performed, when it is determined that the motion type of the video frame in the video frame sequence is a fast motion type, the minimum quantization parameter value of the original size is restored for video encoding of the video frame.
[0105] In a possible embodiment, the encoding configuration module 103 is further configured to:
[0106] For the video frames after the preset time length, selecting a skip mode frame;
[0107] The encoding processing module 104 is configured to:
[0108] A preset skip mode is used to perform video encoding of the skip mode frame.
[0109] Figure 7 is a schematic diagram of the structure of a video encoding device provided in an embodiment of the present application. As shown in Figure 7, the device includes a processor 201, a memory 202, an input device 203, and an output device 204. The device may include one or more processors 201, with Figure 7 citing a single processor 201 as an example. The processor 201, memory 202, input device 203, and output device 204 in the device may be connected via a bus or other means, with Figure 7 citing a bus connection as an example. Memory 202, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the video encoding method in the embodiment of the present application. Processor 201 executes the software programs, instructions, and modules stored in memory 202 to execute various functional applications and data processing of the device, thereby implementing the aforementioned video encoding method. Input device 203 can be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. Output device 204 may include a display device such as a display screen.
[0110] An embodiment of the present application further provides a non-volatile storage medium containing computer-executable instructions. When the computer-executable instructions are executed by a computer processor, the computer-executable instructions are used to perform a video encoding method described in the above embodiment, which includes:
[0111] Obtaining a video frame sequence to be encoded, and determining motion types of video frames in the video frame sequence;
[0112] When the motion type of the video frame is a still type, performing pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm, where the complexity of the first preset algorithm is lower than the complexity of a standard encoding algorithm;
[0113] For the video frames after the preset time length, sub-pixel search and generation of sub-pixel reference information are skipped, and video frame encoding is performed based on gradually increasing minimum quantization parameter values.
[0114] It is worth noting that in the embodiment of the above-mentioned video encoding device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present application.
[0115] In some possible implementations, various aspects of the methods provided herein may also be implemented in the form of a program product, which includes program code. When the program product is executed on a computer device, the program code is used to cause the computer device to perform the steps of the methods according to the various exemplary embodiments of the present application described above in this specification. For example, the computer device may perform the video encoding method described in the embodiments of the present application. The program product may be implemented using any combination of one or more readable media.
Claims
1. A video encoding method, wherein: include: Acquire a video frame sequence to be encoded, and determine motion types of video frames in the video frame sequence; When the motion type of the video frame is a static type, performing pixel-by-pixel search on the video frame of a preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm; For the video frames after the preset time length, the sub-pixel search and the generation of sub-pixel reference information are skipped, and the video frame encoding is performed based on the gradually increasing minimum quantization parameter value.
2. The video encoding method according to claim 1, wherein: The determining the motion type of the video frame in the video frame sequence comprises: The motion type of the video frame is determined based on row coding costs and column coding costs of coding blocks in the video frame.
3. The video encoding method according to claim 2, wherein: The determining the motion type of the video frame based on the row coding cost and the column coding cost of the coding block in the video frame includes: When the video frame is a P frame image, obtaining a row coding cost of each row of the P frame image and a column coding cost of a middle column; The row coding costs of the rows and the column coding costs are compared with the corresponding first cost thresholds, and whether the P frame image is a static type is determined according to the comparison result.
4. The video encoding method according to claim 2, wherein: The determining the motion type of the video frame based on the row coding cost and the column coding cost of the coding block in the video frame includes: When the video frame is an I-frame image, obtaining a row coding cost of each row of the I-frame image and a column coding cost of a middle column; Obtaining the row coding cost of each row of the previous frame image of the I frame image, and the column coding cost of the middle column; Whether the I frame image is of a still type is determined based on the row coding cost and the column coding cost of each row of the I frame image and the row coding cost and the column coding cost of each row of the previous frame image.
5. The video encoding method according to claim 2-4, wherein: The determining the motion type of the video frame based on the row coding cost and the column coding cost of the coding block in the video frame includes: In the case where the row coding cost of any row in the video frame is greater than the second cost threshold and less than the third cost threshold, and the coding costs of other rows are all less than the first cost threshold, the video frame is determined to be It is a slow motion type.
6. The video encoding method according to claims 2-5, wherein: The method further comprises: When the motion type of the video frame is a slow motion frame type, performing pixel-by-pixel search on the video frame of the slow motion frame type based on the first preset algorithm; The algorithm used for the next slow motion frame type video frame is determined based on the set feedback framework, and pixel-by-pixel search is performed based on the determined algorithm.
7. The video encoding method according to claim 6, wherein: The algorithm used to determine the next slow motion frame type video frame based on the set feedback framework includes: Get the actual encoding cost of the recorded video frame of the current slow motion frame type; When the actual encoding cost is greater than the preset cost threshold, it is determined that the next slow motion frame type video frame uses a standard encoding algorithm.
8. The video encoding method according to claim 1, wherein: The encoding of the video frames based on the gradually increasing minimum quantization parameter value comprises: For the video frames after the preset time length, when encoding each frame, the minimum quantization parameter value is increased by the preset size value in sequence, and then the video encoding of the corresponding video frame is performed.
9. The video encoding method according to claim 8, wherein: After the minimum quantization parameter value is increased by a preset value in sequence, and video encoding of the corresponding video frame is performed, the method further includes: When it is determined that the motion type of the video frame in the video frame sequence is a fast motion type, the minimum quantization parameter value of the original size is restored for video encoding of the video frame.
10. The video encoding method according to any one of claims 1 to 9, wherein: The method further comprises: For the video frames after the preset time length, selecting a skip mode frame; The video encoding of the skip mode frame is performed using a preset skip mode.
11. A video encoding device, wherein: include: A type determination module, configured to obtain a video frame sequence to be encoded, and determine a motion type of a video frame in the video frame sequence; a pixel search module, configured to perform pixel-by-pixel search on video frames of a preset duration based on a first preset algorithm when the motion type of the video frame is a static type, wherein the complexity of the first preset algorithm is lower than the complexity of the standard encoding algorithm; An encoding configuration module, configured to skip sub-pixel search and generation of sub-pixel reference information for video frames after the preset time length; The encoding processing module is configured to encode the video frame based on the gradually increasing minimum quantization parameter value.
12. A video encoding device, the device comprising: one or more processors; A storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the video encoding method according to any one of claims 1-10.
13. A non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are used to perform the video encoding method according to any one of claims 1 to 10 when executed by a computer processor.
14. A computer program product comprising a computer program, wherein: When the computer program is executed by a processor, the video encoding method according to any one of claims 1 to 10 is implemented.
Citation Information
Patent Citations
Video image processing method and device and computer readable storage medium
CN111479115A
Encoding method and device, electronic equipment and readable storage medium
CN112312134A
Image processing method and device, storage medium and electronic equipment
CN114466221A
Video coding method and device, equipment, storage medium and program product
CN116939216A
Adaptive complexity control for motion estimation during video encoding
US20070133690A1