CN113784123B - Video encoding method and apparatus, storage medium, and electronic device - Google Patents

Video encoding method and apparatus, storage medium, and electronic device Download PDF

Info

Publication number
CN113784123B
CN113784123B CN202111330536.6A CN202111330536A CN113784123B CN 113784123 B CN113784123 B CN 113784123B CN 202111330536 A CN202111330536 A CN 202111330536A CN 113784123 B CN113784123 B CN 113784123B
Authority
CN
China
Prior art keywords
video
coding
frame
group
results
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.)
Active
Application number
CN202111330536.6A
Other languages
Chinese (zh)
Other versions
CN113784123A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202111330536.6A priority Critical patent/CN113784123B/en
Publication of CN113784123A publication Critical patent/CN113784123A/en
Application granted granted Critical
Publication of CN113784123B publication Critical patent/CN113784123B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods 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/103Selection of coding mode or of prediction mode
    • H04N19/114Adapting the group of pictures [GOP] structure, e.g. number of B-frames between two anchor frames
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods 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/177Methods 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 a group of pictures [GOP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/50Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding
    • H04N19/503Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving temporal prediction

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention discloses a video coding method and device, a storage medium and electronic equipment. Wherein, the method comprises the following steps: dividing continuous M video frames to be coded into T +1 groups of video frames; forming a T +1 path video stream according to the T +1 group of video frames; and correspondingly inputting the T +1 paths of video streams into the T +1 encoders respectively to obtain a T +1 group of encoding results. The invention solves the technical problem of video blockage caused by video coding.

Description

Video encoding method and apparatus, storage medium, and electronic device
Technical Field
The present invention relates to the field of computers, and in particular, to a video encoding method and apparatus, a storage medium, and an electronic device.
Background
In the related art, inter-frame coding techniques are widely used for video coding. The main idea is that when a current video frame is coded, the current video frame is coded by referring to a previous video frame of the current video frame.
The current hardware encoder can only support encoding the current video frame by referring to the previous video frame, and cannot encode the current video frame by referring to the specified video frame. For example, when encoding a current 5 th frame video frame, a hardware encoder in the prior art only supports encoding the 5 th frame video frame with reference to a 4 th frame video frame, but cannot encode the 5 th frame video frame with reference to a specific video frame (e.g., a 2 nd frame video frame, a 3 rd frame video frame).
Packet loss often occurs during video transmission. By adopting a mode of coding a current video frame with reference to a previous video frame in the prior art, if a packet loss occurs in the previous video frame of the current video frame, the current video frame cannot be coded, so that the problem of video blockage occurs.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a video coding method and device, a storage medium and electronic equipment, which are used for at least solving the technical problem of video blockage caused by video coding.
According to an aspect of the embodiments of the present invention, there is provided a video encoding method, including: dividing M continuous video frames to be coded into T +1 groups of video frames, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, and T represents the number of the M continuous video framesThe number of frames to be cross-frame encoded, wherein the ith group of video frames in the T +1 groups of video frames comprises video frames selected every T video frames from the ith video frame in the M consecutive video frames,
Figure DEST_PATH_IMAGE001
(ii) a Forming a T +1 path of video stream according to the T +1 group of video frames, wherein the T +1 path of video stream comprises the T +1 group of video frames; correspondingly inputting the T +1 paths of video streams into T +1 encoders respectively to obtain a T +1 group of encoding results, wherein when a jth encoder in the T +1 encoders encodes a jth path of video streams in the T +1 paths of video streams, the jth encoder is used for encoding a non-key video frame by referring to a previous video frame of the non-key video frame in the jth path of video streams,
Figure 436341DEST_PATH_IMAGE002
(ii) a And recombining the coding results of the T +1 group according to the sequence of the frame numbers of the continuous M video frames to obtain continuous M coding results corresponding to the continuous M video frames.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding method, including: dividing M continuous encoding results to be decoded into T +1 groups of encoding results, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous encoding results are subjected to cross frame decoding, the ith group of video frames in the T +1 groups of encoding results comprises encoding results selected every T encoding results from the ith encoding result in the M continuous encoding results,
Figure 242623DEST_PATH_IMAGE001
(ii) a Forming a T +1 path of coding stream according to the T +1 group of coding results, wherein the T +1 path of coding stream comprises the T +1 group of coding results; correspondingly inputting the T +1 paths of coded streams into T +1 decoders respectively to obtain a T +1 group of decoding results, wherein when a jth decoder in the T +1 paths of coded streams decodes a jth coded stream in the T +1 paths of coded streamsThe j decoder is used for decoding the forward reference frame by referring to the previous coding result of the forward reference frame in the j coding stream,
Figure 151673DEST_PATH_IMAGE002
the forward reference frame is the encoding result of the non-key frame; and recombining the decoding results of the T +1 group according to the coding sequence of the continuous M coding results to obtain continuous M video frames corresponding to the continuous M coding results.
According to another aspect of the embodiments of the present invention, there is also provided a video encoding apparatus, including: a first dividing module, configured to divide M consecutive video frames to be encoded into T +1 groups of video frames, where M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of inter-frames when the M consecutive video frames are inter-frame encoded, an ith group of video frames in the T +1 groups of video frames includes video frames selected every T video frames from an ith video frame in the M consecutive video frames,
Figure DEST_PATH_IMAGE003
(ii) a A first processing module, configured to form a T + 1-channel video stream according to the T +1 group of video frames, where the T + 1-channel video stream includes the T +1 group of video frames; a first input module, configured to correspondingly input the T +1 channels of video streams to T +1 encoders respectively to obtain T +1 groups of encoding results, where when a jth encoder in the T +1 encoders encodes a jth channel of video streams in the T +1 channels of video streams, the jth encoder is configured to encode a non-key video frame with reference to a previous video frame of the non-key video frame in the jth channel of video streams,
Figure 673791DEST_PATH_IMAGE002
(ii) a And the first recombination module is used for recombining the coding results of the T +1 group according to the sequence of the frame numbers of the continuous M video frames to obtain the continuous M coding results corresponding to the continuous M video frames.
Optionally, the apparatus is further configured to determine, when a key video frame in the M consecutive video frames is a first video frame in the M consecutive video frames, a 1 st group of video frames in the T +1 group of video frames as a 1 st path of video stream in the T +1 path of video stream, and insert the first video frame into a start position of a T group of video frames, excluding the 1 st group of video frames, in the T +1 path of video frames, so as to obtain a T path of video stream, excluding the 1 st path of video stream, in the T +1 path of video stream.
Optionally, the apparatus is further configured to determine an encoding result corresponding to the 1 st video stream as a 1 st group of encoding results in the T +1 group of encoding results, and remove a first encoding result in the other groups of encoding results except for the 1 st group of encoding results in the T +1 group of encoding results to obtain a T group of encoding results, where the first encoding result is an encoding result of the key video frame in the T video streams; and recombining the 1 st group of coding results and the M coding results in the T group of coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
Optionally, the apparatus is further configured to, when a key video frame in the M consecutive video frames includes a plurality of video frames including a first video frame in the M consecutive video frames, perform an insertion operation on each video frame in the plurality of video frames, where the insertion operation is performed, each video frame in the plurality of video frames is referred to as a current video frame, and the insertion operation includes: inserting the current video frame into a corresponding position in a T group of video frames except a target group of video frames in the T +1 group of video frames, wherein the target group of video frames is a group of video frames containing the current video frame; and after the insertion operation is performed on the plurality of video frames, the T +1 path of video stream is formed.
Optionally, the apparatus is further configured to insert, when the current video frame is inserted into a current group of video frames in the T groups of video frames, the current video frame after a first adjacent video frame of the current group of video frames, where the first adjacent video frame is a video frame in the current group of video frames whose frame number order is before the current video frame and whose frame number order is closest to the frame number order of the current video frame; when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame before a second adjacent video frame of the current group of video frames, wherein the second adjacent video frame is a video frame in the current group of video frames, of which the frame number is sequentially after the current video frame and is sequentially nearest to the frame number of the current video frame.
Optionally, the apparatus is further configured to remove a current encoding result in a target group encoding result in the T +1 group encoding results to obtain M encoding results, where the target group encoding result is an encoding result of a target path video stream, the target path video stream is a video stream formed after the current video frame is inserted into a group of video frames, and the previous encoding result is an encoding result of the current video frame; and recombining the M coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
Optionally, the apparatus is further configured to correspondingly input the T +1 channels of video streams into T +1 hardware encoders, where when the hardware encoder encodes a non-key video frame in one channel of video streams, a hardware encoding circuit in the hardware encoder encodes the non-key video frame with reference to a previous video frame of the non-key video frame.
Optionally, the apparatus is further configured to acquire the M video frames from an original video stream according to a value M of a group of pictures GOP, where a first video frame of the M video frames is a key frame in the group of pictures.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding apparatus, including: a second dividing module, configured to divide M consecutive encoding results to be decoded into T +1 groups of encoding results, where M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents a number of frames during frame-crossing decoding of the M consecutive encoding results, an ith group of video frames in the T +1 groups of encoding includes encoding results selected every T encoding results from an ith encoding result in the M consecutive encoding results,
Figure 543658DEST_PATH_IMAGE003
(ii) a A second processing module, configured to form a T + 1-path coded stream according to the T + 1-group coding result, where the T + 1-path coded stream includes the T + 1-group coding result; a second input module, configured to correspondingly input the T +1 channels of encoded streams to T +1 decoders respectively to obtain T +1 groups of decoding results, where when a jth decoder in the T +1 decoders decodes a jth encoded stream in the T +1 channels of encoded streams, the jth decoder is configured to decode a current encoding result with reference to a previous encoding result in the jth encoded stream,
Figure 153630DEST_PATH_IMAGE002
(ii) a And the second recombination module is used for recombining the T +1 groups of decoding results according to the coding sequence of the continuous M coding results to obtain continuous M video frames corresponding to the continuous M coding results.
Optionally, the apparatus is further configured to determine, when an intra-frame coded frame in the M consecutive coding results is a first coding result in the M consecutive coding results, a 1 st group of coding results in the T +1 group of coding results as a 1 st path coded stream in the T +1 group of coding results, and insert the first coding result into a starting position in a T group of coding results, except the 1 st group of coding results, in the T +1 group of coding results, to obtain a T path coded stream, except the 1 st path coded stream, in the T +1 path of coding results, where the intra-frame coded frame is a coding result of a key frame.
Optionally, the apparatus is further configured to determine a decoding result corresponding to the 1 st encoded stream as a 1 st group decoding result in the T +1 group decoding results, and remove a first decoding result in other groups of decoding results except the 1 st group decoding result in the T +1 group decoding results to obtain T group decoding results; and recombining the M video frames in the 1 st group of decoding results and the T group of decoding results according to the coding sequence to obtain the continuous M video frames.
Optionally, the apparatus is further configured to, when an intra-frame coded frame in the M consecutive coding results includes multiple coding results including a first coding result in the M consecutive coding results, perform an insertion operation on each coding result in the multiple coding results, where the insertion operation is performed, each coding result in the multiple coding results is referred to as a current coding result, and the insertion operation includes: inserting the current coding result into a corresponding position in the T groups of coding results except a target group of coding results in the T +1 groups of coding results, wherein the target group of coding results is a group of coding results containing the current coding result; and after the insertion operation is executed on the plurality of coding results, the T +1 path of coding stream is formed.
Optionally, the apparatus is further configured to, when the current coding result is inserted into a current group of coding results in the T groups of coding results, insert the current coding result after a first neighboring coding result of the current group of coding results, where the first neighboring coding result is a coding result of the current group of coding results, where the coding order of the current group of coding results is before the current coding result and is closest to the coding order of the current coding result; when the current coding result is inserted into the current group of the T groups of coding results for coding, inserting the current coding result before a second adjacent coding result of the current group of coding results, wherein the second adjacent coding result is a coding result which is in the current group of coding results and has the coding sequence after the current coding result and is closest to the coding sequence of the current coding result.
Optionally, the apparatus is further configured to remove a current decoding result in a target group of decoding results in the T +1 group of decoding results to obtain M decoding results, where the target group of decoding results is a decoding result of a target-path encoded stream, the target-path encoded stream is an encoded stream formed after the current encoding result is inserted into a group of encoding results, and the current decoding result is a decoding result of the current encoding result; and recombining the M video frames in the M decoding results according to the coding sequence to obtain the continuous M video frames.
Optionally, the apparatus is further configured to correspondingly input the T +1 paths of encoded streams into T +1 hardware decoders, respectively, where when the hardware decoder decodes a forward reference frame in one path of encoded stream, a hardware decoding circuit in the hardware decoder decodes the forward reference frame with reference to a previous decoding result of the forward reference frame.
According to yet another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned video encoding or decoding method when running.
According to yet another aspect of embodiments herein, there is provided a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the video encoding or video decoding method as above.
According to still another aspect of the embodiments of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the above-mentioned video encoding or video decoding method by the computer program.
In the embodiment of the invention, continuous M videos are divided into T +1 groups of video frames, each group of video frames is coded through a coder, and when the coder codes a non-key frame in each group of video frames, the coder refers to a previous video frame of the non-key frame for coding. Because each group of video frames is selected every other T video frames in M video frames, the frame spanning number of the previous key frame and the non-key frame of the non-key frame is T, thereby realizing the frame spanning coding. In addition, the value of the cross-frame quantity T is set, so that the cross-frame quantity during cross-frame coding can be set at will. Therefore, the phenomenon of video blockage caused by the packet loss of video frames during video coding can be avoided, and the technical problem of video blockage caused by video coding is solved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a schematic diagram of an application environment of an alternative video encoding method according to an embodiment of the present invention;
FIG. 2 is a flow diagram of an alternative video encoding method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an alternative video encoding according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of another alternative video encoding according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of yet another alternative video encoding according to an embodiment of the present invention;
FIG. 6 is a flow chart of an alternative video decoding method according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of an alternative video decoding according to an embodiment of the present invention;
FIG. 8 is a schematic diagram of an alternative video decoding according to an embodiment of the present invention;
fig. 9 is a schematic structural diagram of an alternative video encoding apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an alternative video decoding apparatus according to an embodiment of the present invention;
FIG. 11 is a schematic diagram of an alternative electronic device according to an embodiment of the invention;
FIG. 12 is a block diagram of a computer system architecture for an alternative electronic device, according to an embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above 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 is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
According to an aspect of the embodiments of the present invention, there is provided a video encoding method, which may be applied, but not limited, to the application environment shown in fig. 1 as an optional implementation manner. The application environment comprises: user equipment 102, network 110, server 112, and an encoder. The user equipment comprises a memory, a processor and a display, wherein the memory is used for storing data including but not limited to video frames. The processor is configured to process data including, but not limited to, acquiring M consecutive video frames, and the display is configured to display the video frames.
Optionally, in this embodiment, the user equipment may be a terminal device configured with a target client, and may include, but is not limited to, at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), notebook computers, tablet computers, palm computers, MID (Mobile Internet Devices), PAD, desktop computers, smart televisions, etc. The target client may be a video client, an instant messaging client, a browser client, a game client, and the like.
Optionally, the network 110 may include, but is not limited to: a wired network, a wireless network, wherein the wired network comprises: a local area network, a metropolitan area network, and a wide area network, the wireless network comprising: bluetooth, WIFI, and other networks that enable wireless communication.
The server 112 may be a single server, a server cluster composed of a plurality of servers, or a cloud server. The server comprises a database and a processing engine, wherein the database is used for storing data including but not limited to storing video frames, and the processing engine is used for processing the video frames and includes but not limited to executing the following steps:
step S11, dividing M consecutive video frames to be encoded into T +1 groups of video frames, where M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of frames during frame-crossing encoding of the M consecutive video frames, an ith group of video frames in the T +1 groups of video frames includes video frames selected every T video frames from an ith video frame in the M consecutive video frames,
Figure 917187DEST_PATH_IMAGE001
step S12, forming a T +1 path video stream according to the T +1 group of video frames, wherein the T +1 path video stream includes the T +1 group of video frames;
step S13, correspondingly inputting the T +1 paths of video streams to T +1 encoders respectively, to obtain T +1 groups of encoding results, wherein when a jth encoder in the T +1 paths of video streams encodes a jth video stream in the T +1 paths of video streams, the jth encoder is configured to encode the non-key video frame with reference to a previous video frame of the non-key video frame in the jth video stream,
Figure 577582DEST_PATH_IMAGE002
and recombining the coding results of the T +1 group according to the sequence of the frame numbers of the continuous M video frames to obtain continuous M coding results corresponding to the continuous M video frames.
The encoder may be a hardware encoder including a hardware encoding circuit for encoding the current video frame with reference to the previous video frame.
The above is merely an example, and this is not limited in this embodiment.
The following explains the keywords involved in the present application:
and (3) interframe coding: when encoding a current video frame in a video stream, an encoding technique refers to a video frame preceding the current video frame for encoding.
Forward reference frame: the frame coded by the inter-frame coding technology with reference to the previous video frame is small in coding size, and a frame depending on forward reference is needed in decoding.
Intra-coded frame: also called intra picture (I frame), usually the first frame in a group of pictures (GoP), is an independent frame with all information, and in video coding, a frame coded by using an intra-coding technique does not need to be referred to a previous video frame, and can be independently decoded without referring to other frames.
Group of images (GoP): a set of consecutive pictures in a video stream is taken as a group of frames in video coding. Typically, the first frame encoded in a GoP is an I-frame and subsequent frames are forward reference frames (P-frames).
Optionally, as an optional implementation manner, as shown in fig. 2, the video encoding method includes:
step S202, dividing continuous M video frames to be coded into T +1 groups of video frames, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the continuous M video frames are subjected to cross frame coding, and the ith group of video frames in the T +1 groups of video frames comprises every other T video frames from the ith video frame in the continuous M video framesA video frame selected from the video frames is selected,
Figure 59379DEST_PATH_IMAGE001
the M consecutive video frames to be encoded may be M consecutive video frames in a group of pictures (GoP), M may be a common multiple of T +1, or may not be a common multiple of T +1, and specifically, the value of M may be determined according to actual situations, and may be, for example, 8, 10, 15, 20, and the like.
The following describes a specific embodiment of dividing M consecutive video frames into T +1 groups of video frames. Assuming that M =8 and T =1 as described above, the order of frame numbers of the consecutive 8 video frames is 1 to 8, the video frame having the order of frame number 1 is the 1 st video frame of the consecutive 8 video frames, the video frame having the order of frame number 2 is the 2 nd video frame of the consecutive 8 video frames, and so on, the video frame having the order of frame number 8 is the 8 th video frame of the consecutive 8 video frames.
Dividing 8 video frames into T +1=2 groups of video frames, wherein the 1 st group of video frames includes the following frame numbers in sequence: 1. 3, 5, 7 video frames (1 st, 3 rd, 5 th, 7 th video frames), the 2 nd group of video frames includes the sequence of frame numbers as: 2. video frames of 4, 6, 8 (2 nd, 4 th, 6 th, 8 th video frames).
The following describes a method for dividing M consecutive video frames into T +1 groups of video frames according to another embodiment. Assuming that M =8 and T =2 as described above, the order of frame numbers of the consecutive 8 video frames is 1 to 8, the video frame having the order of frame number 1 is the 1 st video frame of the consecutive 8 video frames, the video frame having the order of frame number 2 is the 2 nd video frame of the consecutive 8 video frames, and so on, the video frame having the order of frame number 8 is the 8 th video frame of the consecutive 8 video frames.
Dividing 8 video frames into T +1=3 groups of video frames, wherein the 1 st group of video frames includes the following frame numbers in sequence: 1. 4, 7 video frames (1 st, 4 th, 7 th video frames), the 2 nd group video frames including the sequence of frame numbers: 2. 5, 8 video frames (2 nd, 5 th, 8 th video frames, and the 3 rd group of video frames includes video frames with the frame number sequence of 3, 6 (3 rd, 6 th video frames).
Step S204, forming a T +1 path video stream according to the T +1 group of video frames, wherein the T +1 path video stream comprises the T +1 group of video frames;
in a group of pictures (GoP), the 1 st video frame is a key frame and the other video frames are non-key frames. There are also special cases where there are other key frames in addition to the next 1 st video frame in a group of pictures (GoP). For example, the 1 st video frame in the 8 consecutive video frames in the above embodiment is a key frame, and some video frames in the 2 nd to 8 th video frames may also be key frames, for example, the 4 th video frame is a key frame, or the 5 th video frame is a key frame, and so on. In this embodiment, for a group of video frames that do not include a key frame, the key frame may be inserted into the group of video frames to form a corresponding video stream, and the T +1 group of video frames forms a T +1 video stream.
As an example, taking M =8, T =1, and the 1 st video frame is a key frame, as shown in fig. 3, the 1 st key frame is inserted into the start position of the 2 nd group of video frames to obtain the 2 nd video stream (including the 1 st, 2 nd, 4 th, 6 th, and 8 th video frames), and the 1 st video stream includes the 1 st, 3 th, 5 th, and 7 th video frames.
Taking M =8, T =2, and the 1 st video frame is a key frame as an example, as shown in fig. 4, the 1 st key frame is inserted into the start positions of the 2 nd group of video frames and the 3 rd group of video frames to obtain the 2 nd path of video stream (including the 1 st, 2, 5, 8 th video frames) and the 3 rd path of video stream (including the 1 st, 3, 6 th video frames), where the 1 st path of video stream includes the 1 st, 4, 7 th video frames.
Step S206, correspondingly inputting the T +1 paths of video streams into T +1 encoders respectively to obtain a T +1 group of encoding results, wherein when a jth encoder in the T +1 encoders encodes a jth path of video stream in the T +1 paths of video streams, the jth encoder is used for encoding a non-key video frame by referring to a previous video frame of the non-key video frame in the jth path of video stream,
Figure 207464DEST_PATH_IMAGE002
the T +1 encoders may be hardware encoders, and the hardware encoders are configured to encode a current video frame with reference to a previous video frame. And respectively inputting each path of video stream into a corresponding encoder, and encoding the path of video stream through the corresponding encoder to obtain a group of encoding results.
Taking the above M =8 and T =1 as an example, as shown in fig. 3, the 1 st video stream is input to the encoder 1, the 2 nd video stream is input to the encoder 2, the 1 st video stream includes the 1 st, 3 rd, 5 th, and 7 th video frames, the encoder 1 uses the intra-frame coding technique to obtain the coding result of the 1 st video frame as an I frame when coding the 1 st video stream, codes the 3 rd video frame with reference to the coding result (I frame) of the previous 1 st video frame, and codes the 5 th video frame with reference to the coding result of the previous 3 rd video frame. The encoder 1 obtains a set of encoding results I, P2, P4, and P6, and the encoder 2 obtains a set of encoding results I, P1, P3, P5, and P7.
Taking the above-mentioned M =8 and T =2 as an example, as shown in fig. 4, the 1 st video stream is input to the encoder 1, the 2 nd video stream is input to the encoder 2, the 3 rd video stream is input to the encoder 3, the encoder 1 obtains a set of encoding results I, P3 and P6, and the encoder 2 obtains a set of encoding results I, P1, P4, and P7. The encoder 2 obtains a set of encoding results I, P2, P5.
Through the above embodiments, the purpose of encoding consecutive video frames across frames is thereby achieved. By changing the value of T, the number of encoded cross frames can be arbitrarily specified.
And S208, recombining the coding results of the T +1 groups according to the sequence of the frame numbers of the continuous M video frames to obtain continuous M coding results corresponding to the continuous M video frames.
The frame number sequence is the sequence of each video frame in M video frames, for example, the frame number sequence of consecutive 8 video frames in fig. 3 and 4 is 1 to 8, and each coding result in the T +1 group of coding results is recombined according to the frame number sequence to obtain M coding results. M coding results as shown in fig. 3 and 4: I. p1, P2, P3, P4, P5, P6 and P7.
Optionally, the forming the T +1 path video stream according to the T +1 group of video frames includes: when a key video frame in the M continuous video frames is a first video frame in the M continuous video frames, determining a 1 st group of video frames in the T +1 group of video frames as a 1 st path video stream in the T +1 path of video streams, and inserting the first video frame into a starting position in the T group of video frames except the 1 st group of video frames in the T +1 group of video frames to obtain the T path of video streams except the 1 st path of video streams in the T +1 path of video streams.
As an optional embodiment, assuming that M =8 and T =1, as shown in fig. 3, the order of frame numbers of consecutive 8 video frames is 1 to 8, and the 1 st video frame is a key frame, for example, as shown in fig. 3, the 1 st key frame is inserted into the start position of the 2 nd group of video frames to obtain the 2 nd video stream (the 2 nd video stream includes the 1 st, 2 nd, 4 th, 6 th, and 8 th video frames), and the 1 st video stream includes the 1 st, 3 th, 5 th, and 7 th video frames. The 1 st video stream is input to the encoder 1 shown in fig. 3, and the 2 nd video stream is input to the encoder 2 shown in fig. 3. The 1 st group of encoding results output by the encoder 1 are obtained, wherein the 1 st group of encoding results comprise I, P2, P4 and P6 shown in the figure, and the 2 nd group of encoding results output by the encoder 2 comprise I, P1, P3, P5 and P7 shown in the figure.
As another optional embodiment, assuming that M =8 and T =2 are mentioned above, the order of the frame numbers included in the 1 st group of video frames is: 1. 4, 7 video frames (1 st, 4 th, 7 th video frames), the 2 nd group video frames including the sequence of frame numbers: 2. 5, 8 video frames (2, 5, 8 video frames, the 3 rd group of video frames includes video frames with frame numbers in the order of 3, 6 (3, 6 video frames). the 1 st group of video frames is used as the 1 st video stream. the 1 st video frame is inserted into the starting position of the 2 nd group of video frames to obtain the 2 nd video stream (including the 1 st, 2, 5, 8 video frames). the 1 st video frame is inserted into the starting position of the 3 rd group of video frames to obtain the 3 rd video stream (including the 1 st, 3, 6 video frames). the 1 st video stream is input into the encoder 1 shown in fig. 4, the 2 nd video stream is input into the encoder 2 shown in fig. 4, the 3 rd video stream is input into the encoder 3 shown in fig. 4. the 1 st group of encoding results output by the encoder 1 is obtained, the 1 st group of encoding results includes I, P3 and P6 shown in the figure, and the 2 nd group of encoding results output by the encoder 2, wherein the 2 nd group of encoding results comprise I, P1, P4 and P7 shown in the figure, and the 3 rd group of encoding results comprise I, P2 and P5 shown in the figure.
Optionally, the recombining the T +1 groups of encoding results to obtain M consecutive encoding results corresponding to the M consecutive video frames includes: determining the coding result corresponding to the 1 st path of video stream as the 1 st group of coding result in the T +1 group of coding results, and removing the first coding result in the other groups of coding results except the 1 st group of coding results in the T +1 group of coding results to obtain T groups of coding results, wherein the first coding result is the coding result of the key video frame in the T path of video stream; and recombining the 1 st group of coding results and the M coding results in the T group of coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
As an alternative embodiment, taking M =8 and T =1 as an example, as shown in fig. 3, the encoding region 1 outputs a group of encoding results including I, P2, P4, and P6 shown in the figure, and the encoder 2 outputs a group of encoding results including I, P1, P3, P5, and P7 shown in the figure. The other encoding results are the encoding results output by the encoder 2, and I in the encoding results output by the encoder 2 is removed to obtain the encoding results P1, P3, P5 and P7. The group of coding results I, P2, P4, and P6 output by the encoder 1 are recombined in the coding order as the group 1 coding result and the group 2 coding results are P1, P3, P5, and P7, to obtain M coding results shown in fig. 3: I. p1, P2, P3, P4, P5, P6, P7. Each of the above M encoding results corresponds to a video frame of the M video frames, I is an encoding result of a 1 st video frame, P1 is an encoding result of a 2 nd video frame, P2 is an encoding result of a 3 rd video frame, and so on. In the application, the cross-frame coding of the video frame can be realized by changing the value T, and the video blocking phenomenon caused by the loss of the video frame in the prior art is avoided.
Optionally, the forming the T +1 path video stream according to the T +1 group of video frames includes: when a key video frame of the M consecutive video frames comprises a plurality of video frames including a first video frame of the M consecutive video frames, performing an insertion operation on each video frame of the plurality of video frames, wherein each video frame of the plurality of video frames is referred to as a current video frame, the insertion operation comprising: inserting the current video frame into a corresponding position in a T group of video frames except a target group of video frames in the T +1 group of video frames, wherein the target group of video frames is a group of video frames containing the current video frame; and after the insertion operation is performed on the plurality of video frames, the T +1 path of video stream is formed.
As an alternative embodiment, taking M =8 and T =1 as an example, assuming that key frames in consecutive 8 video frames are the 1 st video frame and the 4 th video frame, as shown in fig. 5, an insertion operation is performed on the 1 st video frame and the 4 th video frame.
When the insertion operation is performed on the 1 st video frame, the 1 st video frame is included in the 1 st group of video frames (including the 1 st, 3 rd, 5 th and 7 th video frames), and the 1 st group of video frames corresponds to the target group of video frames. The T group (T = 1) video frames except for the 1 st group video frame in the above T +1 group video frames (T =1, corresponding to 2 groups of video frames) are the 2 nd group video frames, and the 1 st video frame is inserted into the corresponding position of the 2 nd group video frame, as shown in fig. 5, the 1 st video frame is inserted into the start position of the 2 nd group video frame, resulting in the 2 nd path video stream shown in the figure.
When the insertion operation is performed on the 4 th video frame, the 4 th video frame is included in the 2 nd group of video frames (including the 2 nd, 4 th, 6 th and 8 th video frames), and the 2 nd group of video frames correspond to the target group of video frames. T group (T = 1) video frames other than the 2 nd group video frame among the above-mentioned T +1 group video frames (T =1, corresponding to 2 groups of video frames) are 1 st group video frames, and the 4 th video frame is inserted into a corresponding position of the 1 st group video frame, such as a position between the 3 rd video frame and the 5 th video frame among the 1 st group video frames shown in fig. 5. Thereby forming the 1 st video stream shown in fig. 5.
Optionally, the inserting the current video frame into a corresponding position in a T group of video frames except for a target group of video frames in the T +1 group of video frames includes: when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame after a first adjacent video frame of the current group of video frames, wherein the first adjacent video frame is a video frame in the current group of video frames, of which the frame number sequence is before the current video frame and is closest to the frame number sequence of the current video frame; or, when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame before a second adjacent video frame of the current group of video frames, where the second adjacent video frame is a video frame in the current group of video frames, where the frame number order is after the current video frame and is closest to the frame number order of the current video frame.
As an optional embodiment, in an example that the inserting operation is performed on the 4 th video frame with M =8 and T =1, the current group of video frames is the 1 st group of video frames, and the 1 st group of video frames includes: the video frames with frame numbers sequentially before the 4 th video frame comprise the 1 st and 3 rd video frames, wherein the video frame closest to the 4 th video frame is the 3 rd video frame (the first adjacent video frame), and the 4 th video frame is inserted after the 3 rd video frame.
As another optional embodiment, in the case that M =8 and T =1 are performed on the 4 th video frame, the current group of video frames is the 1 st group of video frames, and since the 1 st group of video frames includes: the video frames with frame numbers sequentially following the 4 th video frame comprise the 5 th and 7 th video frames, wherein the video frame closest to the 4 th video frame is the 5 th video frame (the second adjacent video frame), and the 4 th video frame is inserted before the 5 th video frame.
Through the above embodiment, 2 paths of video streams are obtained, wherein the 1 st path of video stream includes: the 1 st, 3 rd, 4 th, 5 th and 7 th video frames comprise: 1 st, 2 nd, 4 th, 6 th and 8 th video frames.
Optionally, the recombining the T +1 groups of encoding results to obtain M consecutive encoding results corresponding to the M consecutive video frames includes: removing a current coding result in a target group coding result in the T +1 group coding results to obtain M coding results, wherein the target group coding result is a coding result of a target path video stream, the target path video stream is a video stream formed after the current video frame is inserted into a group of video frames, and the previous coding result is a coding result of the current video frame; and recombining the M coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
As an alternative embodiment, taking M =8 and T =1 as shown in fig. 5 as an example, it is assumed that the key frames are the 1 st video frame and the 4 th video frame in the consecutive 8 video frames. The T +1 encoding results include a set of encoding results I1, P2, I2, P3, and P5 output by the encoder 1, and a set of encoding results output by the encoder 2: i1, P1, I2, P4 and P6.
The target group of encoding results includes a group of encoding results output by the encoder 1: i1, P2, I2, P3 and P5, wherein the group of coding results are the coding results of the 1 st path video stream (comprising the 1 st, 3 rd, 4 th, 5 th and 7 th video frames which correspond to the target path video stream), wherein the 1 st path video stream is a video stream formed by inserting the 4 th video frame (current video frame) into a group of video frames (the 1 st group of video frames comprises the 1 st, 3 th, 5 th and 7 th video frames), the current coding result is the coding result I2 of the 4 th video frame, and the I2 in the 1 st group of coding results is removed to obtain the coding results I1, P2, P3 and P5.
The target group of encoding results further includes a group of encoding results output by the encoder 2: i1, P1, I2, P4 and P6, wherein the group of encoding results are encoding results of a 2 nd video stream (comprising 1 st, 2 nd, 4 th, 6 th and 8 th video frames which correspond to a target video stream), wherein the 2 nd video stream is a video stream formed by inserting a 1 st video frame (current video frame) into a group of video frames (a 2 nd group of video frames comprising 2 nd, 4 th, 6 th and 8 th video frames), the current encoding result is an encoding result I1 of the 1 st video frame, I1 in the 2 nd group of encoding results is removed, and the encoding results P1, I2, P4 and P6 are obtained.
Thereby M coding results are obtained: i1, P2, P3, P5, P1, I2, P4 and P6 are recombined according to the sequence of frame numbers to obtain coding results I1, P1, P2, I2, P3, P4, P5 and P6.
Optionally, the correspondingly inputting the T +1 paths of video streams to T +1 encoders respectively to obtain T +1 groups of encoding results includes: and correspondingly inputting the T +1 paths of video streams into T +1 hardware encoders respectively, wherein when the hardware encoders encode non-key video frames in one path of video streams, a hardware encoding circuit in the hardware encoders encodes the non-key video frames by referring to a previous video frame of the non-key video frames.
As an optional implementation, the encoder is a hardware encoder, and when encoding a video frame, an encoding circuit in the hardware encoder encodes a current video frame with reference to an encoding result of a previous video frame. Taking the above 1 st video stream (including the hardware encoders to which the 1 st, 3 rd, 4 th, 5 th and 7 th video frames are input as an example, wherein the 1 st video frame is coded by using an intra-frame coding method to obtain coded I1, when the 3 rd video frame is coded, the I frame is referred to, when the 5 th video frame is coded, the coding result p2 of the 3 rd video frame is referred to, when the 4 th video frame is coded by using an intra-frame coding method to obtain coded I2, when the 5 th video frame is coded, the I2 is referred to.
Optionally, the M video frames are acquired from an original video stream according to a value M of a group of pictures GOP, where a first video frame of the M video frames is a key frame of the group of pictures.
As an alternative embodiment, a group of consecutive pictures in the video stream is taken as a group of frames in the video coding. Typically, the 1 st video frame in a GoP is a key frame, the encoded key frame is an I frame, and the subsequent frames are forward reference frames (P frames). In the above embodiment, in the case where the value of the GOP is 8, the 1 st video frame of the 8 consecutive video frames is a key frame.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding method, as shown in fig. 6, the video decoding method including the steps of:
step S302, dividing M continuous coding results to be decoded into T +1 groups of coding results, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous coding results are subjected to cross frame decoding, the ith group of video frames in the T +1 group of coding comprises the coding results selected every T coding results from the ith coding result in the M continuous coding results,
Figure 966472DEST_PATH_IMAGE001
the M encoding results are encoding results obtained by encoding M consecutive video frames, and in the embodiment of the encoding method, when M =8 and T =1 is the 1 st video frame in the M consecutive video frames, the encoding results I, P1, P2, P3, P4, P5, P6, and P7 obtained by encoding the 8 consecutive video frames, and in the embodiment of the encoding method, when M =8 and T =1 is the key frame, the encoding results I1, P1, P2, P3, I2, P4, P5, and P6 obtained by encoding the 8 consecutive video frames when the 1 st video frame and the 4 th video frame in the M consecutive video frames are the key frame.
Taking the above-mentioned M =8 and T =1, the division of the lines of the encoding results I, P1, P2, P3, P4, P5, P6, and P7 obtained by encoding the consecutive 8 video frames into T +1=2 groups of encoding results is taken as an example, and as shown in fig. 7, the obtaining of the 1 st group of encoding results includes: I. p2, P4, P6, second set of encoding results: p1, P3, P5, P7.
Taking the above-mentioned M =8 and T =1 as an example, the encoding results I1, P1, P2, I2, P3, P4, P5, and P6 obtained by encoding consecutive 8 video frames are divided into T +1=2 groups of encoding results, and the obtaining of the group 1 encoding result shown in fig. 8 includes: i1, P2, P3, P5, group 2 encoding results including: p1, I2, P4, P6.
Step S304, forming a T +1 path coding stream according to the T +1 group coding result, wherein the T +1 path coding stream comprises the T +1 group coding result;
for the intra-frame coding frames in the M consecutive coding results, as shown in I1 and I2 in the above embodiment, for one or more groups of coding results that do not include the intra-frame coding frame in the T +1 group of coding results, the intra-frame coding frames are inserted into corresponding positions of the one or more groups of coding results to obtain a T + 1-way coding stream, where the intra-frame coding frames are the coding results of the key frames in the original video stream.
Taking the coding results I1, P1, P2, I2, P3, P4, P5, and P6 shown in fig. 8 obtained by coding consecutive 8 video frames when M =8 and T =1 as examples, the I1 and I2 are intra-frame coding frames, and the group 1 coding result includes: i1, P2, P3, P5, group 2 encoding results including: p1, I2, P4, P6. For the intra-frame coded frames I1 and I2, if the group 1 coding result does not include the coding result I2, the coding result I2 is inserted into the corresponding position of the group 1 coding result, and specifically, the corresponding position may be determined according to the coding order, where the coding order is the coding order of coding 8 consecutive video frames, and the coding order of the 8 consecutive video frames is the coding order of coding 8 consecutive videos. Since I2 is the encoding result of the 4 th video frame in the above embodiment, inserting I2 between P2 and P3 (P2 is the encoding result of the 3 rd video frame, and P3 is the encoding result of the 5 th video frame) in the 1 st group of encoding results, the 4 th video frame being located between the 3 rd video frame and the 5 th video frame, thereby obtaining the 1 st encoded stream includes: i1, P2, I2, P3 and P5.
If the encoding result I1 is not included in the group 2 encoding result, the encoding result I1 is inserted into the corresponding position of the group 2 encoding result, and specifically the corresponding position may be determined according to the encoding order, since I1 is the encoding result of the 1 st video frame in the above embodiment, the inserting I1 into the start position of the group 1 encoding result, and the 1 st video frame is the start video frame, so as to obtain the 2 nd encoded stream includes: i1, P1, I2, P4 and P6.
Step S306, correspondingly outputting the T +1 paths of coded streamsInputting T +1 decoders to obtain a T +1 group of decoding results, wherein when a j-th decoder in the T +1 decoders decodes a j-th encoded stream in the T +1 encoded streams, the j-th decoder is used for decoding a forward reference frame by referring to a previous encoding result of the forward reference frame in the j-th encoded stream,
Figure 174600DEST_PATH_IMAGE002
the forward reference frame is the encoding result of the non-key frame;
the 1 st encoded stream and the 2 nd encoded stream are input to corresponding decoders, as shown in fig. 8, the 1 st encoded stream is input to the decoder 1, the 2 nd encoded stream is input to the decoder 2, the 1 st encoded stream (I1, P2, I2, P3, P5) is decoded by the decoder 1, the 2 nd encoded stream (I1, P1, I2, P4, P6) is decoded by the decoder 2, the intra-frame decoding is independently performed on the intra-frame encoded frames I1 and I2 at the time of decoding, and the previous encoding result is referred to for the forward reference frame, for example, P2, P3, P5 in the 1 st encoded stream (I1, P2, I2, P3, P5) are forward reference frames, the I1 is referred to at the time of decoding, the P1 is referred to the P1 at the time of decoding. Similarly, when decoding the 2 nd encoded stream (I1, P1, I2, P4, P6), P1 refers to I1, P4 refers to I2, and P6 refers to P4.
As shown in fig. 8, decoding the 1 st encoded stream by the decoder 1 to obtain a set of decoding results, includes: the 1 st, 3 rd, 4 th, 5 th, and 7 th video frames are decoded by the decoder 2 on the 2 nd encoded stream to obtain a set of decoding results, which includes: 1 st, 2 nd, 4 th, 6 th and 8 th video frames.
And step S308, recombining the decoding results of the T +1 group according to the coding sequence of the continuous M coding results to obtain continuous M video frames corresponding to the continuous M coding results.
The decoding results of the T +1 group are recombined according to the encoding sequence, and the M video frames shown in fig. 7 and 8 are the 1 st, 2 nd, 3 rd, 4 th, 5 th, 6 th, 7 th and 8 th video frames.
Optionally, the forming a T +1 path coded stream according to the T +1 group coding result includes: when the intra-frame coding frame in the M continuous coding results is the first coding result in the M continuous coding results, determining the 1 st group of coding results in the T +1 group of coding results as the 1 st path of coding stream in the T +1 group of coding results, and inserting the first coding result into the starting position of the T group of coding results except the 1 st group of coding results in the T +1 group of coding results to obtain the T path of coding stream except the 1 st path of coding stream in the T +1 path of coding results, wherein the intra-frame coding frame is the coding result of the key frame.
The intra-frame is the result of encoding a key frame in the original video stream, for example, I1 and I2 in the above embodiments, and is an intra-frame in a group of pictures, and the key frame is decoded by intra-frame decoding without referring to other video frames.
Taking M =8 and T =1 in the above embodiment as an example, the sequence of frame numbers of consecutive 8 video frames is 1 to 8, the 1 st video frame is a key frame, and the encoding result obtained by the encoding method in the above embodiment is: I. p1, P2, P3, P4, P6 and P7. The I frame in the encoding result is an intra-frame encoding frame, which is the first encoding result in M consecutive encodings. The group 1 encoding result as shown in fig. 7 includes: I. p2, P4, P6, second set of encoding results: p1, P3, P5, P7. Since the group 1 encoding result includes an intra-frame I, determining that the group 1 encoding result includes: I. p2, P4, and P6 are 1 st coded streams. Inserting the intra-frame coding frame I into the initial position of the 2 nd group of coding results to obtain the 2 nd path coding stream as follows: I. p1, P3, P5, P7.
Optionally, the recombining, according to the coding order of the consecutive M coding results, the T +1 group of decoding results to obtain consecutive M video frames corresponding to the consecutive M coding results includes: determining a decoding result corresponding to the 1 st path of coded stream as a 1 st group of decoding results in the T +1 group of decoding results, and removing a first decoding result in other groups of decoding results except the 1 st group of decoding results in the T +1 group of decoding results to obtain T groups of decoding results; and recombining the M video frames in the 1 st group of decoding results and the T group of decoding results according to the coding sequence to obtain the continuous M video frames.
As an optional implementation, as shown in fig. 7, the 1 st encoded stream is input into a decoder 1, the 2 nd encoded stream is input into a decoder 2, and the decoder 1 decodes the 1 st encoded stream to obtain a 1 st group of decoding results: 1. 3, 5, 7, the decoder 2 decodes the 2 nd path coding stream to obtain a group of decoding results: 1. 2, 4, 6, 8, removing the first decoding result 1 in the group of decoding results to obtain a group 2 decoding result: 2. 4, 6 and 8. And recombining 8 video frames in the 1 st group of decoding results and the 2 nd group of decoding results according to a coding sequence to obtain continuous M video frames: 1 st, 2 nd, 3 rd, 4 th, 5 th, 6 th, 7 th and 8 th video frames.
Optionally, the forming a T +1 path coded stream according to the T +1 group coding result includes: when an intra-frame coding frame in the M continuous coding results comprises a plurality of coding results including a first coding result in the M continuous coding results, performing an insertion operation on each coding result in the plurality of coding results, and when the insertion operation is performed, each coding result in the plurality of coding results is called a current coding result, wherein the insertion operation comprises: inserting the current coding result into a corresponding position in the T groups of coding results except a target group of coding results in the T +1 groups of coding results, wherein the target group of coding results is a group of coding results containing the current coding result; and after the insertion operation is executed on the plurality of coding results, the T +1 path of coding stream is formed.
As an optional embodiment, taking M =8 and T =1 as an example, and the 1 st video frame and the 4 th video frame in the 8 consecutive video frames are key frames, the obtained encoding result is: i1, P1, P2, I2, P3, P4, P5 and P6. The above-mentioned I1 and I2 are intra-coded frames, I1 is the 1 st coding result, and I2 is the 4 th coding result. The group 1 encoding result as shown in fig. 8 includes: i1, P2, P3, P5, group 2 encoding results including: p1, I2, P4, P6. The insertion operation is performed on each of the intra-coded frames I1 and I2 described above.
For the intra-frame I1, since it is the encoding result of the 1 st video frame of the M video frames, the encoding order is first, and I1 is inserted into the starting position in the 2 nd group of encoding results, the 2 nd encoded stream is obtained as: i1, P1, I2, P4 and P6.
For intra-coded frame I2, since it is the result of encoding the 4 th video frame of the M video frames, group 1 of the results of encoding includes: p2 and P3 in I1, P2, P3 and P5 are the encoding results of the 3 rd video frame and the 5 th video frame, respectively, so the encoding order of I2 is between P2 and P3, I2 is inserted between P2 and P3 in the 1 st group of encoding results, and the 1 st path of encoded stream is obtained as: i1, P2, I2, P3 and P5.
Optionally, the inserting the current encoding result into a corresponding position in the T group of encoding results except the target group of encoding results in the T +1 group of encoding results includes: when the current coding result is inserted into a current group coding result in the T groups of coding results, inserting the current coding result after a first adjacent coding result of the current group coding result, wherein the first adjacent coding result is a coding result which is in the current group coding result and has the coding sequence which is before the current coding result and is closest to the coding sequence of the current coding result; or, when the current coding result is inserted into a current group of the T groups of coding results, the current coding result is inserted before a second adjacent coding result of the current group of coding results, where the second adjacent coding result is a coding result that is after the current coding result and is closest to the coding order of the current coding result in the current group of coding results.
As an optional implementation manner, for the intra-coded frame I2 in the above embodiment, since it is the coding result of the 4 th video frame in the M video frames, the 1 st group of coding results includes: p2 and P3 in I1, P2, P3 and P5 are the encoding results of the 3 rd video frame and the 5 th video frame, respectively, wherein P2 is the first adjacent encoding result and P3 is the second adjacent encoding result. As shown in fig. 8, after I2 is inserted into P2, or before I2 is inserted into P3, the 1 st encoded stream is obtained as: i1, P2, I2, P3 and P5.
Optionally, the recombining, according to the coding order of the consecutive M coding results, the T +1 group of decoding results to obtain consecutive M video frames corresponding to the consecutive M coding results includes: removing a current decoding result in a target group of decoding results in the T +1 group of decoding results to obtain M decoding results, wherein the target group of decoding results is a decoding result of a target path coding stream, the target path coding stream is a coding stream formed by inserting the current coding result into a group of coding results, and the current decoding result is a decoding result of the current coding result; and recombining the M video frames in the M decoding results according to the coding sequence to obtain the continuous M video frames.
As an optional implementation manner, in the above embodiment, M =8, T =1, and the 1 st video frame and the 4 th video frame in the consecutive 8 video frames are the key frames as an example,
the coding result obtained by the coding method in the above embodiment is: i1, P1, P2, I2, P3, P4, P5 and P6. The 1 st encoded stream obtained by the above embodiment as shown in fig. 8 is: i1, P2, I2, P3 and P5, wherein the 2 nd path coded stream is: i1, P1, I2, P4 and P6. Inputting the 1 st path of coded stream into a decoder 1, inputting the 2 nd path of coded stream into a decoder 2, and decoding the 1 st path of coded stream by the decoder 1 to obtain a group of decoding results: 1. 3, 4, 5, 7, the decoder 2 decodes the 2 nd path coded stream to obtain a group of decoding results: 1. 2, 4, 6 and 8,
the group 1 decoding result (target group decoding result) is: 1. the codes 3, 4, 5 and 7 are decoding results of the 1 st coded stream (target coded stream) I1, P2, I2, P3 and P5, and the 1 st coded stream is a group of coding results (I1, P2, P3 and P5) with the I2 (current coding result) inserted therein, so that the decoding result of I2 (current decoding result: 4 th video frame) in the 1 st group of decoding results is removed to obtain a group of decoding results 1, 3, 5 and 7.
The group 2 decoding result (target group decoding result) is: 1. the 2 nd, 4 th, 6 th and 8 th coded streams (target coded streams) are decoding results of I1, P1, I2, P4 and P6, and the 2 nd coded stream is a group of coding results (P1, I2, P4 and P6) with I1 (current coding result) inserted therein, so that the decoding result of I1 (current decoding result: 1 st video frame) in the 2 nd group of decoding results is removed to obtain a group of decoding results 2, 4, 6 and 8.
Thereby obtaining M decoding results as shown in fig. 8, including M video frames (video frames corresponding to 1, 3, 5, 7 and 2, 4, 6, 8), and recombining the video frames corresponding to 1, 3, 5, 7 and 2, 4, 6, 8 according to the encoding order to obtain the 1 st, 2, 3, 4, 5, 6, 7, 8 th video frames.
Optionally, the correspondingly inputting the T +1 paths of encoded streams to T +1 decoders, respectively, to obtain T +1 groups of decoding results, includes: and correspondingly inputting the T +1 paths of coded streams into T +1 hardware decoders respectively, wherein when the hardware decoders decode forward reference frames in one path of coded streams, a hardware decoding circuit in the hardware decoders refers to a previous decoding result of the forward reference frames to decode the forward reference frames.
As an optional implementation manner, the decoder is a hardware decoder, the hardware decoder includes a hardware decoding circuit, and when the hardware decoding circuit decodes a forward reference frame in an encoded stream, the hardware decoding circuit decodes the forward reference frame with reference to a previous decoding result.
For example, in the above embodiment, the decoder 1 refers to the previous encoding result I1 when decoding the forward reference frame P2, refers to the previous encoding result I2 when decoding the forward reference frame P3, and refers to the previous encoding result P3 when decoding the forward reference frame P5, when decoding the 1 st encoded stream I1, P2, I2, P3, and P5. For the intra-frame coded frames I1 and I2 which are independent coded frames, the decoding process does not need to refer to other video frames, and the intra-frame decoding is adopted for decoding. By utilizing the existing encoder, the encoding code stream capable of supporting cross-frame reference is realized, the packet loss in network transmission is favorably resisted, the video blocking multiplexing existing encoder caused by the packet loss in the video transmission process is reduced, and the cross-frame reference can be realized without changing the bottom layer of the encoder.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
According to another aspect of the embodiments of the present invention, there is also provided a video encoding apparatus for implementing the above-described video encoding method. As shown in fig. 9, the apparatus includes: a first dividing module 92, configured to divide M consecutive video frames to be encoded into T +1 groups of video frames, where M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, and T represents the number of frames during frame-crossing encoding of the M consecutive video frames, an ith group of video frames in the T +1 groups of video frames includes video frames selected every T video frames from an ith video frame in the M consecutive video frames,
Figure 268327DEST_PATH_IMAGE001
(ii) a A first processing module 94, configured to form a T + 1-path video stream according to the T +1 group of video frames, where the T + 1-path video stream includes the T +1 group of video frames; a first input module 96, configured to correspondingly input the T +1 channels of video streams to T +1 encoders respectively to obtain T +1 groups of encoding results, where when a jth encoder in the T +1 encoders encodes a jth channel of video streams in the T +1 channels of video streams, the jth encoder is configured to encode a non-key video frame with reference to a previous video frame of the non-key video frame in the jth channel of video streams,
Figure 954523DEST_PATH_IMAGE004
(ii) a A first re-grouping module 98, configured to perform coding on the T +1 groups of coding results according to the sequence of the frame numbers of the consecutive M video framesAnd carrying out recombination to obtain continuous M encoding results corresponding to the continuous M video frames.
Optionally, the apparatus is further configured to determine, when a key video frame in the M consecutive video frames is a first video frame in the M consecutive video frames, a 1 st group of video frames in the T +1 group of video frames as a 1 st path of video stream in the T +1 path of video stream, and insert the first video frame into a start position of a T group of video frames, excluding the 1 st group of video frames, in the T +1 path of video frames, so as to obtain a T path of video stream, excluding the 1 st path of video stream, in the T +1 path of video stream.
Optionally, the apparatus is further configured to determine an encoding result corresponding to the 1 st video stream as a 1 st group of encoding results in the T +1 group of encoding results, and remove a first encoding result in the other groups of encoding results except for the 1 st group of encoding results in the T +1 group of encoding results to obtain a T group of encoding results, where the first encoding result is an encoding result of the key video frame in the T video streams; and recombining the 1 st group of coding results and the M coding results in the T group of coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
Optionally, the apparatus is further configured to, when a key video frame in the M consecutive video frames includes a plurality of video frames including a first video frame in the M consecutive video frames, perform an insertion operation on each video frame in the plurality of video frames, where the insertion operation is performed, each video frame in the plurality of video frames is referred to as a current video frame, and the insertion operation includes: inserting the current video frame into a corresponding position in a T group of video frames except a target group of video frames in the T +1 group of video frames, wherein the target group of video frames is a group of video frames containing the current video frame; and after the insertion operation is performed on the plurality of video frames, the T +1 path of video stream is formed.
Optionally, the apparatus is further configured to insert, when the current video frame is inserted into a current group of video frames in the T groups of video frames, the current video frame after a first adjacent video frame of the current group of video frames, where the first adjacent video frame is a video frame in the current group of video frames whose frame number order is before the current video frame and whose frame number order is closest to the frame number order of the current video frame; when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame before a second adjacent video frame of the current group of video frames, wherein the second adjacent video frame is a video frame in the current group of video frames, of which the frame number is sequentially after the current video frame and is sequentially nearest to the frame number of the current video frame.
Optionally, the apparatus is further configured to remove a current encoding result in a target group encoding result in the T +1 group encoding results to obtain M encoding results, where the target group encoding result is an encoding result of a target path video stream, the target path video stream is a video stream formed after the current video frame is inserted into a group of video frames, and the previous encoding result is an encoding result of the current video frame; and recombining the M coding results according to the sequence of the frame numbers to obtain the continuous M coding results.
Optionally, the apparatus is further configured to correspondingly input the T +1 channels of video streams into T +1 hardware encoders, where when the hardware encoder encodes a non-key video frame in one channel of video streams, a hardware encoding circuit in the hardware encoder encodes the non-key video frame with reference to a previous video frame of the non-key video frame.
Optionally, the apparatus is further configured to acquire the M video frames from an original video stream according to a value M of a group of pictures GOP, where a first video frame of the M video frames is a key frame in the group of pictures.
According to another aspect of the embodiments of the present invention, there is also provided a video decoding apparatus for implementing the above video decoding method. As shown in fig. 10, the apparatus includes: a second dividing module 102, configured to divide M consecutive encoding results to be decoded into T +1 groups of encoding results, where M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, and T represents that M consecutive encoding results are being codedThe number of cross frames when the coding result is subjected to cross frame decoding, wherein the ith group of video frames in the T +1 group of codes comprises coding results selected every T coding results from the ith coding result in the continuous M coding results,
Figure 958251DEST_PATH_IMAGE001
(ii) a A second processing module 104, configured to form a T + 1-path coded stream according to the T + 1-group coding result, where the T + 1-path coded stream includes the T + 1-group coding result; a second input module 106, configured to correspondingly input the T +1 paths of encoded streams to T +1 decoders respectively to obtain T +1 groups of decoding results, where when a jth decoder in the T +1 paths of encoded streams decodes a jth encoded stream in the T +1 paths of encoded streams, the jth decoder is configured to decode a current encoding result with reference to a previous encoding result in the jth encoded stream,
Figure 478225DEST_PATH_IMAGE004
(ii) a And a second recombining module 108, configured to recombine the T +1 groups of decoding results according to the coding order of the consecutive M coding results, so as to obtain consecutive M video frames corresponding to the consecutive M coding results.
Optionally, the apparatus is further configured to determine, when an intra-frame coded frame in the M consecutive coding results is a first coding result in the M consecutive coding results, a 1 st group of coding results in the T +1 group of coding results as a 1 st path coded stream in the T +1 group of coding results, and insert the first coding result into a starting position in a T group of coding results, except the 1 st group of coding results, in the T +1 group of coding results, to obtain a T path coded stream, except the 1 st path coded stream, in the T +1 path of coding results, where the intra-frame coded frame is a coding result of a key frame.
Optionally, the apparatus is further configured to determine a decoding result corresponding to the 1 st encoded stream as a 1 st group decoding result in the T +1 group decoding results, and remove a first decoding result in other groups of decoding results except the 1 st group decoding result in the T +1 group decoding results to obtain T group decoding results; and recombining the M video frames in the 1 st group of decoding results and the T group of decoding results according to the coding sequence to obtain the continuous M video frames.
Optionally, the apparatus is further configured to, when an intra-frame coded frame in the M consecutive coding results includes multiple coding results including a first coding result in the M consecutive coding results, perform an insertion operation on each coding result in the multiple coding results, where the insertion operation is performed, each coding result in the multiple coding results is referred to as a current coding result, and the insertion operation includes: inserting the current coding result into a corresponding position in the T groups of coding results except a target group of coding results in the T +1 groups of coding results, wherein the target group of coding results is a group of coding results containing the current coding result; and after the insertion operation is executed on the plurality of coding results, the T +1 path of coding stream is formed.
Optionally, the apparatus is further configured to, when the current coding result is inserted into a current group of coding results in the T groups of coding results, insert the current coding result after a first neighboring coding result of the current group of coding results, where the first neighboring coding result is a coding result of the current group of coding results, where the coding order of the current group of coding results is before the current coding result and is closest to the coding order of the current coding result; when the current coding result is inserted into the current group of the T groups of coding results for coding, inserting the current coding result before a second adjacent coding result of the current group of coding results, wherein the second adjacent coding result is a coding result which is in the current group of coding results and has the coding sequence after the current coding result and is closest to the coding sequence of the current coding result.
Optionally, the apparatus is further configured to remove a current decoding result in a target group of decoding results in the T +1 group of decoding results to obtain M decoding results, where the target group of decoding results is a decoding result of a target-path encoded stream, the target-path encoded stream is an encoded stream formed after the current encoding result is inserted into a group of encoding results, and the current decoding result is a decoding result of the current encoding result; and recombining the M video frames in the M decoding results according to the coding sequence to obtain the continuous M video frames.
Optionally, the apparatus is further configured to correspondingly input the T +1 paths of encoded streams into T +1 hardware decoders, respectively, where when the hardware decoder decodes a forward reference frame in one path of encoded stream, a hardware decoding circuit in the hardware decoder decodes the forward reference frame with reference to a previous decoding result of the forward reference frame.
According to another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the video encoding method, where the electronic device may be a terminal device or a server shown in fig. 1. The present embodiment takes the electronic device as a server as an example for explanation. As shown in fig. 11, the electronic device comprises a memory 1102 and a processor 1104, wherein the memory 1102 stores a computer program and the processor 1104 is arranged to execute the steps of any of the above method embodiments by means of the computer program.
Optionally, in this embodiment, the electronic device may be located in at least one network device of a plurality of network devices of a computer network.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, dividing M continuous video frames to be coded into T +1 groups of video frames, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous video frames are subjected to cross frame coding, the ith group of video frames in the T +1 groups of video frames comprises video frames selected every T video frames from the ith video frame in the M continuous video frames,
Figure 669035DEST_PATH_IMAGE005
s2, forming a T +1 path video stream according to the T +1 group of video frames, wherein the T +1 path video stream comprises the T +1 group of video frames;
s3, correspondingly inputting the T +1 paths of video streams to T +1 encoders respectively to obtain a T +1 group of encoding results, wherein, when the j-th encoder in the T +1 paths of video streams encodes the j-th path of video stream in the T +1 paths of video streams, the j-th encoder is used for encoding the non-key video frame by referring to the previous video frame of the non-key video frame in the j-th path of video stream,
Figure 158922DEST_PATH_IMAGE002
s4, according to the sequence of the frame numbers of the continuous M video frames, the coding results of the T +1 group are recombined to obtain the continuous M coding results corresponding to the continuous M video frames.
The processor may be further configured to perform the following steps by the computer program:
s1, dividing M continuous coding results to be decoded into T +1 groups of coding results, M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous coding results are subjected to cross frame decoding, the ith group of video frames in the T +1 group of coding comprises the coding results selected every T coding results from the ith coding result in the M continuous coding results,
Figure 377676DEST_PATH_IMAGE001
s2, forming a T +1 path coding stream according to the T +1 group coding result, wherein the T +1 path coding stream comprises the T +1 group coding result;
s3, correspondingly inputting the T +1 paths of coded streams into T +1 decoders respectively to obtain T +1 groups of decoding results, wherein, when the j-th decoder in the T +1 paths of coded streams decodes the j-th coded stream in the T +1 paths of coded streams, the j-th decoder is used for decoding the forward reference frame by referring to the previous coding result of the forward reference frame in the j-th coded stream,
Figure 927606DEST_PATH_IMAGE002
the forward reference frame is the encoding result of the non-key frame;
s4, according to the coding sequence of the continuous M coding results, the T +1 group decoding results are recombined to obtain continuous M video frames corresponding to the continuous M coding results.
Alternatively, it can be understood by those skilled in the art that the structure shown in fig. 11 is only an illustration, and the electronic device may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 11 is a diagram illustrating a structure of the electronic device. For example, the electronics may also include more or fewer components (e.g., network interfaces, etc.) than shown in FIG. 11, or have a different configuration than shown in FIG. 11.
The memory 1102 may be used to store software programs and modules, such as program instructions/modules corresponding to the video encoding method and apparatus in the embodiments of the present invention, and the processor 1104 executes various functional applications and data processing by operating the software programs and modules stored in the memory 1102, so as to implement the video encoding method described above. The memory 1102 may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 1102 can further include memory located remotely from the processor 1104 and such remote memory can be coupled to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof. The memory 1102 may be, but is not limited to, specifically configured to store information such as video frames. As an example, as shown in fig. 11, the memory 1102 may include, but is not limited to, a first dividing module 902, a first processing module 904, a first input module 906, and a first re-assembling module 908 of the video encoding apparatus. In addition, the video encoding apparatus may further include, but is not limited to, other module units in the video encoding apparatus, which is not described in this example again.
Optionally, the transmitting device 1106 is used for receiving or transmitting data via a network. Examples of the network may include a wired network and a wireless network. In one example, the transmission device 1106 includes a Network adapter (NIC) that can be connected to a router via a Network cable to communicate with the internet or a local area Network. In one example, the transmission device 1106 is a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In addition, the electronic device further includes: a display 1108 for displaying the video frames; and a connection bus 1110 for connecting the respective module components in the above-described electronic apparatus.
In other embodiments, the terminal device or the server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting a plurality of nodes through a network communication. Nodes can form a Peer-To-Peer (P2P, Peer To Peer) network, and any type of computing device, such as a server, a terminal, and other electronic devices, can become a node in the blockchain system by joining the Peer-To-Peer network.
According to an aspect of the application, there is provided a computer program product comprising a computer program/instructions containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. When executed by the central processing unit 1201, the computer program performs various functions provided by the embodiments of the present application.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Fig. 12 schematically shows a block diagram of a computer system of an electronic device for implementing an embodiment of the present application.
It should be noted that the computer system 1200 of the electronic device shown in fig. 12 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 12, the computer system 1200 includes a Central Processing Unit 1201 (CPU), which can perform various appropriate actions and processes according to a program stored in a Read-Only Memory 1202 (ROM) or a program loaded from a storage section 1208 into a Random Access Memory 1203 (RAM). In the random access memory 1203, various programs and data necessary for system operation are also stored. The cpu 1201, the rom 1202, and the ram 1203 are connected to each other by a bus 1204. An Input/Output interface 1205 (Input/Output interface, i.e., I/O interface) is also connected to the bus 1204.
The following components are connected to the input/output interface 1205: an input section 1206 including a keyboard, a mouse, and the like; an output section 1207 including a Display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 1208 including a hard disk and the like; and a communication section 1209 including a network interface card such as a local area network card, a modem, or the like. The communication section 1209 performs communication processing via a network such as the internet. The driver 1210 is also connected to the input/output interface 1205 as necessary. A removable medium 1211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like, is mounted on the drive 1210 as necessary, so that a computer program read out therefrom is mounted into the storage section 1208 as necessary.
In particular, according to embodiments of the present application, the processes described in the various method flowcharts may be implemented as computer software programs. For example, embodiments of the present application include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 1209, and/or installed from the removable medium 1211. The computer program, when executed by the central processing unit 1201, performs various functions defined in the system of the present application.
According to an aspect of the present application, there is provided a computer-readable storage medium from which a processor of a computer device reads computer instructions, the processor executing the computer instructions to cause the computer device to perform the method provided in the above-mentioned various alternative implementations.
Alternatively, in the present embodiment, the above-mentioned computer-readable storage medium may be configured to store a computer program for executing the steps of:
s1, dividing M continuous video frames to be coded into T +1 groups of video frames, wherein M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous video frames are subjected to cross frame coding, the ith group of video frames in the T +1 groups of video frames comprises video frames selected every T video frames from the ith video frame in the M continuous video frames,
Figure 746658DEST_PATH_IMAGE005
s2, forming a T +1 path video stream according to the T +1 group of video frames, wherein the T +1 path video stream comprises the T +1 group of video frames;
s3, correspondingly inputting the T +1 paths of video streams to T +1 encoders respectively to obtain a T +1 group of encoding results, wherein, when the j-th encoder in the T +1 paths of video streams encodes the j-th path of video stream in the T +1 paths of video streams, the j-th encoder is used for encoding the non-key video frame by referring to the previous video frame of the non-key video frame in the j-th path of video stream,
Figure 305815DEST_PATH_IMAGE002
s4, according to the sequence of the frame numbers of the continuous M video frames, the coding results of the T +1 group are recombined to obtain the continuous M coding results corresponding to the continuous M video frames.
The computer-readable storage medium described above may also be arranged to store a computer program for performing the steps of:
s1, dividing M continuous coding results to be decoded into T +1 groups of coding results, M is an integer greater than or equal to 2, T is an integer greater than or equal to 1, T represents the number of cross frames when the M continuous coding results are subjected to cross frame decoding, the ith group of video frames in the T +1 group of coding comprises the coding results selected every T coding results from the ith coding result in the M continuous coding results,
Figure 143190DEST_PATH_IMAGE001
s2, forming a T +1 path coding stream according to the T +1 group coding result, wherein the T +1 path coding stream comprises the T +1 group coding result;
s3, correspondingly inputting the T +1 paths of coded streams into T +1 decoders respectively to obtain T +1 groups of decoding results, wherein, when the j-th decoder in the T +1 paths of coded streams decodes the j-th coded stream in the T +1 paths of coded streams, the j-th decoder is used for decoding the forward reference frame by referring to the previous coding result of the forward reference frame in the j-th coded stream,
Figure 598442DEST_PATH_IMAGE002
the forward reference frame is the encoding result of the non-key frame;
s4, according to the coding sequence of the continuous M coding results, the T +1 group decoding results are recombined to obtain continuous M video frames corresponding to the continuous M coding results. Alternatively, in this embodiment, a person skilled in the art may understand that all or part of the steps in the methods of the foregoing embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
The integrated unit in the above embodiments, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in the above computer-readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing one or more computer devices (which may be personal computers, servers, network devices, etc.) to execute all or part of the steps of the method according to the embodiments of the present invention.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the several embodiments provided in the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (12)

1. A video encoding method, comprising:
dividing continuous M video frames to be coded into T +1 groups of video frames, wherein M is an integer larger than 2, T is an integer larger than 1, T represents the number of cross frames when the continuous M video frames are subjected to cross frame coding, the ith group of video frames in the T +1 groups of video frames comprises video frames selected every T video frames from the ith video frame in the continuous M video frames,
Figure DEST_PATH_IMAGE002
acquiring the M video frames in the original video stream according to the value M of the GOP (group of pictures);
when a key video frame in the M continuous video frames comprises a plurality of video frames including a first video frame in the M continuous video frames, performing an insertion operation on each video frame of the plurality of video frames to form a T +1 path video stream, wherein the T +1 path video stream comprises the T +1 group of video frames;
correspondingly inputting the T +1 paths of video streams into T +1 encoders respectively to obtain a T +1 group of encoding results, wherein when a jth encoder in the T +1 encoders encodes a jth path of video streams in the T +1 paths of video streams, the jth encoder is used for encoding a non-key video frame by referring to a previous video frame of the non-key video frame in the jth path of video streams,
Figure DEST_PATH_IMAGE004
removing a current coding result in a target group coding result in the T +1 group coding results to obtain M coding results, wherein the target group coding result is a coding result of a target path video stream, the target path video stream is a video stream formed after a current video frame is inserted into a group of video frames, the current coding result is a coding result of the current video frame, and the current video frame is a video frame currently executing an insertion operation;
and recombining the M coding results according to the sequence of the frame numbers to obtain continuous M coding results.
2. The method according to claim 1, wherein said performing an insertion operation on each video frame of said plurality of video frames when said key video frame of said M consecutive video frames comprises a plurality of video frames including a first video frame of said M consecutive video frames, forms a T + 1-way video stream, comprising:
performing the insert operation on each video frame of the plurality of video frames, each video frame of the plurality of video frames being referred to as the current video frame when the insert operation is performed, the insert operation comprising:
inserting the current video frame into a corresponding position in a T group of video frames except a target group of video frames in the T +1 group of video frames, wherein the target group of video frames is a group of video frames containing the current video frame;
and after the insertion operation is performed on the plurality of video frames, the T +1 path of video stream is formed.
3. The method of claim 2, wherein said inserting the current video frame into a corresponding position in a T group video frame other than a target group video frame in the T +1 group video frames comprises:
when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame after a first adjacent video frame of the current group of video frames, wherein the first adjacent video frame is a video frame in the current group of video frames, of which the frame number sequence is before the current video frame and is closest to the frame number sequence of the current video frame; alternatively, the first and second electrodes may be,
when the current video frame is inserted into a current group of video frames in the T groups of video frames, inserting the current video frame before a second adjacent video frame of the current group of video frames, wherein the second adjacent video frame is a video frame in the current group of video frames, of which the frame number is sequentially after the current video frame and is sequentially nearest to the frame number of the current video frame.
4. The method according to claim 1, wherein the inputting the T +1 video streams to T +1 encoders respectively and correspondingly obtains T +1 groups of encoding results, includes:
and correspondingly inputting the T +1 paths of video streams into T +1 hardware encoders respectively, wherein when the hardware encoders encode non-key video frames in one path of video streams, a hardware encoding circuit in the hardware encoders encodes the non-key video frames by referring to a previous video frame of the non-key video frames.
5. A video decoding method, comprising:
dividing M continuous coding results to be decoded into T +1 groups of coding results, wherein M is an integer larger than 2, T is an integer larger than 1, T represents the number of cross frames when the M continuous coding results are subjected to cross frame decoding, the ith group of coding results in the T +1 groups of coding results comprises coding results selected every T coding results from the ith coding result in the M continuous coding results,
Figure DEST_PATH_IMAGE002A
the M consecutive codes to be decoded are M coding results obtained by coding M consecutive video frames, the M consecutive viewsThe frequency frame is obtained from the original video stream according to the value M of the GOP (group of pictures);
when an intra-frame coding frame in the M continuous coding results comprises a plurality of coding results including a first coding result in the M continuous codes, performing an insertion operation on each coding result in the plurality of coding results to form a T +1 path coding stream, wherein the T +1 path coding stream comprises the T +1 group of coding results, and the intra-frame coding frame is a coding result of a key frame;
correspondingly inputting the T +1 paths of coded streams into T +1 decoders respectively to obtain T +1 groups of decoding results, wherein when a j-th decoder in the T +1 decoders decodes a j-th path of coded streams in the T +1 paths of coded streams, the j-th decoder is used for decoding a forward reference frame by referring to a previous coding result of the forward reference frame in the j-th path of coded streams,
Figure DEST_PATH_IMAGE004A
the forward reference frame is the encoding result of the non-key frame;
removing a current decoding result in a target group of decoding results in the T +1 group of decoding results to obtain M decoding results, wherein the target group of decoding results is a decoding result of a target path coded stream, the target path coded stream is a coded stream formed after a current coding result is inserted into a group of coding results, the current coding result is a coding result of currently executed insertion operation, and the current decoding result is a decoding result of the current coding result;
and recombining the M video frames in the M decoding results according to a coding sequence to obtain the continuous M video frames.
6. The method according to claim 5, wherein when the intra-frame coded frame of the M consecutive coding results includes a plurality of coding results including a first coding result of the M consecutive coding results, performing an insertion operation on each coding result of the plurality of coding results to form a T + 1-way coded stream, comprising:
performing the insert operation on each of the plurality of encoding results, each of the plurality of encodings being referred to as the current encoding result when the insert operation is performed, the insert operation comprising:
inserting the current coding result into a corresponding position in the T groups of coding results except a target group of coding results in the T +1 groups of coding results, wherein the target group of coding results is a group of coding results containing the current coding result;
and after the insertion operation is executed on the plurality of coding results, the T +1 path of coding stream is formed.
7. The method of claim 6, wherein the inserting the current encoding result into the corresponding position in the T group of encoding results except the target group of encoding results in the T +1 group of encoding results comprises:
when the current coding result is inserted into a current group coding result in the T groups of coding results, inserting the current coding result after a first adjacent coding result of the current group coding result, wherein the first adjacent coding result is a coding result which is in the current group coding result and has the coding sequence which is before the current coding result and is closest to the coding sequence of the current coding result; alternatively, the first and second electrodes may be,
when the current coding result is inserted into the current group of the T groups of coding results for coding, inserting the current coding result before a second adjacent coding result of the current group of coding results, wherein the second adjacent coding result is a coding result which is in the current group of coding results and has the coding sequence after the current coding result and is closest to the coding sequence of the current coding result.
8. The method according to claim 5, wherein the inputting the T +1 encoded streams to T +1 decoders respectively and correspondingly obtains T +1 group decoding results, including:
and correspondingly inputting the T +1 paths of coded streams into T +1 hardware decoders respectively, wherein when the hardware decoders decode forward reference frames in one path of coded streams, a hardware decoding circuit in the hardware decoders decodes the forward reference frames by referring to the previous coding results of the forward reference frames.
9. A video encoding apparatus, comprising:
a first dividing module, configured to divide M consecutive video frames to be encoded into T +1 groups of video frames, where M is an integer greater than 2, T is an integer greater than 1, T represents a number of frames during frame-crossing encoding of the M consecutive video frames, an ith group of video frames in the T +1 groups of video frames includes video frames selected every T video frames from an ith video frame in the M consecutive video frames,
Figure DEST_PATH_IMAGE005
acquiring the M video frames in the original video stream according to the value M of the GOP (group of pictures);
a first processing module, configured to, when a key video frame in the M consecutive video frames includes a plurality of video frames including a first video frame in the M consecutive video frames, perform an insertion operation on each video frame of the plurality of video frames to form a T + 1-way video stream, where the T + 1-way video stream includes the T +1 group of video frames;
a first input module, configured to correspondingly input the T +1 channels of video streams to T +1 encoders respectively to obtain T +1 groups of encoding results, where when a jth encoder in the T +1 encoders encodes a jth channel of video streams in the T +1 channels of video streams, the jth encoder is configured to encode a non-key video frame with reference to a previous video frame of the non-key video frame in the jth channel of video streams,
Figure DEST_PATH_IMAGE006
a first recombination module, configured to remove a current coding result in a target group coding result in the T +1 group coding results to obtain M coding results, where the target group coding result is a coding result of a target path video stream, the target path video stream is a video stream formed after a current video frame is inserted into a group of video frames, the current coding result is a coding result of the current video frame, and the current video frame is a video frame currently performing an insertion operation; and recombining the M coding results according to the sequence of the frame numbers to obtain continuous M coding results.
10. A video decoding apparatus, comprising:
a second dividing module, configured to divide M consecutive encoding results to be decoded into T +1 groups of encoding results, where M is an integer greater than 2, T is an integer greater than 1, T represents a frame-crossing number when performing frame-crossing decoding on the M consecutive encoding results, an ith group of encoding results in the T +1 groups of encoding results includes encoding results selected every T encoding results from an ith encoding result in the M consecutive encoding results,
Figure DEST_PATH_IMAGE007
the M continuous codes to be decoded are M coding results obtained by coding M continuous video frames, and the M continuous video frames are obtained from an original video stream according to the value M of a group of pictures (GOP);
a second processing module, configured to, when an intra-frame coding frame in the M consecutive coding results includes multiple coding results including a first coding result in the M consecutive codes, perform an insertion operation on each coding result in the multiple coding results to form a T + 1-way coding stream, where the T + 1-way coding stream includes the T +1 group of coding results, and the intra-frame coding frame is a coding result of a key frame;
a second input module, configured to correspondingly input the T +1 paths of encoded streams to T +1 decoders, respectively, to obtain T +1 group decoding results, where a jth decoder in the T +1 decodersWhen the decoder decodes the jth encoded stream in the T + 1-th encoded stream, the jth decoder is configured to decode the forward reference frame with reference to a previous encoding result of the forward reference frame in the jth encoded stream,
Figure DEST_PATH_IMAGE008
the forward reference frame is the encoding result of the non-key frame;
a second reassembly module, configured to remove a current decoding result in a target group decoding result in the T +1 group decoding results to obtain M decoding results, where the target group decoding result is a decoding result of a target path coded stream, the target path coded stream is a coded stream formed after a current coding result is inserted into a group of coding results, the current coding result is a coding result of a currently executed insertion operation, and the current decoding result is a decoding result of the current coding result; and recombining the M video frames in the M decoding results according to a coding sequence to obtain the continuous M video frames.
11. A computer-readable storage medium, comprising a stored program, wherein the program when executed performs the method of any one of claims 1 to 4 or 5 to 8.
12. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program and the processor is arranged to execute the method of any of claims 1 to 4 or 5 to 8 by means of the computer program.
CN202111330536.6A 2021-11-11 2021-11-11 Video encoding method and apparatus, storage medium, and electronic device Active CN113784123B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111330536.6A CN113784123B (en) 2021-11-11 2021-11-11 Video encoding method and apparatus, storage medium, and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111330536.6A CN113784123B (en) 2021-11-11 2021-11-11 Video encoding method and apparatus, storage medium, and electronic device

Publications (2)

Publication Number Publication Date
CN113784123A CN113784123A (en) 2021-12-10
CN113784123B true CN113784123B (en) 2022-03-15

Family

ID=78873795

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111330536.6A Active CN113784123B (en) 2021-11-11 2021-11-11 Video encoding method and apparatus, storage medium, and electronic device

Country Status (1)

Country Link
CN (1) CN113784123B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108810545A (en) * 2018-07-04 2018-11-13 中南大学 Method for video encoding, device, computer-readable medium and electronic equipment
CN113329269A (en) * 2020-02-28 2021-08-31 杭州海康威视数字技术股份有限公司 Video encoding method, video decoding method, video encoding device, video decoding device, electronic equipment and storage medium

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7103669B2 (en) * 2001-02-16 2006-09-05 Hewlett-Packard Development Company, L.P. Video communication method and system employing multiple state encoding and path diversity
CN100568964C (en) * 2003-02-18 2009-12-09 诺基亚有限公司 Picture decoding method
CN101237587A (en) * 2007-02-02 2008-08-06 中兴通讯股份有限公司 A video sequence coding method and its error control system
CN101686391A (en) * 2008-09-22 2010-03-31 华为技术有限公司 Video coding/decoding method and device as well as video playing method, device and system
WO2013158293A1 (en) * 2012-04-19 2013-10-24 Vid Scale, Inc. System and method for error-resilient video coding
CN105103554A (en) * 2013-03-28 2015-11-25 华为技术有限公司 Method for protecting video frame sequence against packet loss
US10097828B2 (en) * 2014-12-11 2018-10-09 Intel Corporation Rate control for parallel video encoding
WO2019225788A1 (en) * 2018-05-25 2019-11-28 라인플러스 주식회사 Method and system for transmitting and playing video having dynamic bit rate by using plurality of channels
CN110740380A (en) * 2019-10-16 2020-01-31 腾讯科技(深圳)有限公司 Video processing method and device, storage medium and electronic device
CN112203096A (en) * 2020-09-30 2021-01-08 北京金山云网络技术有限公司 Video encoding method, video encoding device, computer equipment and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108810545A (en) * 2018-07-04 2018-11-13 中南大学 Method for video encoding, device, computer-readable medium and electronic equipment
CN113329269A (en) * 2020-02-28 2021-08-31 杭州海康威视数字技术股份有限公司 Video encoding method, video decoding method, video encoding device, video decoding device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN113784123A (en) 2021-12-10

Similar Documents

Publication Publication Date Title
US9344735B2 (en) Progressive shape based encoding of video content within a swarm environment
CN112040233B (en) Video encoding method, video decoding method, video encoding device, video decoding device, electronic device, and storage medium
US10244261B2 (en) Transform coefficient coding using level maps
CN112333448B (en) Video encoding method and apparatus, video decoding method and apparatus, electronic device, and storage medium
JP2014510440A (en) Subslice in video coding
CN107371031A (en) Image encoding apparatus and method and image decoding apparatus and method
CN110832869B (en) Motion information acquisition method and device for video coding or decoding
CN110740380A (en) Video processing method and device, storage medium and electronic device
CN112351285A (en) Video encoding method and apparatus, video decoding method and apparatus, electronic device, and storage medium
CN110650357B (en) Video decoding method and device
CN116567228A (en) Encoding method, real-time communication method, apparatus, device and storage medium
CN110572673A (en) Video encoding and decoding method and device, storage medium and electronic device
CN113784123B (en) Video encoding method and apparatus, storage medium, and electronic device
US9344720B2 (en) Entropy coding techniques and protocol to support parallel processing with low latency
CN110572672A (en) Video encoding and decoding method and device, storage medium and electronic device
CN110662071A (en) Video decoding method and apparatus, storage medium, and electronic apparatus
CN115866297A (en) Video processing method, device, equipment and storage medium
US9812095B2 (en) Video processing method including managing a reference picture list and video system therefore
CN112333461A (en) Method and device for starting live video
CN110545431B (en) Video decoding method and device, video encoding method and device
CN110677692B (en) Video decoding method and device and video encoding method and device
CN110677721B (en) Video encoding and decoding method and device and storage medium
CN110677690B (en) Video processing method and device and storage medium
CN112351276A (en) Video encoding method and device and video decoding method and device
CN112040235B (en) Video resource encoding method and device and video resource decoding method and device

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
GR01 Patent grant
GR01 Patent grant