CN116939216A - Video encoding method, apparatus, device, storage medium, and program product - Google Patents
Video encoding method, apparatus, device, storage medium, and program product Download PDFInfo
- Publication number
- CN116939216A CN116939216A CN202311020356.7A CN202311020356A CN116939216A CN 116939216 A CN116939216 A CN 116939216A CN 202311020356 A CN202311020356 A CN 202311020356A CN 116939216 A CN116939216 A CN 116939216A
- Authority
- CN
- China
- Prior art keywords
- video
- coding
- video frame
- frame
- type
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 65
- 238000004422 calculation algorithm Methods 0.000 claims abstract description 80
- 238000013139 quantization Methods 0.000 claims abstract description 38
- 230000003068 static effect Effects 0.000 claims abstract description 31
- 238000004590 computer program Methods 0.000 claims description 8
- 238000004364 calculation method Methods 0.000 description 4
- 238000010586 diagram Methods 0.000 description 4
- 230000006835 compression Effects 0.000 description 2
- 238000007906 compression Methods 0.000 description 2
- 230000006870 function Effects 0.000 description 2
- 230000003044 adaptive effect Effects 0.000 description 1
- 238000013459 approach Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000012938 design process Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000007781 pre-processing Methods 0.000 description 1
- 238000005728 strengthening Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/176—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/102—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
- H04N19/124—Quantisation
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/10—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
- H04N19/169—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
- H04N19/17—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
- H04N19/172—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a picture, frame or field
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04N—PICTORIAL COMMUNICATION, e.g. TELEVISION
- H04N19/00—Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
- H04N19/80—Details of filtering operations specially adapted for video compression, e.g. for pixel interpolation
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Signal Processing (AREA)
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The embodiment of the application provides a video coding method, a device, equipment, a storage medium and a program product, wherein the method comprises the following steps: acquiring a video frame sequence to be encoded, and determining the motion type of a video frame in the video frame sequence; under the condition that the motion type meets the static coding condition, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm; and skipping sub-pixel searching and sub-pixel reference information generation for the video frames after the preset duration, and carrying out video frame coding based on the gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
Description
Technical Field
Embodiments of the present application relate to the field of video processing technologies, and in particular, to a video encoding method, apparatus, device, storage medium, and program product.
Background
During video processing, video frames are encoded using an encoder to achieve compression of video stream volumes. For video streaming, the performance of the encoder and the video bitrate are important factors that affect whether the video is stuck or not and the user viewing experience.
Because of the extremely strong correlation of video images, there is a large amount of redundant information. Wherein, the redundant information can be divided into space domain redundant information and time domain redundant information. When the encoder is used for encoding the video stream, redundant information can be reasonably removed by the encoder to compress the data volume of the video stream. In the related art, when video encoding is performed by an encoder, in order to ensure video quality, a complex algorithm and a relatively time-consuming process are generally used for encoding, thereby resulting in a decrease in encoding efficiency, and improvement is required.
Disclosure of Invention
The embodiment of the application provides a video coding method, a device, equipment, a storage medium and a program product, wherein a coding algorithm with low complexity is adopted under the condition that video frames are relatively static, and meanwhile, part of coding flow is skipped, so that the coding efficiency is obviously improved under the condition of ensuring the video coding quality.
In a first aspect, an embodiment of the present application provides a video encoding method, including:
acquiring a video frame sequence to be encoded, and determining the motion type of a video frame in the video frame sequence;
under the condition that the motion type of the video frame is a static type, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm;
and skipping sub-pixel searching and sub-pixel reference information generation for the video frames after the preset duration, and carrying out video frame coding based on the gradually increased minimum quantization parameter values.
In a second aspect, an embodiment of the present application further provides a video encoding apparatus, including:
a video encoding apparatus, comprising:
the type determining module is configured to acquire a video frame sequence to be encoded and determine the motion type of a video frame in the video frame sequence;
the pixel searching module is configured to perform sub-pixel searching on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a static type, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm;
the coding configuration module is configured to skip sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration;
and the encoding processing module is configured to encode the video frames based on the gradually-increased minimum quantization parameter value.
In a third aspect, an embodiment of the present application further provides a video encoding apparatus, including:
one or more processors;
storage means for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the video encoding method described in the embodiments of the present application.
In a fourth aspect, embodiments of the present application also provide a non-volatile storage medium storing computer-executable instructions that, when executed by a computer processor, are configured to perform the video encoding method of embodiments of the present application.
In a fifth aspect, the embodiment of the present application further provides a computer program product, where the computer program product includes a computer program, where the computer program is stored in a computer readable storage medium, and where at least one processor of the device reads and executes the computer program from the computer readable storage medium, so that the device performs the video encoding method according to the embodiment of the present application.
In the embodiment of the application, a video frame sequence to be encoded is obtained, the motion type of a video frame in the video frame sequence is determined, under the condition that the motion type meets the static encoding condition, sub-pixel searching is carried out on the video frame under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm, the sub-pixel searching and the generation of sub-pixel reference information are skipped on the video frame after the preset duration, and video frame encoding is carried out based on the gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
Drawings
Fig. 1 is a flowchart of a video encoding method according to an embodiment of the present application;
fig. 2 is a flowchart of another video encoding method according to an embodiment of the present application;
FIG. 3 is a flowchart of a method for determining a motion type of a P frame image according to an embodiment of the present application;
FIG. 4 is a flowchart of a method for determining a motion type of an I-frame image according to an embodiment of the present application;
fig. 5 is a flowchart of another video encoding method according to an embodiment of the present application;
fig. 6 is a block diagram of a video encoding apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present application.
Detailed Description
Embodiments of the present application will be described in further detail below with reference to the drawings and examples. It should be understood that the particular embodiments described herein are illustrative only and are not limiting of embodiments of the application. It should be further noted that, for convenience of description, only some, but not all of the structures related to the embodiments of the present application are shown in the drawings.
The terms first, second and the like in the description and in the claims, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged, as appropriate, such that embodiments of the present application may be implemented in sequences other than those illustrated or described herein, and that the objects identified by "first," "second," etc. are generally of a type, and are not limited to the number of objects, such as the first object may be one or more. Furthermore, in the description and claims, "and/or" means at least one of the connected objects, and the character "/", generally means that the associated object is an "or" relationship.
The video coding method provided by the embodiment of the application can be executed by computing equipment such as a server, a smart phone, a tablet computer, a notebook computer and the like. The method can be applied to scenes needing to encode the video stream, such as video encoding processing of live video stream, video encoding processing of recorded video, and the like.
Fig. 1 is a flowchart of a video encoding method according to an embodiment of the present application, as shown in fig. 1, specifically including the following steps:
step S101, a video frame sequence to be encoded is obtained, and the motion type of a video frame in the video frame sequence is determined.
Wherein the sequence of video frames is a sequence of a plurality of consecutive video frames. And when video coding is carried out, acquiring the video frame sequence, and determining a corresponding video coding mode based on the motion condition of the video frames in the video frame sequence.
Wherein the motion type of the video frame characterizes the relative motion condition of the video frame. Alternatively, it may be classified into a stationary type, a slow motion type, and a fast motion type. Wherein the still type characterizes the video frame as relatively still, the slow motion type characterizes the video frame as relatively slow motion, and the fast motion type characterizes the video frame as relatively fast motion.
Step S102, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a static type.
In one embodiment, when determining a motion type of a video frame of a video sequence, if the motion type of the video frame in the video sequence is a still type, a sub-pixel search is performed on the video frame under a preset duration based on a first preset algorithm. Alternatively, the motion type of the video frames in the video sequence may be a still type, and the plurality of consecutive video frames in the video sequence for a predetermined duration may be still types. If a certain video frame is determined to be of a still type in the video sequence, the video frame in 2 seconds is started to be of the still type.
Wherein the first predetermined algorithm is less complex than the standard encoding algorithm. Alternatively, the first preset algorithm for performing the video frame sub-pixel search may be a bilinear interpolation algorithm, and the standard encoding algorithm may be a 6-tap interpolation algorithm. In the video coding process, the video sampled by various modes does not contain sub-pixels, and the sub-pixels can be obtained by a certain interpolation calculation of the whole pixels. Therefore, between the whole-pixel motion estimation and the sub-pixel motion estimation, interpolation calculation of sub-pixels is required in the search range of the reference frame image. In the calculation process, a first preset algorithm is adopted for calculating and processing the video frames of the static type under the continuous preset duration in the video frame sequence.
Step S103, skipping sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration, and carrying out video frame coding based on the gradually increased minimum quantization parameter value.
In one embodiment, in the case that the motion type of the video frame is determined to be a still type, the sub-pixel search and the generation of sub-pixel reference information are skipped for the video frame after the preset duration. The sub-pixel reference information is information which needs to be calculated in the video coding processing process and needs to be referred to when coding other video frames aiming at the current frame. At this time, under the condition of meeting the static type, the sub-pixel search is skipped for the video frame after the preset duration, and the generation of sub-pixel reference information is performed to optimize the video coding. For example, when a video frame sequence including 45 frames of images is determined that the corresponding video frames are of a still type (e.g., from the 0 th frame image to the 40 th frame image) under a continuous preset duration, the 0 th frame image to the 40 th frame image adopt a first preset algorithm to perform a sub-pixel search, and for the video frames of the still type after the preset duration, such as the 41 st frame image, the 42 th frame image and the 43 rd frame image, the sub-pixel search and the generation of sub-pixel reference information are skipped, and video frame coding is performed based on the gradually increased minimum quantization parameter values.
The quantization parameter is a parameter reflecting the compression condition of space details in the video coding process. The smaller the quantization parameter value, the finer the quantization, the higher the image quality, and the longer the resulting code stream. If the quantization parameter value is small, most of details in the video image are preserved; the quantization parameter value is increased, some details in the video image are lost, the code rate is reduced, and the image distortion strengthening quality is reduced. Illustratively, when the quantization parameter value takes a minimum value of 0, according to the default settings of the encoder, it indicates that quantization is the finest; conversely, when the quantization parameter value takes the maximum value 51, it indicates that quantization is the coarsest. In one embodiment, video frames of still type after a preset period are encoded based on progressively increasing minimum quantization parameter values while skipping sub-pixel searching and generation of sub-pixel reference information. Alternatively, the minimum quantization parameter value may be exemplified in an increasing manner by: and when each frame is coded, sequentially increasing the minimum quantization parameter value by a preset value, and then carrying out video coding on the corresponding video frame. The preset size value may be 1, for example. In one embodiment, the upper limit value for the increase in the minimum quantization parameter value may be set accordingly, and the increase may not be performed after the increase.
In one embodiment, for a video frame in a sequence of video frames to be encoded, if it is determined that the motion type of the video frame in the sequence of video frames 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 thereon.
According to the method, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, under the condition that the motion type meets the static encoding condition, sub-pixel searching is conducted on the video frames under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm, the sub-pixel searching and generation of sub-pixel reference information are skipped on the video frames after the preset duration, and video frame encoding is conducted based on gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
Based on the technical scheme, the method further comprises the following steps: selecting a skip mode frame for the video frames after the preset duration; and adopting a preset skip mode to carry out video coding of the skip mode frame. That is, for a still type video frame in a video sequence, for a still type video frame after a preset time period, skipping sub-pixel searching and generating sub-pixel reference information, and for a selected skip mode frame, performing video encoding of the skip mode frame by adopting a preset skip mode. The mode of selecting the skip mode frame may be to randomly select an odd frame or an even frame among the still type video frames or select the odd frame or the even frame as the skip mode frame. The preset skip mode may be a skip mode set by the encoder itself in a design process, and the skip mode is defined in a video coding standard. The preset Skip mode may be a Skip mode defined in the HEVC coding standard, for example. By using the skip mode, a great amount of encoding time is saved, and a great amount of bit rate is saved, so that the video encoding efficiency is further improved.
Fig. 2 is a flowchart of another video encoding method according to an embodiment of the present application, and as shown in fig. 2, a method for determining a video frame type is provided, where the method includes:
step 201, a video frame sequence to be encoded is obtained, and the motion type of the video frame is determined based on the row encoding cost and the column encoding cost of the encoding block in the video frame.
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 encoding cost and the column encoding cost of the encoded blocks in the video frame. The coding blocks are independent coding units for dividing video frame images in the video coding process, and one video frame image can be divided into a plurality of rows and a plurality of columns of coding blocks. The motion type of the encoded block in the video frame is determined by acquiring a row encoding cost and a column encoding cost determination. Optionally, the row coding cost and the column coding cost of the coding block are calculated and stored correspondingly in the preprocessing process of video coding, and can be directly obtained here.
In one embodiment, different determination approaches are employed in determining the type of motion for different types of video frames. Optionally, as shown in fig. 3, fig. 3 is a flowchart of a method for determining a motion type of a P-frame image according to an embodiment of the present application, which specifically includes:
in step S2011, in the case that the video frame is a P-frame image, the line coding costs of each line of the P-frame image and the column coding costs of the middle column are obtained.
Step 2012, comparing the row coding cost and the column coding cost of each row with the corresponding first price threshold value, and determining whether the P frame image is of a static type according to the comparison result.
In one embodiment, for a P-frame image, a row coding cost of each row of the P-frame image and a column coding cost of an intermediate column are obtained, where in the case where there are two columns in the intermediate column, one of the columns may be selected as the intermediate column at random or according to a set selection manner.
Exemplary, as shown in the following table:
inter-11 | inter-12 | … | … | inter-1n |
inter-21 | inter-22 | … | … | inter-2n |
… | … | … | … | … |
inter-m1 | inter-m2 | … | … | inter-mn |
the P frame image is divided into m rows and n columns, the exemplary labels of the coding blocks are shown in the table above, the coding cost of the coding blocks of the first row and the first column is marked as inter-00, the coding cost of the second column and the first row is marked as inter-01, the coding cost of the first column and the second row is marked as inter-10, and the like.
When calculating the line coding cost, the sum of the coding costs of the coding blocks of the line is calculated as the line coding cost of the line (the value range of x is 0 m in an exemplary way denoted as an inter-rx), and the coding cost of the middle column is the corresponding coding block of the middle column and then is used as the column coding cost (the value range of x is 0 m in an exemplary way denoted as an inter-c).
Optionally, when determining the motion type of the video frame, it includes determining whether it is a stationary type, a slow motion type, and in the case that it is neither a stationary type nor a slow motion type, determining that it is a fast motion type. And when determining whether the P-frame image is of a static type, comparing the P-frame image with a first price threshold value which is correspondingly set according to the row coding cost and the column coding cost of each row, and determining whether the P-frame image is of the static type according to the comparison result. The first price threshold may be a fixed value or a value calculated based on different numbers of rows and columns. Alternatively, for a row coding cost, the aligned threshold may be denoted as n×th1_still, and for a column coding cost, the aligned threshold may be denoted as m×th1_still. Alternatively, the judgment method may be that the inter-rx < n×th1_still, and the inter-c < m×th1_still determines that the P frame picture is of STILL type. By the method for determining the motion type of the video frame based on the coding cost, the motion type of the video frame can be determined rapidly, complex calculation and comparison processes are not needed, and the determination speed of the motion type can be improved remarkably.
Optionally, for the case that the video frame is an I-frame image, the manner of determining the motion type of the video frame is shown in fig. 4, and fig. 4 is a flowchart of a method for determining the motion type of the I-frame image according to an embodiment of the present application, where the method includes:
in step S2013, in the case that the video frame is an I-frame image, the line coding costs of each line of the I-frame image and the column coding costs of the middle column are obtained.
Step S2014, acquiring 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.
Step S2015, determining whether the I-frame image is of a still type based on the line coding cost and the column coding cost of each line of the I-frame image, and the line coding cost and the column coding cost of each line of the previous frame image.
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 acquiring the line coding cost of each line of the I frame image and the column coding cost of the middle column, the corresponding acquiring the line coding cost of each line of the previous frame image and the column coding cost of the middle column of the I frame image determines whether the I frame image is of the still type by comparing the line coding cost and the column coding cost of each line of the I frame image and the line coding cost and the column coding cost of each line of the previous frame image.
Alternatively, the manner of determining whether the I-frame image is of the STILL type may be to determine whether the absolute value of the difference between each line coding cost of the I-frame image and the corresponding line coding cost of the previous frame image is smaller than a first absolute threshold, which may be denoted as n×th2_still, and whether the absolute value of the difference between the column coding cost of the I-frame image and the column coding cost of the previous frame image is smaller than a second absolute threshold, which may be denoted as m×th2_still, respectively. And determining that the I frame image is of a static type when the absolute value of the difference between each row coding cost of the I frame image and the corresponding row coding cost of the previous frame image is smaller than a first absolute threshold and the absolute value of the difference between the column coding cost of the I frame image and the column coding cost of the previous frame image is smaller than a second absolute threshold.
Alternatively, in determining whether the video frame is of the slow motion type, it may be: and determining that the video frame is of a slow motion type under the condition that any line of line coding cost in the video frame is larger than a second cost threshold and smaller than a third cost threshold and other line coding cost is smaller than a first cost threshold. I.e. when there are some or several lines whose line coding cost is greater than the second cost threshold and less than the third cost threshold, it is determined that it is of slow motion type. Wherein 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. Alternatively, a line is determined to be a fast motion type when there is a line coding cost for that line that is greater than a third rate threshold.
Step S202, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a static type.
Step 203, skipping sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration, and performing video frame encoding based on the gradually increased minimum quantization parameter value.
According to the method, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, under the condition that the motion type meets the static encoding condition, sub-pixel searching is conducted on the video frames under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm, the sub-pixel searching and generation of sub-pixel reference information are skipped on the video frames after the preset duration, and video frame encoding is conducted based on gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
Fig. 5 is a flowchart of another video encoding method according to an embodiment of the present application, as shown in fig. 5, including:
step 301, a video frame sequence to be encoded is obtained, and the motion type of a video frame in the video frame sequence is determined.
Step S302, performing sub-pixel search on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a still type.
Step S303, skipping sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration, and performing video frame coding based on the gradually increased minimum quantization parameter value.
Step S304, under the condition that the motion type of the video frame is a slow motion frame type, carrying out sub-pixel search on the video frame of the slow motion frame type based on a first preset algorithm.
Step S305, determining an algorithm adopted by the video frame of the next slow motion frame type based on the set feedback frame, and performing a sub-pixel search based on the determined algorithm.
In one embodiment, for a video frame of a slow motion frame type, a sub-pixel search is performed on the video frame of the slow motion frame type based on a first preset algorithm, while an algorithm adopted by a video frame of a next slow motion frame type is determined by using a set feedback frame, such as adopting the first preset algorithm or a standard coding algorithm, and the sub-pixel search is performed based on the determined algorithm.
Alternatively, the process of determining the algorithm to be adopted by the video frame of the next slow motion frame type based on the set feedback frame may be: acquiring the actual coding cost of the recorded video frame of the current slow motion frame type, and determining that the video frame of the next slow motion frame type uses a standard coding algorithm under the condition that the actual coding cost is larger than a preset cost threshold. The coding quality is measured by comparing the actual coding cost with a preset cost threshold, if the actual coding cost is larger than the preset cost threshold, the video frame of the next slow motion frame type adopts a standard coding algorithm to carry out sub-pixel searching, otherwise, the first preset algorithm is continuously used for carrying out sub-pixel searching. The preset cost threshold value can be adaptively set according to actual requirements. By setting a feedback frame form to compare the actual coding cost with a preset cost threshold, adaptive algorithm switching can be realized, and proper algorithms are selected for different actual coding conditions to perform sub-pixel searching, so that coding quality is ensured and coding efficiency is improved.
Optionally, the video frame of the fast motion type is encoded by adopting an original set manner of an encoder, for example, a standard encoding algorithm and a default minimum quantization parameter value are adopted for video encoding.
According to the method, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, under the condition that the motion type meets the static encoding condition, sub-pixel searching is conducted on the video frames under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm, the sub-pixel searching and generation of sub-pixel reference information are skipped on the video frames after the preset duration, and video frame encoding is conducted based on gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
Fig. 6 is a block diagram of a video encoding apparatus according to an embodiment of the present application, and as shown in fig. 6, the apparatus is configured to execute the video encoding method according to the foregoing embodiment, and has functional modules and beneficial effects corresponding to the execution method. As shown in fig. 6, the apparatus specifically includes: a type determination module 101, a pixel search module 102, an encoding configuration module 103, and an encoding processing module 104, wherein,
the type determining module 101 is configured to acquire a video frame sequence to be encoded and determine the motion type of a video frame in the video frame sequence;
the pixel searching module 102 is configured to perform sub-pixel searching on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a static type, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm;
the encoding configuration module 103 is configured to skip sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration;
the encoding processing module 104 is configured to encode the video frame based on the gradually increasing minimum quantization parameter value.
According to the method, a video frame sequence to be encoded is obtained, the motion type of the video frames in the video frame sequence is determined, under the condition that the motion type meets the static encoding condition, sub-pixel searching is conducted on the video frames under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard encoding algorithm, the sub-pixel searching and generation of sub-pixel reference information are skipped on the video frames after the preset duration, and video frame encoding is conducted based on gradually increased quantization parameter values. According to the scheme, under the condition that the video frame is relatively static, a low-complexity coding algorithm is adopted, and meanwhile, part of coding flow is skipped, so that the coding efficiency is remarkably improved under the condition that the video coding quality is guaranteed.
In a possible embodiment, the type determining module 101 is specifically configured to:
and 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.
In a possible embodiment, the type determining module 101 is specifically configured to:
acquiring row coding cost of each row of the P frame image and column coding cost of a middle column under the condition that the video frame is the P frame image;
and comparing the row coding cost and the column coding cost of each row with a first price threshold value which is correspondingly set, and determining whether the P frame image is of a static type according to the comparison result.
In a possible embodiment, the type determining module 101 is specifically configured to:
acquiring row coding cost of each row of the I frame image and column coding cost of a middle column under the condition that the video frame is the I frame image;
acquiring the row coding cost of each row of a previous frame image of the I frame image and the column coding cost of a middle column;
and determining whether the I frame image is of a static type 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.
In a possible embodiment, the type determining module 101 is specifically configured to:
and determining that the video frame is of a slow motion type under the condition that any line coding cost is larger than a second cost threshold and smaller than a third cost threshold and other line coding costs are smaller than a first cost threshold in the video frame.
In one possible embodiment, the pixel search module 102 is further configured to:
under the condition that the motion type of the video frame is a slow motion frame type, carrying out sub-pixel search on the video frame of the slow motion frame type based on the first preset algorithm;
and determining an algorithm adopted by a video frame of the next slow motion frame type based on the set feedback frame, and carrying out sub-pixel searching based on the determined algorithm.
In one possible embodiment, the pixel search module 102 is further configured to:
acquiring the actual coding cost of the recorded video frame of the current slow motion frame type;
and under the condition that the actual coding cost is larger than a preset cost threshold value, determining the video frame of the next slow motion frame type to use a standard coding algorithm.
In one possible embodiment, the encoding processing module 104 is configured to:
and when each frame is coded, sequentially increasing the minimum quantization parameter value by a preset value, and then carrying out video coding on the corresponding video frame.
In one possible embodiment, the encoding processing module 104 is further configured to:
after the minimum quantization parameter value is increased by a preset value in sequence and video coding of the corresponding video frame is carried out, the minimum quantization parameter value with the original size is restored under the condition that the motion type of the video frame in the video frame sequence is determined to be the rapid motion type, so that video coding of the video frame is carried out.
In a possible embodiment, the encoding configuration module 103 is further configured to:
selecting a skip mode frame for the video frames after the preset duration;
the encoding processing module 104 is configured to:
and adopting a preset skip mode to carry out video coding of the skip mode frame.
Fig. 7 is a schematic structural diagram of a video encoding apparatus according to an embodiment of the present application, and as shown in fig. 7, the apparatus includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device may be one or more, one processor 201 being taken as an example in fig. 7; the processor 201, memory 202, input devices 203, and output devices 204 in the apparatus may be connected by a bus or other means, for example in fig. 7. The memory 202 is a computer readable storage medium, and may be used to store software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the video encoding method in the embodiments of the present application. The processor 201 executes various functional applications of the device and data processing, i.e., implements the video encoding method described above, by running software programs, instructions, and modules stored in the memory 202. The input device 703 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the apparatus. The output device 204 may include a display device such as a display screen.
Embodiments of the present application also provide a non-volatile storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform a video encoding method as described in one of the above embodiments, comprising:
acquiring a video frame sequence to be encoded, and determining the motion type of a video frame in the video frame sequence;
under the condition that the motion type of the video frame is a static type, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm;
and skipping sub-pixel searching and sub-pixel reference information generation for the video frames after the preset duration, and carrying out video frame coding based on the gradually increased minimum quantization parameter values.
It should be noted that, in the embodiment of the video encoding apparatus, each unit and module included are only divided according to the functional logic, but not limited to the above-mentioned division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the embodiments of the present application.
In some possible embodiments, aspects of the method provided by the present application may also be implemented in the form of a program product, which includes a program code for causing a computer device to perform the steps of the method according to the various exemplary embodiments of the application described in the present specification, when the program product is run on the computer device, 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 (14)
1. A video encoding method, comprising:
acquiring a video frame sequence to be encoded, and determining the motion type of a video frame in the video frame sequence;
under the condition that the motion type of the video frame is a static type, carrying out sub-pixel search on the video frame under the preset duration based on a first preset algorithm, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm;
and skipping sub-pixel searching and sub-pixel reference information generation for the video frames after the preset duration, and carrying out video frame coding based on the gradually increased minimum quantization parameter values.
2. The method of video coding according to claim 1, wherein said determining a type of motion of a video frame in said sequence of video frames comprises:
and 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.
3. The video coding method of claim 2, wherein the determining the type of motion of the video frame based on the row coding cost and the column coding cost of the coded blocks in the video frame comprises:
acquiring row coding cost of each row of the P frame image and column coding cost of a middle column under the condition that the video frame is the P frame image;
and comparing the row coding cost and the column coding cost of each row with a first price threshold value which is correspondingly set, and determining whether the P frame image is of a static type according to the comparison result.
4. The video coding method of claim 2, wherein the determining the type of motion of the video frame based on the row coding cost and the column coding cost of the coded blocks in the video frame comprises:
acquiring row coding cost of each row of the I frame image and column coding cost of a middle column under the condition that the video frame is the I frame image;
acquiring the row coding cost of each row of a previous frame image of the I frame image and the column coding cost of a middle column;
and determining whether the I frame image is of a static type 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 coding method of claim 2, wherein the determining the type of motion of the video frame based on the row coding cost and the column coding cost of the coded blocks in the video frame comprises:
and determining that the video frame is of a slow motion type under the condition that any line coding cost is larger than a second cost threshold and smaller than a third cost threshold and other line coding costs are smaller than a first cost threshold in the video frame.
6. The video coding method of claim 5, wherein the method further comprises:
under the condition that the motion type of the video frame is a slow motion frame type, carrying out sub-pixel search on the video frame of the slow motion frame type based on the first preset algorithm;
and determining an algorithm adopted by a video frame of the next slow motion frame type based on the set feedback frame, and carrying out sub-pixel searching based on the determined algorithm.
7. The video coding method of claim 6, wherein the algorithm employed by the set-up feedback framework to determine the video frame of the next slow motion frame type comprises:
acquiring the actual coding cost of the recorded video frame of the current slow motion frame type;
and under the condition that the actual coding cost is larger than a preset cost threshold value, determining the video frame of the next slow motion frame type to use a standard coding algorithm.
8. The video coding method according to claim 1, wherein the video frame coding based on the gradually increasing minimum quantization parameter value comprises:
and when each frame is coded, sequentially increasing the minimum quantization parameter value by a preset value, and then carrying out video coding on the corresponding video frame.
9. The video coding method according to claim 8, wherein after video coding of the corresponding video frame after the sequentially increasing the minimum quantization parameter value by a preset magnitude value, the method further comprises:
and restoring the minimum quantization parameter value of the original size for video coding of the video frames under the condition that the motion type of the video frames in the video frame sequence is determined to be the rapid motion type.
10. The video coding method according to any one of claims 1-9, wherein the method further comprises:
selecting a skip mode frame for the video frames after the preset duration;
and adopting a preset skip mode to carry out video coding of the skip mode frame.
11. A video encoding apparatus, comprising:
the type determining module is configured to acquire a video frame sequence to be encoded and determine the motion type of a video frame in the video frame sequence;
the pixel searching module is configured to perform sub-pixel searching on the video frame under the preset duration based on a first preset algorithm under the condition that the motion type of the video frame is a static type, wherein the complexity of the first preset algorithm is lower than that of a standard coding algorithm;
the coding configuration module is configured to skip sub-pixel searching and sub-pixel reference information generation for the video frame after the preset duration;
and the encoding processing module is configured to encode the video frames based on the gradually-increased minimum quantization parameter value.
12. A video encoding apparatus, the apparatus comprising: one or more processors; storage means for storing one or more programs that when executed by the one or more processors cause the one or more processors to implement the video encoding method of any of claims 1-10.
13. A non-transitory storage medium storing computer executable instructions which, when executed by a computer processor, are for performing the video encoding method of any of claims 1-10.
14. A computer program product comprising a computer program, characterized in that the computer program, when executed by a processor, implements the video encoding method of any of claims 1-10.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311020356.7A CN116939216A (en) | 2023-08-14 | 2023-08-14 | Video encoding method, apparatus, device, storage medium, and program product |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311020356.7A CN116939216A (en) | 2023-08-14 | 2023-08-14 | Video encoding method, apparatus, device, storage medium, and program product |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116939216A true CN116939216A (en) | 2023-10-24 |
Family
ID=88387955
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311020356.7A Pending CN116939216A (en) | 2023-08-14 | 2023-08-14 | Video encoding method, apparatus, device, storage medium, and program product |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116939216A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118573876A (en) * | 2024-07-30 | 2024-08-30 | 北京欣博电子科技有限公司 | Video encoding method, apparatus, computer device, readable storage medium, and program product |
-
2023
- 2023-08-14 CN CN202311020356.7A patent/CN116939216A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN118573876A (en) * | 2024-07-30 | 2024-08-30 | 北京欣博电子科技有限公司 | Video encoding method, apparatus, computer device, readable storage medium, and program product |
CN118573876B (en) * | 2024-07-30 | 2024-10-29 | 北京欣博电子科技有限公司 | Video encoding method, apparatus, computer device, readable storage medium, and program product |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110166771B (en) | Video encoding method, video encoding device, computer equipment and storage medium | |
US10455229B2 (en) | Prediction mode selection method, apparatus and device | |
WO2020258010A1 (en) | Image encoding method, image decoding method, encoder, decoder and storage medium | |
CN109688407B (en) | Reference block selection method and device for coding unit, electronic equipment and storage medium | |
CN101091393A (en) | Moving picture encoding method, device using the same, and computer program | |
CN109089121B (en) | Motion estimation method and device based on video coding and electronic equipment | |
KR20180037042A (en) | A motion vector field coding method and a decoding method, and a coding and decoding apparatus | |
CN116939216A (en) | Video encoding method, apparatus, device, storage medium, and program product | |
JPH07193822A (en) | Motion prediction processor and device therefor | |
CN105898296A (en) | Video coding frame selection method and device | |
CN114079792A (en) | Compression method, coding method and device for video coding reference block | |
CN110166770B (en) | Video encoding method, video encoding device, computer equipment and storage medium | |
WO2016116984A1 (en) | Moving image encoding device, moving image encoding method, and moving image encoding program | |
US8594194B2 (en) | Compression method using adaptive field data selection | |
JP4957780B2 (en) | Motion compensated predictive coding apparatus, motion compensated predictive coding method, and program | |
USRE47004E1 (en) | Moving image coding device and method | |
US20220385914A1 (en) | Methods and apparatus for processing of high-resolution video content | |
CN115442617A (en) | Video processing method and device based on video coding | |
CN114040209A (en) | Motion estimation method, motion estimation device, electronic equipment and storage medium | |
US20110051815A1 (en) | Method and apparatus for encoding data and method and apparatus for decoding data | |
US7706440B2 (en) | Method for reducing bit rate requirements for encoding multimedia data | |
US20180199031A1 (en) | Video encoding apparatus and video data amount encoding method | |
CN110933413A (en) | Video frame processing method and device | |
JP4438949B2 (en) | Motion compensated predictive coding apparatus, motion compensated predictive coding method, and program | |
CN117156134A (en) | Dynamic code rate control method, device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |