CN114286098A - Video encoding and decoding method, system, device and storage medium - Google Patents

Video encoding and decoding method, system, device and storage medium Download PDF

Info

Publication number
CN114286098A
CN114286098A CN202111597414.3A CN202111597414A CN114286098A CN 114286098 A CN114286098 A CN 114286098A CN 202111597414 A CN202111597414 A CN 202111597414A CN 114286098 A CN114286098 A CN 114286098A
Authority
CN
China
Prior art keywords
image frame
frame
code stream
coding
video
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
Application number
CN202111597414.3A
Other languages
Chinese (zh)
Inventor
董友球
刘先材
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Vtron Group Co Ltd
Original Assignee
Vtron Group Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Vtron Group Co Ltd filed Critical Vtron Group Co Ltd
Priority to CN202111597414.3A priority Critical patent/CN114286098A/en
Publication of CN114286098A publication Critical patent/CN114286098A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention relates to a video coding and decoding method, a system, equipment and a storage medium, wherein the video coding method comprises the following steps: coding video data according to a first coding algorithm to form a first code stream; presetting an initial value of a key frame mark as effective; judging whether the key frame mark is effective or not; if so, coding the current image frame according to a second coding algorithm, determining that the next image frame is a new current image frame, and setting the key frame mark as invalid; if not, calculating a difference value between the current image frame and the previous image frame, encoding the difference value according to a second encoding algorithm, determining that the subsequent 1 st image frame or the x-th image frame is a new current image frame, and setting the key frame mark as valid when the determined image frame is the x-th image frame; continuously judging whether the key frame mark is effective or not to form a second code stream; the first code stream and the second code stream adopt the same reference time stamp. The invention can combine the advantages of different coding modes and optimize video data transmission.

Description

Video encoding and decoding method, system, device and storage medium
Technical Field
The present invention relates to the field of video data communication technologies, and in particular, to a video encoding and decoding method, system, device, and storage medium.
Background
Video coding and decoding processing is widely applied, and two schemes are mainly adopted: one is called deep compression, that is, the video image is compressed by adopting an encoding format of H264/H265, which has the advantages of high compression ratio, less occupied bandwidth and poor image quality, especially in a scene displaying characters, and the other is called shallow compression, which generally adopts encoding technologies such as JPEG2000, VC-2, SDVoE and the like to compress the video image, which has the advantages of good image quality and poor bandwidth requirement, and some even require a ten-million switch.
Disclosure of Invention
The present invention is directed to overcoming at least one of the above-mentioned disadvantages (i.e., drawbacks) of the prior art and providing a video encoding and decoding method, system, device and storage medium for optimizing video data transmission by combining advantages of different encoding schemes.
In a first aspect, the present invention provides a video encoding method, including:
coding image frames of the video data according to a first coding algorithm to form a first code stream;
presetting an initial value of a key frame mark as effective;
judging whether the current key frame mark is effective or not;
if yes, coding a current image frame of the video data according to a second coding algorithm, determining that a next image frame of the current image frame is a new current image frame, and setting the current key frame mark as invalid;
if not, calculating a difference value between a current image frame of the video data and a previous image frame of the current image frame, encoding the difference value according to a second encoding algorithm, determining that a 1 st image frame or an x-th image frame after the current image frame is a new current image frame according to the data amount of the encoded difference value, wherein x is an integer which is set to be greater than 1, and setting the current key frame mark to be valid when determining that the new current image frame is the x-th image frame after the current image frame;
continuously judging whether the current key frame mark is effective or not to form a second code stream;
and the data frame of the first code stream and the data frame of the second code stream adopt the same reference time stamp.
In a second aspect, the present invention provides a video decoding method, comprising;
obtaining a first code stream and a second code stream according to the first aspect;
decoding the first code stream to obtain a first image frame, and putting the first image frame into a first image frame queue;
decoding the second code stream to obtain a second image frame, and putting the second image frame into a second image frame queue;
acquiring the first image frame from the first image frame queue frame by frame according to the time stamp of the first image frame;
acquiring the second image frame from the second image frame queue frame by frame according to the time stamp of the second image frame;
and if the first image frame and the second image frame are acquired simultaneously under the same timestamp, displaying the second image frame, otherwise, displaying the first image frame.
In a third aspect, the present invention provides a video encoding system, comprising:
the video coding module is used for coding image frames of the video data according to a first coding algorithm to form a first code stream;
the mark presetting module is used for presetting the initial value of the key frame mark to be effective;
the image coding module is used for judging whether the current key frame mark is effective or not; if so, encoding the current image frame of the video data according to a second encoding algorithm, and determining the next image frame of the current image frame as a new current image frame; if not, calculating a difference value between a current image frame of the video data and a previous image frame of the current image frame, encoding the difference value according to a second encoding algorithm, determining that a 1 st image frame or an x-th image frame after the current image frame is a new current image frame according to the data amount of the encoded difference value, wherein x is an integer which is set to be greater than 1, and setting the current key frame mark to be valid when determining that the new current image frame is the x-th image frame after the current image frame; continuously judging whether the current key frame mark is effective or not to form a second code stream;
and the data frame of the first code stream and the data frame of the second code stream adopt the same reference time stamp.
In a fourth aspect, the present invention provides a video decoding system, comprising:
a code stream obtaining module, configured to obtain the first code stream and the second code stream according to the third aspect;
the first decoding module is used for decoding the first code stream to obtain a first image frame, and the first image frame is placed in a first image frame queue;
the second decoding module is used for decoding the second code stream to obtain a second image frame, and the second image frame is placed in a second image frame queue;
the image display sending module is used for acquiring the first image frame from the first image frame queue frame by frame according to the time stamp of the first image frame; acquiring the second image frame from the second image frame queue frame by frame according to the time stamp of the second image frame; and if the first image frame and the second image frame are acquired simultaneously under the same timestamp, displaying the second image frame, otherwise, displaying the first image frame.
In a fifth aspect, the present invention provides an electronic device comprising a memory and a processor, the memory storing a computer program, the processor implementing the video encoding method according to the first aspect or the video decoding method according to the second aspect when executing the computer program.
In a sixth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements a video encoding method as described in the first aspect or a video decoding method as described in the second aspect.
Compared with the prior art, the invention has the beneficial effects that: the invention adopts the first coding algorithm to carry out continuous frame compression to form a first code stream, simultaneously adopts the second coding algorithm to carry out discontinuous frame compression based on the key frame mark, can automatically switch and send the display according to the dynamic and static characteristics of the video data and the time stamp under the condition that the first code stream and the second code stream adopt the uniform reference time stamp, ensures higher image quality when the video data is biased to a static picture, has higher-quality compression effect when the video data is biased to a dynamic picture, realizes the transmission of the video data under low bandwidth while considering the image quality, the image delay and the video smoothness, and can realize the transmission of high-quality pictures under the bandwidth environment almost equivalent to shallow compression.
Drawings
Fig. 1 is a first flowchart of a video encoding method according to an embodiment of the present invention.
Fig. 2 is a second flowchart of a video encoding method according to an embodiment of the present invention.
Fig. 3 is a flowchart of a video decoding method according to an embodiment of the invention.
Fig. 4 is a block diagram of a video coding system according to an embodiment of the present invention.
Fig. 5 is a block diagram of a video decoding system according to an embodiment of the present invention.
Fig. 6 is a block diagram of an electronic device according to an embodiment of the invention.
Detailed Description
The drawings are only for purposes of illustration and are not to be construed as limiting the invention. For a better understanding of the following embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product; it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The embodiment provides a video coding method, which can be applied to a coding end, wherein the coding end is responsible for collecting image data and compressing the image data into a code stream with a specified format. Specifically, the video encoding method provided by this embodiment is used to encode an image frame in video data, and the encoded video data can implement data compression, so that the bandwidth occupied by transmitting the video data is smaller.
The video coding method provided by the present embodiment synchronously uses two coding modes, the first coding mode is continuous inter-frame compression, and the second coding mode is discontinuous inter-frame compression. The embodiment realizes the fusion of the first coding mode and the second coding mode, can meet the compression requirement, reduce the requirement of video data transmission on bandwidth, ensure the quality of images to a certain extent and optimize the experience of watching videos by users.
Fig. 1 is a first flowchart of a video encoding method provided in the present embodiment. As shown in fig. 1, the video encoding method includes:
the method comprises the following steps of coding by adopting a first coding mode to form a first code stream, and specifically comprises the following steps:
s101, encoding image frames of video data according to a first encoding algorithm to form a first code stream.
The first code stream is a data stream formed by encoding video data according to a first encoding mode, the first code stream comprises a plurality of frame data frames, the video data comprises a plurality of frame image frames, the image frames in the video data are encoded into the data frames in the first code stream, the first code stream can be transmitted to a decoding end, decoding is carried out through the decoding end, the data frames in the first code stream are restored into the image frames of the video data, and therefore transmission of the video data is achieved. In a specific implementation, the first encoding algorithm may be an H264 encoding algorithm or an H265 encoding algorithm.
And coding by adopting a second coding mode to form a second code stream, wherein the method specifically comprises the following steps:
s102, presetting the initial value of the key frame mark as effective.
When the key frame mark of the image frame is valid, it indicates that the image frame only aims at the data of the image frame during encoding, and can complete encoding (intra-frame compression), and the decoding can be completed only by the data of the image frame without referring to the data of other image frames during decoding.
When the key frame mark of the image frame is invalid, it indicates that the image frame needs to refer to data of other image frames during encoding to complete encoding (inter-frame compression) of the image frame, and also needs to refer to data of other image frames during decoding to complete decoding of the image frame.
The initial value of the key frame flag is preset to be valid so that subsequent encoding can be started.
And S103, judging whether the current key frame mark is effective, if so, executing S104, and otherwise, executing S105 and S106 to form a second code stream.
And when the current key frame mark is judged to be effective, executing step S104, directly performing intraframe compression on the current image frame according to a second coding algorithm, and coding the current image frame according to the second coding algorithm without referring to data of other image frames.
When the current key frame flag is determined to be invalid, step S105 is performed, inter-frame compression is performed on the current image frame by referring to data of an image frame previous to the current image frame, and a difference value between the current image frame and the image frame previous to the current image frame is encoded according to a second encoding algorithm.
The second code stream is a data stream formed by encoding the video data according to a second encoding mode, and the second code stream comprises a plurality of frame data frames, a part of the image frames in the video data are encoded into the data frames in the first code stream, the second code stream can be transmitted to a decoding end, and the decoding end decodes the data frames in the second code stream to restore the data frames in the second code stream into the image frames of the video data, so that the transmission of the video data is realized.
In a specific implementation process, the second encoding algorithm may be one of a run length encoding algorithm, a JPEG encoding algorithm, a VC-2 encoding algorithm, and an SDVoE encoding algorithm.
S104, coding the current image frame of the video data according to a second coding algorithm, determining that the next image frame of the current image frame is a new current image frame, setting the current key frame mark as invalid, and returning to execute S103.
In step S104, when it is determined that the new current image frame is the next image frame of the current image frame, the current key frame flag is set to be invalid, so that the image frame subjected to intra-frame compression may be switched from intra-frame compression to inter-frame compression.
S105, calculating a difference value between a current image frame of the video data and a previous image frame of the current image frame, coding the difference value according to a second coding algorithm, and determining a 1 st image frame or an x-th image frame after the current image frame as a new current image frame according to the data volume of the coded difference value, wherein x is a set integer greater than 1;
in step S105, a new current image frame may be determined according to the data size of the encoded difference value. When the data amount of the encoded difference value is small, it may be determined that a 1 st frame image frame after the current image frame is a new current image frame; when the data amount of the encoded difference value is large, it may be determined that the image frame of the x-th frame after the current image frame is a new current image frame, and at this time, it is equivalent to skip the image frame of the x-1 frame for no encoding, and suspend the encoding of the second encoding mode for a period of time. The image frame which is not coded by the second coding mode can be coded and transmitted by the first coding mode, so that a mechanism for pausing coding by the second coding mode is added, and the compression effect and the image quality required under two scenes, namely a static picture and a dynamic picture, in video data can be considered at the same time.
It is understood that the difference between the current image frame of the video data and the image frame previous to the current image frame is calculated on the premise that 1 image frame exists before the current image frame.
It can be understood that the premise of determining that the 1 st image frame after the current image frame is a new current image frame is that there are 1 image frame after the current image frame; the premise for determining that the x frame image frame after the current image frame is a new current image frame is that there is an x frame image frame after the current image frame.
x can be valued according to the actual condition, and in the whole encoding process, x can be unchanged or changed according to a certain rule.
S106, judging whether the new current image frame is determined to be the x-th image frame after the current image frame, if so, executing S107, and if not, returning to execute S103.
And S107, setting the current key frame mark as effective, and returning to execute S103.
When the new current image frame is determined to be the x-th frame image frame after the current image frame, the current key frame mark is set to be effective, so that the x-th frame image frame can be subjected to intra-frame compression after the x-1 frame image frame is skipped and is not coded, and the inter-frame compression is switched to the intra-frame compression.
And after coding, time stamps are required to be marked on the data frames of the first code stream and the data frames of the second code stream, and the data frames of the first code stream and the data frames of the second code stream adopt the same reference time stamps. In the decoding process, if the time stamp of the second code stream data frame is consistent with the time stamp of the first code stream data frame, the data frame of the second code stream is displayed, otherwise, the data frame of the first code stream is displayed.
The embodiment supports that a first coding mode of continuous frame compression is adopted to realize a better compression effect when video data is biased to a dynamic picture, a second coding mode of discontinuous frame compression is adopted to ensure higher image quality when the video data is biased to a static picture, a first code stream formed by the first coding mode and a second code stream formed by the second coding mode can be automatically switched to each other according to the dynamic and static characteristics of the video data and a timestamp to transmit and display, the video data is transmitted under low bandwidth while the image quality, the image delay and the video fluency are considered, and the transmission of high-quality pictures can be realized under the bandwidth environment almost equivalent to shallow compression.
Fig. 2 is a second flowchart of the video encoding method provided in this embodiment, and based on the first flowchart of the video encoding method, how to specifically determine the new current image frame after the difference value is encoded according to the second encoding algorithm, that is, how to specifically determine the new current image frame according to the data amount of the encoded difference value in step S105 is further refined. In step S105, determining that the 1 st frame image frame or the xth frame image frame after the current image frame is the new current image frame according to the data amount of the encoded difference value, which may include: and determining the 1 st frame image frame or the x frame image frame after the current image frame as a new current image frame according to the data amount of the difference value after the coding for a plurality of times. More specifically, as shown in fig. 2, determining that the 1 st or x-th frame image frame after the current image frame is a new current image frame according to the data amount of the difference value after being encoded for several consecutive times may include:
and S151, judging whether the data volume of the coded difference value is larger than a preset threshold value, if so, executing S152, and otherwise, executing S155.
When the data amount of the encoded difference value is greater than the preset threshold, it indicates that the current compression effect is not good enough, so step S152 may be performed to count the accumulated consecutive times that the data amount of the encoded difference value is greater than the preset threshold; when the data amount of the encoded difference value is not greater than the preset threshold, it indicates that the current compression effect is good, so step S115 may be performed to continue encoding.
S152, adding 1 to the accumulated continuous times, and judging whether the accumulated continuous times exceeds a preset time, if so, executing S153, and otherwise, executing S154.
The accumulated consecutive times is consecutive times in which the data amount of the encoded difference is greater than the preset threshold, and therefore, when the data amount of the encoded difference is determined to be greater than the preset threshold, 1 is added to the accumulated consecutive times. Whether the encoding is to be suspended for a period of time is determined by judging whether the accumulated number of consecutive times exceeds a preset number of times. The preset times can be valued according to the video data compression requirement or the bandwidth requirement of video data transmission.
And S153, determining that the image frame x of the frame after the current image frame is a new current image frame, and resetting the accumulated continuous times to an initial value.
And when the accumulated continuous times exceed the preset times, indicating that a relatively dynamic picture is being coded, skipping the image frame of the x-1 frame without coding, and taking the x-th frame after the current image frame as a new current image frame. The accumulated continuous times are reset to an initial value, and the accumulated continuous times of which the data quantity of the coded difference value is larger than a preset threshold value can be recalculated after the x-1 frame image frame is skipped and is not coded.
S154, determining a 1 st frame image frame after the current image frame as a new current image frame;
and when the accumulated continuous times are judged not to exceed the preset times, the image frame does not need to be skipped, and the new current image frame is determined as the 1 st image frame after the current image frame.
And S155, determining the image frame of the 1 st frame after the current image frame as a new current image frame, and resetting the accumulated continuous times to an initial value.
When the data amount of the coded difference value is judged to be not more than the preset threshold value, the image frame does not need to be skipped, a new current image frame is determined as the 1 st image frame after the current image frame, the accumulated continuous times are reset to the initial value, and the accumulated continuous times of which the data amount of the coded difference value is more than the preset threshold value can be recalculated.
Through steps S151 to S155, when the data amount of the difference value after the consecutive preset number of times of encoding is greater than the preset threshold, the encoding of the second encoding mode is suspended for a period of time, the x-1 frame image frame is skipped without being encoded in the second encoding mode, and the image frame that is not encoded in the second encoding mode is encoded and transmitted in the first encoding mode.
The present embodiment further provides a video decoding method, which can be applied to a decoding end, where the decoding end is responsible for decoding compressed data and displaying and processing the compressed data according to a specified rule. Specifically, the video decoding method provided by the present embodiment is used for decoding video data encoded by the video encoding method provided by the present embodiment. Fig. 3 is a flowchart of a video decoding method according to the present embodiment. As shown in fig. 3, the video decoding method includes:
s201, a first code stream formed by the video coding method provided by the embodiment is obtained, the first code stream is decoded to obtain a first image frame, and the first image frame is placed in a first image frame queue.
S202, a second code stream formed by the video coding method provided by the embodiment is obtained, the second code stream is decoded to obtain a second image frame, and the second image frame is placed in a second image frame queue.
Specifically, a first code stream and a second code stream are obtained from the encoding end through communication with the encoding end, and the first code stream and the second code stream respectively comprise a plurality of frame data frames. And decoding the first code stream and the second code stream, respectively and correspondingly decoding a first image frame and a second image frame from data frames in the first code stream and the second code stream, and respectively and correspondingly placing the data frames in a first image frame queue and a second image frame queue.
It can be understood that the time stamps of the data frames in the first code stream and the second code stream are still preserved after decoding, and become the time stamps of the first image frame and the second image frame. After the first image frame queue and the second image frame queue are put in, the frame fetching display can be performed according to the following steps:
s203, acquiring the first image frame from the first image frame queue frame by frame according to the time stamp of the first image frame.
And S204, acquiring the second image frames from the second image frame queue frame by frame according to the time stamps of the second image frames.
S205, judging whether the first image frame and the second image frame are acquired at the same time under the same timestamp, if so, executing S206, and if not, executing S207.
S206, displaying the second image frame.
And S207, displaying the first image frame.
And extracting the frames from the first image frame queue and the second image frame queue according to the system time according to the time stamp, if the time stamp of the second image frame is consistent with the time stamp of the first image frame, displaying the second image frame to enable the video data segment of the static image to be clearer, otherwise, displaying the first image frame to enable the video data segment of the dynamic image to be smoother. Therefore, the first image frame and the second image frame can be automatically switched with each other according to the dynamic and static characteristics of the video data and the time stamp for sending and displaying, the video data can be transmitted under low bandwidth, the image quality, the image delay and the video fluency can be considered, and the transmission of high-quality images can be realized under the bandwidth environment almost equivalent to shallow compression.
Fig. 4 is a block diagram of the video coding system provided in this embodiment, and as shown in fig. 4, the video coding system includes:
the video encoding module 301 is configured to encode an image frame of video data according to a first encoding algorithm to form a first code stream;
a flag presetting module 302, configured to preset an initial value of the key frame flag to be valid;
an image encoding module 303, configured to determine whether a current key frame flag is valid; if so, encoding the current image frame of the video data according to a second encoding algorithm, and determining the next image frame of the current image frame as a new current image frame; if not, calculating a difference value between the current image frame of the video data and the previous image frame of the current image frame, encoding the difference value according to a second encoding algorithm, determining that the 1 st image frame or the x-th image frame after the current image frame is a new current image frame according to the data volume of the encoded difference value, wherein x is an integer which is set to be greater than 1, and setting a current key frame mark to be effective when determining that the new current image frame is the x-th image frame after the current image frame; continuously judging whether the current key frame mark is effective or not to form a second code stream;
and the data frames of the first code stream and the second code stream adopt the same reference time stamp.
In some optional embodiments, the image encoding module 303 is configured to determine a new current frame according to the data amount of the encoded difference value, and specifically includes:
the image encoding module 303 is configured to determine, according to the data amount of the difference value after being encoded for several consecutive times, that the 1 st image frame or the x-th image frame after the current image frame is a new current image frame.
In some optional embodiments, the image encoding module 303 is configured to determine, according to the data amount of the difference value after being encoded for several consecutive times, that a 1 st image frame or an xth image frame after a current image frame is a new current image frame, and specifically includes:
the image encoding module 303 is configured to determine whether the data amount of the encoded difference value is greater than a preset threshold; when the data volume of the coded difference value is larger than a preset threshold value, adding 1 to the accumulated continuous times, and judging whether the accumulated continuous times exceed the preset times or not; if yes, determining that the x frame image frame behind the current image frame is a new current image frame, and resetting the accumulated continuous times to an initial value; if not, determining that the 1 st frame after the current image frame is a new current image frame; and when the data quantity of the coded difference value is not more than a preset threshold value, determining that the 1 st frame after the current frame is a new current image frame, and resetting the accumulated continuous times to an initial value.
In the image encoding module 303, the first encoding algorithm may be an H264 encoding algorithm or an H265 encoding algorithm, and the second encoding algorithm may be one of a run length encoding algorithm, a JPEG encoding algorithm, a VC-2 encoding algorithm, and an SDVoE encoding algorithm.
The video encoding system provided in this embodiment has similar implementation principles and technical effects to the video encoding method provided in this embodiment, and is not described herein again.
Fig. 5 is a block diagram of the video decoding system provided in this embodiment, and as shown in fig. 5, the video decoding system includes:
a code stream obtaining module 401, configured to obtain a first code stream and a second code stream formed by the video coding system provided in this embodiment;
a first decoding module 402, configured to decode the first code stream to obtain a first image frame, and place the first image frame into a first image frame queue;
a second decoding module 403, configured to decode the second code stream to obtain a second image frame, and place the second image frame into a second image frame queue;
an image display module 404, configured to obtain a first image frame from the first image frame queue frame by frame according to a timestamp of the first image frame; acquiring a second image frame from the second image frame queue frame by frame according to the time stamp of the second image frame; and if the first image frame and the second image frame are acquired simultaneously under the same timestamp, displaying the second image frame, otherwise, displaying the first image frame.
The video decoding system provided in this embodiment has similar implementation principles and technical effects to the video decoding method provided in this embodiment, and is not described herein again.
The embodiment also provides an electronic device, which may be configured as shown in fig. 6, and includes a processor 501 and a memory. The memory may include a non-volatile storage medium 520, an internal memory 530. The nonvolatile storage medium 520 stores a computer program 521. The internal memory 530 provides an environment for the execution of the computer program 521 in the nonvolatile storage medium 520.
The processor 501 is used to provide computing and control capabilities, and the computer program 521, when executed by the processor 501, may implement the video encoding method and/or the video decoding method provided by the present embodiment. The processor 501 may interface with an external device 550 through a communication interface 540.
In some alternative embodiments, the external device 550 may include a display, which may be a liquid crystal display, an electronic ink display, or the like. The processor 501 is connected to the display through the communication interface 540, and when the video decoding method provided by the embodiment is implemented, the processor 501 sends the first image frame or the second image frame to the display through the communication interface 540 for displaying.
In some alternative embodiments, external device 550 may comprise a computer. In implementing the video encoding method provided by the present embodiment, the computer sends the video data to be encoded to the processor 501 through the communication interface 540. If the computer is configured with a display, when implementing the video decoding method provided in this embodiment, the processor 501 may also send the first image frame or the second image frame to the computer through the communication interface 540, so that the first image frame or the second image frame is displayed on the display configured in the computer.
The implementation principle and technical effect of the electronic device provided in this embodiment are similar to those of the video decoding method and the video encoding method provided in this embodiment, and are not described herein again.
The present embodiment also provides a computer-readable storage medium on which a computer program is stored, which, when executed by a processor, implements the video encoding method and/or the video decoding method provided by the present embodiment.
The implementation principle and technical effect of the computer-readable storage medium provided in this embodiment are similar to those of the video decoding method and the video encoding method provided in this embodiment, and are not described herein again.
It should be understood that the above-mentioned embodiments of the present invention are only examples for clearly illustrating the technical solutions of the present invention, and are not intended to limit the specific embodiments of the present invention. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention claims should be included in the protection scope of the present invention claims.

Claims (10)

1. A video encoding method, comprising:
coding image frames of the video data according to a first coding algorithm to form a first code stream;
presetting an initial value of a key frame mark as effective;
judging whether the current key frame mark is effective or not;
if yes, coding a current image frame of the video data according to a second coding algorithm, determining that a next image frame of the current image frame is a new current image frame, and setting the current key frame mark as invalid;
if not, calculating a difference value between a current image frame of the video data and a previous image frame of the current image frame, encoding the difference value according to a second encoding algorithm, determining that a 1 st image frame or an x-th image frame after the current image frame is a new current image frame according to the data amount of the encoded difference value, wherein x is an integer which is set to be greater than 1, and setting the current key frame mark to be valid when determining that the new current image frame is the x-th image frame after the current image frame;
continuously judging whether the current key frame mark is effective or not to form a second code stream;
and the data frame of the first code stream and the data frame of the second code stream adopt the same reference time stamp.
2. The video coding method according to claim 1, wherein said determining that the 1 st or x-th image frame after the current image frame is a new current image frame according to the data amount of the encoded difference value comprises:
and determining the 1 st frame image frame or the x frame image frame after the current image frame as a new current image frame according to the data amount of the difference value after the coding for a plurality of times.
3. The video coding method according to claim 2, wherein said determining that the 1 st or x-th frame image frame after the current image frame is a new current image frame according to the data amount of the difference value after a plurality of consecutive times of coding comprises:
judging whether the data volume of the encoded difference value is larger than a preset threshold value or not;
when the data volume of the coded difference value is larger than a preset threshold value, adding 1 to the accumulated continuous times, and judging whether the accumulated continuous times exceed the preset times or not;
if yes, determining that the x frame image frame behind the current image frame is a new current image frame, and resetting the accumulated continuous times to an initial value;
if not, determining that the 1 st frame image frame after the current image frame is a new current image frame;
and when the data volume of the encoded difference value is not more than a preset threshold value, determining that the image frame of the 1 st frame after the current frame is a new current image frame, and resetting the accumulated continuous times to an initial value.
4. The video coding method according to any one of claims 1 to 3, wherein the first coding algorithm is an H264 coding algorithm or an H265 coding algorithm.
5. A video coding method according to any one of claims 1 to 3, wherein the second coding algorithm is one of a run length coding algorithm, a JPEG coding algorithm, a VC-2 coding algorithm, and a SDVoE coding algorithm.
6. A video decoding method, comprising;
acquiring a first code stream and a second code stream according to any one of claims 1 to 5;
decoding the first code stream to obtain a first image frame, and putting the first image frame into a first image frame queue;
decoding the second code stream to obtain a second image frame, and putting the second image frame into a second image frame queue;
acquiring the first image frame from the first image frame queue frame by frame according to the time stamp of the first image frame;
acquiring the second image frame from the second image frame queue frame by frame according to the time stamp of the second image frame;
and if the first image frame and the second image frame are acquired simultaneously under the same timestamp, displaying the second image frame, otherwise, displaying the first image frame.
7. A video coding system, comprising:
the video coding module is used for coding image frames of the video data according to a first coding algorithm to form a first code stream;
the mark presetting module is used for presetting the initial value of the key frame mark to be effective;
the image coding module is used for judging whether the current key frame mark is effective or not; if so, encoding the current image frame of the video data according to a second encoding algorithm, and determining the next image frame of the current image frame as a new current image frame; if not, calculating a difference value between a current image frame of the video data and a previous image frame of the current image frame, encoding the difference value according to a second encoding algorithm, determining that a 1 st image frame or an x-th image frame after the current image frame is a new current image frame according to the data amount of the encoded difference value, wherein x is an integer which is set to be greater than 1, and setting the current key frame mark to be valid when determining that the new current image frame is the x-th image frame after the current image frame; continuously judging whether the current key frame mark is effective or not to form a second code stream;
and the data frame of the first code stream and the data frame of the second code stream adopt the same reference time stamp.
8. A video decoding system, comprising:
a code stream obtaining module, configured to obtain the first code stream and the second code stream according to claim 7;
the first decoding module is used for decoding the first code stream to obtain a first image frame, and the first image frame is placed in a first image frame queue;
the second decoding module is used for decoding the second code stream to obtain a second image frame, and the second image frame is placed in a second image frame queue;
the image display sending module is used for acquiring the first image frame from the first image frame queue frame by frame according to the time stamp of the first image frame; acquiring the second image frame from the second image frame queue frame by frame according to the time stamp of the second image frame; and if the first image frame and the second image frame are acquired simultaneously under the same timestamp, displaying the second image frame, otherwise, displaying the first image frame.
9. An electronic device comprising a memory and a processor, the memory storing a computer program, wherein the processor, when executing the computer program, implements the video encoding method of any one of claims 1 to 5 or the video decoding method of claim 6.
10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the video encoding method of any one of claims 1 to 5 or the video decoding method of claim 6.
CN202111597414.3A 2021-12-24 2021-12-24 Video encoding and decoding method, system, device and storage medium Pending CN114286098A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111597414.3A CN114286098A (en) 2021-12-24 2021-12-24 Video encoding and decoding method, system, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111597414.3A CN114286098A (en) 2021-12-24 2021-12-24 Video encoding and decoding method, system, device and storage medium

Publications (1)

Publication Number Publication Date
CN114286098A true CN114286098A (en) 2022-04-05

Family

ID=80874777

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111597414.3A Pending CN114286098A (en) 2021-12-24 2021-12-24 Video encoding and decoding method, system, device and storage medium

Country Status (1)

Country Link
CN (1) CN114286098A (en)

Similar Documents

Publication Publication Date Title
CN100591128C (en) Video coding, decoding and hypothetical reference decoder
US9445107B2 (en) Low latency rate control system and method
US20140233637A1 (en) Managed degradation of a video stream
US9560379B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
CN111641804A (en) Video data processing method and device, terminal, camera and video conference system
US20110299605A1 (en) Method and apparatus for video resolution adaptation
WO2024078066A1 (en) Video decoding method and apparatus, video encoding method and apparatus, storage medium, and device
JP5784823B2 (en) On-demand intra-refresh for end-to-end coded video transmission systems
CN103918258A (en) Reducing amount of data in video encoding
CN114286098A (en) Video encoding and decoding method, system, device and storage medium
WO2023071469A1 (en) Video processing method, electronic device and storage medium
EP2688299A1 (en) Video processing method and system, and related device
CN113422983B (en) Data processing method, computer device, and storage medium
CN116668741A (en) Cloud desktop display method, image display method, device and storage medium
CN116962613A (en) Data transmission method and device, computer equipment and storage medium
EP1841237B1 (en) Method and apparatus for video encoding
CN112153413B (en) Method and server for processing screen splash in one-screen broadcast
WO2021042341A1 (en) Video display method, receiving end, system and storage medium
KR101251879B1 (en) Apparatus and method for displaying advertisement images in accordance with screen changing in multimedia cloud system
US9451285B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
CN116248895B (en) Video cloud transcoding method and system for virtual reality panorama roaming
CN112672167B (en) Video processing method, computer device, and storage medium
WO2005109749A1 (en) Methods and systems of monitoring images using mobile communication terminals
CN112702632B (en) Live program injection method, device, system, storage medium and computer equipment
CN104702970A (en) Video data synchronization method, device and system

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