CN116248890A - Video coding method, device, computer equipment and storage medium - Google Patents

Video coding method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116248890A
CN116248890A CN202111493884.5A CN202111493884A CN116248890A CN 116248890 A CN116248890 A CN 116248890A CN 202111493884 A CN202111493884 A CN 202111493884A CN 116248890 A CN116248890 A CN 116248890A
Authority
CN
China
Prior art keywords
key frame
frame image
group
forward reference
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111493884.5A
Other languages
Chinese (zh)
Inventor
王玉波
严柯森
王光明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Uniview Technologies Co Ltd
Original Assignee
Zhejiang Uniview Technologies 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 Zhejiang Uniview Technologies Co Ltd filed Critical Zhejiang Uniview Technologies Co Ltd
Priority to CN202111493884.5A priority Critical patent/CN116248890A/en
Publication of CN116248890A publication Critical patent/CN116248890A/en
Pending legal-status Critical Current

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/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/17Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object
    • H04N19/176Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being an image region, e.g. an object the region being a block, e.g. a macroblock
    • 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/105Selection of the reference unit for prediction within a chosen coding or prediction mode, e.g. adaptive choice of position and number of pixels used for prediction
    • 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/119Adaptive subdivision aspects, e.g. subdivision of a picture into rectangular or non-rectangular coding blocks
    • 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
    • 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/593Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using predictive coding involving spatial prediction techniques

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, a video coding device, computer equipment and a storage medium. Acquiring a key frame image, and determining a key frame group matched with the key frame image and a key frame refreshing group; the key frame refreshing group comprises a target number of forward reference frame images; dividing the key frame image into a target number of key frame macro blocks, and encoding each forward reference frame image in the key frame refreshing group according to each key frame macro block; and generating an encoded frame image according to each key frame macro block, and encoding other forward reference frame images except each forward reference frame image in the key frame refreshing group in the key frame group according to the encoded frame image. By using the technical scheme of the invention, the frame data code stream is smoother while the video coding quality is ensured.

Description

一种视频编码方法、装置、计算机设备以及存储介质A video coding method, device, computer equipment and storage medium

技术领域technical field

本发明实施例涉及数据传输以及智慧监控技术领域,尤其涉及一种视频编码方法、装置、计算机设备以及存储介质。Embodiments of the present invention relate to the technical field of data transmission and intelligent monitoring, and in particular to a video encoding method, device, computer equipment and storage medium.

背景技术Background technique

随着智慧监控技术的发展,人们追求更加高质量的视觉体验,拍摄设备拍摄的图像清晰度也得到了全面提升。With the development of smart monitoring technology, people are pursuing a higher quality visual experience, and the clarity of images captured by shooting equipment has also been comprehensively improved.

传统的IPPP结构的视频编码中,由于I帧,或者说IDR(Instantaneous DecodingRefresh,即时解码刷新)帧的存在,使得若I帧数据量过大,在视频数据的传输时增加了网络负担,增加了丢包率,影响解码端解码后呈现的视频效果。而通过降低I帧数据量的方式降低丢包率,会导致I帧图像的清晰度下降,增大了I帧与离I帧较远的P帧之间的编码误差,使得整个视频数据流,周期性出现清晰到模糊的突变,也即出现明显的呼吸效应。In the video coding of the traditional IPPP structure, due to the existence of I frames, or IDR (Instantaneous Decoding Refresh, instant decoding refresh) frames, if the data volume of I frames is too large, the network burden will be increased during the transmission of video data, and the The packet loss rate affects the video effect presented by the decoder after decoding. However, reducing the packet loss rate by reducing the amount of I-frame data will result in a decrease in the definition of the I-frame image, increasing the encoding error between the I-frame and the farther P-frame from the I-frame, making the entire video data stream, There are periodic clear to blurred mutations, that is, obvious breathing effects.

发明内容Contents of the invention

本发明实施例提供了一种视频编码方法、装置、计算机设备以及存储介质,以实现在保证视频编码质量的同时,使得帧数据码流更加平滑。Embodiments of the present invention provide a video encoding method, device, computer equipment, and storage medium, so as to achieve a smoother frame data stream while ensuring video encoding quality.

第一方面,本发明实施例提供了一种视频编码方法,该方法包括:In a first aspect, an embodiment of the present invention provides a video encoding method, the method comprising:

获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组;其中,所述关键帧刷新组中包含目标数量个前向参考帧图像;Acquiring a key frame image, determining a key frame group and a key frame refresh group matching the key frame image; wherein, the key frame refresh group includes a target number of forward reference frame images;

将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码;Divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock;

根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。A coded frame image is generated according to each key frame macroblock, and other forward reference frame images in the key frame group except the forward reference frame images in the key frame refresh group are coded according to the coded frame image.

第二方面,本发明实施例还提供了一种视频编码装置,该装置包括:In a second aspect, an embodiment of the present invention also provides a video encoding device, which includes:

关键帧图像获取模块,用于获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组;其中,所述关键帧刷新组中包含目标数量个前向参考帧图像;A key frame image acquisition module, configured to acquire a key frame image, and determine a key frame group and a key frame refresh group matching the key frame image; wherein, the key frame refresh group includes a target number of forward reference frame images;

关键帧宏块编码模块,用于将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码;A key frame macroblock encoding module, configured to divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock;

编码帧图像编码模块,用于根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。The coded frame image coding module is used to generate coded frame images according to each key frame macroblock, and according to the coded frame images, other forward direction reference frame images in the key frame group except each forward reference frame image in the key frame refresh group The reference frame image is encoded.

第三方面,本发明实施例还提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如本发明实施例中任一所述的视频编码方法。In the third aspect, the embodiment of the present invention also provides a computer device, including a memory, a processor, and a computer program stored on the memory and operable on the processor, and the processor implements the computer program according to the present invention when executing the program. The video encoding method described in any one of the embodiments.

第四方面,本发明实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如本发明实施例中任一所述的视频编码方法。In the fourth aspect, the embodiment of the present invention also provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute the video as described in any one of the embodiments of the present invention when executed by a computer processor. encoding method.

本发明实施例通过确定关键帧组以及关键帧刷新组,将关键帧图像划分为目标数量个关键帧宏块,通过各关键帧宏块对关键帧刷新组中的目标数量个前向参考帧图像进行编码,根据各关键帧宏块生成编码帧图像,根据编码帧图像对关键帧组中除关键帧刷新组中的前向参考帧图像之外的其他前向参考帧图像进行编码。解决了传统的视频编码技术中,若I帧数据量过大,则增加了丢包率的问题,以及降低I帧数据量,易出现明显的呼吸效应的问题,实现了在保证视频编码质量的同时,使得帧数据码流更加平滑的效果。In the embodiment of the present invention, by determining the key frame group and the key frame refresh group, the key frame image is divided into a target number of key frame macroblocks, and the target number of forward reference frame images in the key frame refresh group are compared by each key frame macroblock. Perform encoding, generate coded frame images according to each key frame macroblock, and code other forward reference frame images in the key frame group except the forward reference frame images in the key frame refresh group according to the coded frame images. In the traditional video coding technology, if the I frame data volume is too large, the problem of increasing the packet loss rate, and reducing the I frame data volume, the problem of obvious breathing effect is easy to occur, and realizes the problem of ensuring the video coding quality. At the same time, it makes the frame data stream smoother.

附图说明Description of drawings

图1是本发明实施例一中的一种视频编码方法的流程图;FIG. 1 is a flowchart of a video encoding method in Embodiment 1 of the present invention;

图2是本发明实施例二中的一种视频编码方法的流程图;FIG. 2 is a flowchart of a video encoding method in Embodiment 2 of the present invention;

图3是本发明实施例三中的一种视频编码装置的结构示意图;FIG. 3 is a schematic structural diagram of a video encoding device in Embodiment 3 of the present invention;

图4是本发明实施例四中的一种计算机设备的结构示意图。FIG. 4 is a schematic structural diagram of a computer device in Embodiment 4 of the present invention.

具体实施方式Detailed ways

下面结合附图和实施例对本发明作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释本发明,而非对本发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与本发明相关的部分而非全部结构。The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, but not to limit the present invention. In addition, it should be noted that, for the convenience of description, only some structures related to the present invention are shown in the drawings but not all structures.

实施例一Embodiment one

图1是本发明实施例一提供的一种视频编码方法的流程图,本实施例可适用于视频编码方对待传输的视频数据进行编码的情况,该方法可以由视频编码装置来执行,该装置可以由软件和/或硬件来实现,并一般集成在视频编码设备中。Fig. 1 is a flow chart of a video encoding method provided by Embodiment 1 of the present invention. This embodiment is applicable to the case where the video encoding party encodes the video data to be transmitted, and the method can be executed by a video encoding device. It can be implemented by software and/or hardware, and is generally integrated in a video encoding device.

如图1所示,本发明实施例的技术方案,具体包括如下步骤:As shown in Figure 1, the technical solution of the embodiment of the present invention specifically includes the following steps:

S110、获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组。S110. Acquire a key frame image, and determine a key frame group and a key frame refresh group matching the key frame image.

其中,所述关键帧刷新组中包含目标数量个前向参考帧图像。Wherein, the key frame refresh group includes a target number of forward reference frame images.

关键帧图像,也即I帧图像,即Intra-coded picture(帧内编码图像帧)。在传统的视频编码中,I帧图像是关键帧组GOP(Group of Pictures,图像组)的第一帧,其作用是对关键帧组进行压缩编码。The key frame image is an I-frame image, that is, an Intra-coded picture (intra-coded image frame). In traditional video coding, an I-frame image is the first frame of a key frame group GOP (Group of Pictures, Group of Pictures), and its function is to compress and encode the key frame group.

在本发明实施例中,以IPPP的帧结构为例,对视频编码方法进行改进。因此,本实施例中的关键帧组中包含多个前向参考帧图像也即P帧图像,Predictive-coded Picture(前向预测编码图像帧)。In the embodiment of the present invention, the video encoding method is improved by taking the IPPP frame structure as an example. Therefore, the key frame group in this embodiment includes a plurality of forward reference frame images, that is, P frame images, Predictive-coded Picture (forward predictive coded image frame).

关键帧刷新组由在关键帧组中从前往后依次选取的目标数量个P帧图像组成,示例性的,若关键帧组中包含200个P帧图像,目标数量为5,则在关键帧组中从前往后依次选取5个P帧图像作为关键帧刷新组。The key frame refresh group consists of the target number of P frame images selected in sequence from front to back in the key frame group. For example, if the key frame group contains 200 P frame images and the target number is 5, then the key frame group Select 5 P-frame images from the front to the back as the key frame refresh group.

可选的,可以预先设置目标数量的上限值和下限值,根据关键帧图像的数据量确定目标数量的数值。Optionally, an upper limit and a lower limit of the number of targets may be preset, and the value of the number of targets is determined according to the data amount of the key frame image.

S120、将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码。S120. Divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock.

关键帧宏块也即I宏块,I宏块的数量需要与关键帧刷新组中的P帧图像的数量保持一致,以便通过I宏块对P帧图像进行编码。同样的,可以预先设置I宏块大小的上限值和下限值,根据I帧图像的数据量确定I宏块大小,各I宏块的大小可以相同或者不同。Key frame macroblocks are also I macroblocks, and the number of I macroblocks needs to be consistent with the number of P frame images in the key frame refresh group, so as to encode P frame images through I macroblocks. Similarly, the upper limit and lower limit of the size of the I macroblock can be preset, and the size of the I macroblock can be determined according to the data amount of the I frame image, and the sizes of the I macroblocks can be the same or different.

相应的,可以将关键帧图像均分成目标数量个关键帧宏块,也可以将关键帧图像根据运动区域和非运动区域,划分成目标数量个关键帧宏块,本实施例对关键帧宏块的划分方式不进行限制。Correspondingly, the key frame image can be divided into a target number of key frame macroblocks, and the key frame image can also be divided into a target number of key frame macroblocks according to the motion area and the non-motion area. In this embodiment, the key frame macro block The division method is not limited.

将划分后的各关键帧宏块分配给关键帧刷新组中的各前向参考帧图像时,可以按照各关键帧宏块的划分顺序分配,也可以随机分配,当关键帧宏块为根据运动区域和非运动区域划分时,还可以根据关键帧宏块是否包括运动区域进行分配,本实施例对此不进行限制。When the divided key frame macroblocks are allocated to each forward reference frame image in the key frame refresh group, they can be allocated according to the division order of each key frame macroblock, or can be randomly allocated. When the key frame macroblock is based on motion When dividing an area and a non-moving area, allocation may also be performed according to whether the key frame macroblock includes a moving area, which is not limited in this embodiment.

本发明实施例将原本插入关键帧组中的I帧图像进行划分,将划分后的I宏块分配给关键帧刷新组中的P帧图像进行编码,可以避免因I帧图像的过大或过小而造成的网络丢包或者视频质量较差的问题,减小了码率波动,使视频码流更平滑。In the embodiment of the present invention, the I frame image originally inserted into the key frame group is divided, and the divided I macroblock is assigned to the P frame image in the key frame refresh group for encoding, which can avoid the I frame image being too large or too large. Small problems caused by network packet loss or poor video quality reduce bit rate fluctuations and make video bit streams smoother.

S130、根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。S130. Generate coded frame images according to each key frame macroblock, and code other forward reference frame images in the key frame group except the forward reference frame images in the key frame refresh group according to the coded frame images.

将对关键帧刷新组进行编码的各I宏块填充成编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的下一个前向参考帧图像,通过生成的编码帧图像进行帧间参考编码。Each I macroblock that the key frame refresh group is encoded is filled into a coded frame image, and the next forward reference frame image in the key frame group except each forward reference frame image in the key frame refresh group is generated by generating The coded frame image is inter-frame reference coded.

在本发明实施例中,为保证解码时的准确性,各I宏块在编码帧图像中的填充顺序需与各I宏块分配给关键帧刷新组中的P帧图像进行编码时的顺序保持一致。In the embodiment of the present invention, in order to ensure the accuracy of decoding, the filling order of each I macroblock in the coded frame image needs to be maintained with the order in which each I macroblock is assigned to the P frame image in the key frame refresh group for encoding unanimous.

后续的前向参考帧图像采用现有的编码方法即可,直至本关键帧组的全部前向参考帧图像编码完毕。示例性的,可以采用MCP(Motion Compensation Prediction,运动补偿预测)算法对后续的前向参考帧图像进行编码,但本实施例对具体的编码方式不进行限制。Subsequent forward reference frame images can be encoded using the existing encoding method until all forward reference frame images of this key frame group are encoded. Exemplarily, an MCP (Motion Compensation Prediction, motion compensation prediction) algorithm may be used to encode subsequent forward reference frame images, but this embodiment does not limit the specific encoding manner.

本实施例的技术方案,通过确定关键帧组以及关键帧刷新组,将关键帧图像划分为目标数量个关键帧宏块,通过各关键帧宏块对关键帧刷新组中的目标数量个前向参考帧图像进行编码,根据各关键帧宏块生成编码帧图像,根据编码帧图像对关键帧组中除关键帧刷新组中的前向参考帧图像之外的其他前向参考帧图像进行编码。解决了传统的视频编码技术中,若I帧数据量过大,则增加了丢包率的问题,以及降低I帧数据量,易出现明显的呼吸效应的问题,实现了在保证视频编码质量的同时,使得帧数据码流更加平滑的效果。In the technical solution of this embodiment, by determining the key frame group and the key frame refresh group, the key frame image is divided into a target number of key frame macroblocks, and each key frame macroblock forwards the target number of key frame refresh groups. The reference frame image is encoded, the encoded frame image is generated according to each key frame macroblock, and the other forward reference frame images in the key frame group except the forward reference frame image in the key frame refresh group are encoded according to the encoded frame image. In the traditional video coding technology, if the I frame data volume is too large, the problem of increasing the packet loss rate, and reducing the I frame data volume, the problem of obvious breathing effect is easy to occur, and realizes the problem of ensuring the video coding quality. At the same time, it makes the frame data stream smoother.

实施例二Embodiment two

图2是本发明实施例二提供的一种视频编码方法的流程图,本发明实施例在上述实施例的基础上,对关键帧宏块的划分过程、对关键帧刷新组中的各前向参考帧图像进行编码的过程、根据各关键帧宏块生成编码帧图像的过程,以及对关键帧组中其他前向参考帧图像进行编码的过程进行了进一步的具体化,并加入了生成自定义信息,以及插入起始关键帧图像起流的步骤。Fig. 2 is a flow chart of a video encoding method provided by Embodiment 2 of the present invention. On the basis of the above-mentioned embodiments, the embodiment of the present invention divides key frame macroblocks and refreshes each forward direction in the key frame group. The process of encoding the reference frame image, the process of generating the encoded frame image according to each key frame macroblock, and the process of encoding other forward reference frame images in the key frame group are further specified, and the generation of custom information, and the steps to insert a starting keyframe image flow.

相应的,如图2所示,本发明实施例的技术方案,具体包括如下步骤:Correspondingly, as shown in Figure 2, the technical solution of the embodiment of the present invention specifically includes the following steps:

S210、获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组。S210. Acquire a key frame image, and determine a key frame group and a key frame refresh group matching the key frame image.

在本发明实施例中,根据关键帧图像的数据量,确定关键帧刷新组的长度,也即关键帧刷新组中前向参考帧图像的数量。关键帧刷新组的长度可以写入自定义信息中,自定义信息也即SEI(Supplemental Enhancement Information,补充增强信息)信息,提供了向视频码流中加入额外信息的方法。自定义信息由视频码流携带,发送至视频解码方,以便视频解码方进行解码。In the embodiment of the present invention, the length of the key frame refresh group is determined according to the data amount of the key frame image, that is, the number of forward reference frame images in the key frame refresh group. The length of the key frame refresh group can be written into the custom information, which is SEI (Supplemental Enhancement Information, Supplemental Enhancement Information) information, which provides a method of adding additional information to the video code stream. The custom information is carried by the video code stream and sent to the video decoder for decoding by the video decoder.

S220、确定所述关键帧图像中的运动区域,根据运动区域以及预设的宏块尺寸区间,将所述关键帧图像划分为预设数量个关键帧宏块。S220. Determine a motion area in the key frame image, and divide the key frame image into a preset number of key frame macroblocks according to the motion area and a preset macroblock size interval.

其中,运动区域是包含运动物体的区域,宏块尺寸区间用于确定宏块尺寸的上限制和下限值。可选的,可以根据目标检测算法,检测关键帧图像中的运动区域,但本实施例对确定关键帧图像中的运动区域的方式不进行限制。在关键帧图像中划分出运动区域和非运动区域之后,可以根据宏块尺寸区间,进行关键帧宏块的划分。Wherein, the moving area is an area containing moving objects, and the macroblock size range is used to determine the upper limit and lower limit of the macroblock size. Optionally, the motion area in the key frame image may be detected according to the target detection algorithm, but this embodiment does not limit the manner of determining the motion area in the key frame image. After dividing the moving area and the non-moving area in the key frame image, the key frame macroblocks can be divided according to the size range of the macroblocks.

示例性的,若预设数量为4,对关键帧图像进行运动目标检测,获得两个运动区域A和B,则对关键帧图像中除A和B之外的其他区域均分为两份,获得非运动区域C和D。若A、B、C以及D的尺寸均处于宏块尺寸区间内,则直接将A、B、C以及D确定为四个关键帧宏块。若运动区域A的尺寸小于宏块尺寸的下限值,运动区域B以及非运动区域C和D的尺寸均处于宏块尺寸区间内,则可以在C和/或D的区域内向运动区域A划分与运动区域A相连的部分区域,使得划分后的运动区域A、非运动区域C和D的尺寸均能够处于宏块尺寸区间内。本实施例对根据运动区域、宏块尺寸区间以及预设数量,将关键帧图像划分为关键帧宏块的方式不进行限制。Exemplarily, if the preset number is 4, the moving object detection is performed on the key frame image to obtain two moving regions A and B, then the other regions in the key frame image except A and B are equally divided into two parts, Obtain non-motion regions C and D. If the sizes of A, B, C and D are all within the macroblock size interval, then A, B, C and D are directly determined as four key frame macroblocks. If the size of the motion area A is smaller than the lower limit value of the macroblock size, and the sizes of the motion area B and the non-motion areas C and D are all within the macroblock size range, then it can be divided into the motion area A in the area of C and/or D Part of the area connected to the motion area A, so that the sizes of the divided motion area A, non-motion area C and D can all be within the macroblock size range. In this embodiment, there is no limitation on the method of dividing the key frame image into key frame macroblocks according to the motion area, macroblock size interval and preset number.

S230、根据各关键帧宏块是否包含运动区域,以及各关键帧宏块的位置,对各关键帧宏块进行排序。S230. Sort each key frame macroblock according to whether each key frame macroblock includes a motion area and the position of each key frame macroblock.

在本发明实施例中,将关键帧宏块划分为包含运动区域的宏块和不包含运动区域的宏块之后,可以通过注意力模型,进一步的对各关键帧宏块进行排序。注意力模型的本质是定位到感兴趣的信息,抑制无用信息。具体的,本发明实施例可以通过高斯模型,将关键帧图像的中心位置作为感兴趣区域,向四周进行扩散。由此,可以将各关键帧的顺序划分为中心运动区域、四周运动区域、中心非运动区域以及四周非运动区域。In the embodiment of the present invention, after the key frame macroblocks are divided into the macroblocks containing the motion area and the macroblocks not containing the motion area, the key frame macroblocks can be further sorted by using the attention model. The essence of the attention model is to locate the information of interest and suppress useless information. Specifically, in this embodiment of the present invention, the central position of the key frame image can be used as the region of interest to diffuse to the surroundings through the Gaussian model. Therefore, the order of each key frame can be divided into a central motion area, a surrounding motion area, a central non-motion area and a surrounding non-motion area.

在本发明实施例中,对各关键帧宏块进行运动区域和位置的划分,并依次进行排序,其目的在于可以根据各关键帧宏块的顺序依次对各前向参考帧图像进行编码,从而可以减小编码误差,使编码后的码流更平滑。In the embodiment of the present invention, each key frame macroblock is divided into motion areas and positions, and sorted sequentially, the purpose of which is to encode each forward reference frame image sequentially according to the order of each key frame macroblock, so that It can reduce the coding error and make the coded stream smoother.

S240、根据各关键帧宏块的顺序,依次将各关键帧宏块分配给所述关键帧刷新组中的各前向参考帧图像进行编码。S240. According to the sequence of each key frame macroblock, sequentially allocate each key frame macroblock to each forward reference frame image in the key frame refresh group for encoding.

由于关键帧宏块的数量与关键帧刷新组中的各前向参考帧图像的数量一致,因此,在对各关键帧宏块排序之后,即可根据各关键帧宏块的顺序,依次将各关键帧宏块分配至关键帧刷新组中的各前向参考帧图像进行编码。Since the number of key frame macroblocks is consistent with the number of forward reference frame images in the key frame refresh group, after sorting each key frame macroblock, each key frame macroblock can be sequentially sorted according to the order of each key frame macroblock The key frame macroblocks are assigned to each forward reference frame image in the key frame refresh group for encoding.

S250、根据各关键帧宏块的顺序,对各关键帧宏块进行拼接,生成编码帧图像。S250. According to the order of the macroblocks of the key frames, splice the macroblocks of the key frames to generate a coded frame image.

在本发明实施例中,依次完成各前向参考帧图像的编码之后,根据各关键帧宏块的顺序,将各关键帧宏块拼接为编码帧图像。In the embodiment of the present invention, after the encoding of each forward reference frame image is completed in sequence, each key frame macroblock is spliced into an encoded frame image according to the order of each key frame macroblock.

可选的,还可以生成编码帧图像的缓存,每完成一次根据关键帧宏块对前向参考帧图像的编码,将该关键帧宏块填充至编码帧图像,直至关键帧刷新组中各前向参考帧图像的编码完成,编码帧图像填充完整。本实施例对编码帧图像的生成方式不进行限制。Optionally, a cache of coded frame images can also be generated, and each time the coding of the forward reference frame image according to the key frame macroblock is completed, the key frame macroblock is filled into the coded frame image until each previous reference frame image in the key frame refresh group The encoding to the reference frame image is completed, and the encoded frame image is completely filled. This embodiment does not limit the manner of generating the coded frame image.

S260、根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的第一个前向参考帧图像进行编码。S260. According to the encoded frame image, encode the first forward reference frame image in the key frame group except the forward reference frame images in the key frame refresh group.

对于关键帧组中除关键帧刷新组外的其他前向参考帧图像,根据上述生成的编码帧图像,对第一个前向参考帧图像进行编码。For the other forward reference frame images in the key frame group except the key frame refresh group, encode the first forward reference frame image according to the coded frame images generated above.

S270、对所述第一个前向参考帧图像之后的各前向参考帧图像,采用前向预测的方式进行编码。S270. Encode each forward reference frame image following the first forward reference frame image in a forward prediction manner.

对第一个前向参考帧图像之后的其他前向参考帧图像,采用现有的前向预测方法进行编码,直至关键帧组中全部前向参考帧图像编码完成。For other forward reference frame images after the first forward reference frame image, the existing forward prediction method is used to encode until all the forward reference frame images in the key frame group are encoded.

S280、根据各关键帧宏块在所述编码帧图像中的顺序,生成自定义信息。S280. Generate custom information according to the order of each key frame macroblock in the coded frame image.

本发明实施例以全部前向参考帧图像编码完成后,对各关键帧宏块的顺序进行语义编码后,写入自定义信息中为例。In the embodiment of the present invention, after encoding of all forward reference frame images is completed, the order of each key frame macroblock is semantically encoded and then written into the self-defined information as an example.

可选的,还可以每完成一次根据关键帧宏块对前向参考帧图像的编码,并将该关键帧宏块填充至编码帧图像之后,将该关键帧宏块在编码帧图像中的顺序添加到自定义信息中,本实施例对此不进行限制。Optionally, each time the encoding of the forward reference frame image according to the key frame macroblock is completed, and the key frame macroblock is filled into the encoded frame image, the sequence of the key frame macroblock in the encoded frame image It is added to the custom information, which is not limited in this embodiment.

S290、将所述自定义信息与编码后的视频发送至解码方,以使所述解码方根据所述自定义信息对编码后的视频进行解码。S290. Send the custom information and the encoded video to a decoder, so that the decoder decodes the encoded video according to the custom information.

相应的,S290又可以包括:Correspondingly, S290 can include:

S291、确定视频中的首个关键帧组。S291. Determine the first key frame group in the video.

在本发明实施例中,将视频的各帧图像划分为首个前向参考帧图像,以及多个关键帧组,对于各关键帧组,采用S210-S270的方式进行编码,对首个前向参考帧图像,进行关键帧编码,也即对视频的各帧图像中的首个前向参考帧采用IDR编码方式,从而实现视频的起流。In the embodiment of the present invention, each frame image of the video is divided into the first forward reference frame image and a plurality of key frame groups. Frame image, key frame encoding is performed, that is, the first forward reference frame in each frame image of the video is encoded by IDR, so as to realize the streaming of the video.

S292、对首个关键帧组之前的首个前向参考帧图像进行关键帧编码,以实现视频的起流。S292. Perform key frame encoding on the first forward reference frame image before the first key frame group, so as to realize video streaming.

本发明实施例中的起流模式,可以保证视频起流正常无延时。The streaming mode in the embodiment of the present invention can ensure that the video streaming is normal without delay.

S293、将所述自定义信息随视频流发送至解码方。S293. Send the custom information along with the video stream to the decoder.

可选的,在视频解码方,接收到视频码流时,如果关键帧组存在丢包的情况,可以通过错误隐藏算法,恢复重建编码帧,以使解码正常进行,提高了视频解码方的抗丢包能力。Optionally, at the video decoding side, when receiving the video code stream, if there is a packet loss in the key frame group, the error concealment algorithm can be used to restore and reconstruct the encoded frame, so that the decoding can be performed normally, which improves the video decoding side's resistance. Packet loss capability.

其中,错误隐藏算法的原理为当视频码流中某一前向参考帧图像丢失时,可以直接拷贝该前向参考帧图像的前一前向参考帧图像的宏块,重建编码帧,实现错误隐藏。Among them, the principle of the error concealment algorithm is that when a certain forward reference frame image in the video code stream is lost, the macroblock of the previous forward reference frame image of the forward reference frame image can be directly copied to reconstruct the coded frame to realize the error hide.

本实施例的技术方案,通过确定关键帧组以及关键帧刷新组,将关键帧图像根据运动区域划分为目标数量个关键帧宏块,通过各关键帧宏块是否包含运动区域,以及各关键帧宏块的位置,对各关键帧宏块进行排序,根据顺序依次将各关键帧宏块分配给关键帧刷新组中的目标数量个前向参考帧图像进行编码,根据各关键帧宏块的顺序,拼接生成编码帧图像,根据编码帧图像对关键帧组中除关键帧刷新组中的前向参考帧图像之外的第一个前向参考帧图像进行编码,之后的其他前向参考帧图像采用前向编码方式进行编码。解决了传统的视频编码技术中,若I帧数据量过大,则增加了丢包率的问题,以及降低I帧数据量,易出现明显的呼吸效应的问题,实现了在保证视频编码质量的同时,使得帧数据码流更加平滑的效果。In the technical solution of this embodiment, by determining the key frame group and the key frame refresh group, the key frame image is divided into a target number of key frame macroblocks according to the motion area, whether each key frame macro block contains a motion area, and each key frame The position of the macroblocks, the key frame macroblocks are sorted, and each key frame macroblock is assigned to the target number of forward reference frame images in the key frame refresh group according to the order, and the key frame macroblocks are encoded according to the sequence of each key frame macroblock , splicing to generate coded frame images, encode the first forward reference frame image in the key frame group except the forward reference frame image in the key frame refresh group according to the coded frame image, and then encode the other forward reference frame images Encoded by forward encoding. In the traditional video coding technology, if the I frame data volume is too large, the problem of increasing the packet loss rate, and reducing the I frame data volume, the problem of obvious breathing effect is easy to occur, and realizes the problem of ensuring the video coding quality. At the same time, it makes the frame data stream smoother.

实施例三Embodiment Three

图3是本发明实施例三提供的一种视频编码装置的结构示意图,该装置部署于视频编码设备中,该装置包括:关键帧图像获取模块310、关键帧宏块编码模块320以及编码帧图像编码模块330。其中:Fig. 3 is a schematic structural diagram of a video encoding device provided in Embodiment 3 of the present invention. The device is deployed in a video encoding device, and the device includes: a key frame image acquisition module 310, a key frame macroblock encoding module 320, and an encoded frame image encoding module 330 . in:

关键帧图像获取模块310,用于获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组;其中,所述关键帧刷新组中包含目标数量个前向参考帧图像;A key frame image acquisition module 310, configured to acquire a key frame image, and determine a key frame group and a key frame refresh group matching the key frame image; wherein, the key frame refresh group includes a target number of forward reference frame images ;

关键帧宏块编码模块320,用于将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码;A key frame macroblock encoding module 320, configured to divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock;

编码帧图像编码模块330,用于根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。The coded frame image encoding module 330 is configured to generate a coded frame image according to each key frame macroblock, and, according to the coded frame image, perform an operation on other previous reference frame images in the key frame group except for each forward reference frame image in the key frame refresh group Coding to the reference frame image.

本实施例的技术方案,通过确定关键帧组以及关键帧刷新组,将关键帧图像划分为目标数量个关键帧宏块,通过各关键帧宏块对关键帧刷新组中的目标数量个前向参考帧图像进行编码,根据各关键帧宏块生成编码帧图像,根据编码帧图像对关键帧组中除关键帧刷新组中的前向参考帧图像之外的其他前向参考帧图像进行编码。解决了传统的视频编码技术中,若I帧数据量过大,则增加了丢包率的问题,以及降低I帧数据量,易出现明显的呼吸效应的问题,实现了在保证视频编码质量的同时,使得帧数据码流更加平滑的效果。In the technical solution of this embodiment, by determining the key frame group and the key frame refresh group, the key frame image is divided into a target number of key frame macroblocks, and each key frame macroblock forwards the target number of key frame refresh groups. The reference frame image is encoded, the encoded frame image is generated according to each key frame macroblock, and the other forward reference frame images in the key frame group except the forward reference frame image in the key frame refresh group are encoded according to the encoded frame image. In the traditional video coding technology, if the I frame data volume is too large, the problem of increasing the packet loss rate, and reducing the I frame data volume, the problem of obvious breathing effect is easy to occur, and realizes the problem of ensuring the video coding quality. At the same time, it makes the frame data stream smoother.

在上述实施例的基础上,关键帧宏块编码模块320,包括:On the basis of the foregoing embodiments, the key frame macroblock encoding module 320 includes:

关键帧图像划分单元,用于确定所述关键帧图像中的运动区域,根据运动区域以及预设的宏块尺寸区间,将所述关键帧图像划分为预设数量个关键帧宏块。The key frame image division unit is configured to determine the motion area in the key frame image, and divide the key frame image into a preset number of key frame macroblocks according to the motion area and a preset macroblock size interval.

在上述实施例的基础上,关键帧宏块编码模块320,包括:On the basis of the foregoing embodiments, the key frame macroblock encoding module 320 includes:

关键帧宏块排序单元,用于根据各关键帧宏块是否包含运动区域,以及各关键帧宏块的位置,对各关键帧宏块进行排序;The key frame macro block sorting unit is used to sort each key frame macro block according to whether each key frame macro block contains a motion area, and the position of each key frame macro block;

关键帧宏块编码单元,用于根据各关键帧宏块的顺序,依次将各关键帧宏块分配给所述关键帧刷新组中的各前向参考帧图像进行编码。The key frame macroblock encoding unit is configured to sequentially allocate each key frame macroblock to each forward reference frame image in the key frame refresh group according to the order of each key frame macroblock for encoding.

在上述实施例的基础上,编码帧图像编码模块330,包括:On the basis of the foregoing embodiments, the encoding frame image encoding module 330 includes:

关键帧宏块拼接单元,用于根据各关键帧宏块的顺序,对各关键帧宏块进行拼接,生成编码帧图像。The key frame macroblock splicing unit is used for splicing each key frame macroblock according to the order of each key frame macroblock to generate a coded frame image.

在上述实施例的基础上,编码帧图像编码模块330,包括:On the basis of the foregoing embodiments, the encoding frame image encoding module 330 includes:

第一编码单元,用于根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的第一个前向参考帧图像进行编码;The first encoding unit is configured to encode the first forward reference frame image in the key frame group except the forward reference frame images in the key frame refresh group according to the encoded frame image;

第二编码单元,用于对所述第一个前向参考帧图像之后的各前向参考帧图像,采用前向预测的方式进行编码。The second encoding unit is configured to encode each forward reference frame image following the first forward reference frame image by means of forward prediction.

在上述实施例的基础上,所述装置,还包括:On the basis of the foregoing embodiments, the device further includes:

自定义信息生成模块,用于根据各关键帧宏块在所述编码帧图像中的顺序,生成自定义信息;A custom information generation module, configured to generate custom information according to the order of each key frame macroblock in the coded frame image;

数据发送模块,用于将所述自定义信息与编码后的视频发送至解码方,以使所述解码方根据所述自定义信息对编码后的视频进行解码。A data sending module, configured to send the custom information and the coded video to a decoder, so that the decoder decodes the coded video according to the custom information.

在上述实施例的基础上,数据发送模块,具体用于:On the basis of the foregoing embodiments, the data sending module is specifically used for:

确定视频中的首个关键帧组;Determine the first keyframe group in the video;

对首个关键帧组之前的首个前向参考帧图像进行关键帧编码,以实现视频的起流;Key frame encoding is performed on the first forward reference frame image before the first key frame group to realize video streaming;

将所述自定义信息随视频流发送至解码方。Send the custom information along with the video stream to the decoder.

本发明实施例所提供的视频编码装置可执行本发明任意实施例所提供的视频编码方法,具备执行方法相应的功能模块和有益效果。The video encoding device provided in the embodiment of the present invention can execute the video encoding method provided in any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method.

实施例四Embodiment Four

图4为本发明实施例四提供的一种计算机设备的结构示意图,如图4所示,该计算机设备包括处理器70、存储器71、输入装置72和输出装置73;计算机设备中处理器70的数量可以是一个或多个,图4中以一个处理器70为例;计算机设备中的处理器70、存储器71、输入装置72和输出装置73可以通过总线或其他方式连接,图4中以通过总线连接为例。FIG. 4 is a schematic structural diagram of a computer device provided in Embodiment 4 of the present invention. As shown in FIG. 4 , the computer device includes a processor 70, a memory 71, an input device 72, and an output device 73; The quantity can be one or more, and a processor 70 is taken as an example in Fig. 4; the processor 70, the memory 71, the input device 72 and the output device 73 in the computer equipment can be connected by bus or other ways, and in Fig. 4 by Take the bus connection as an example.

存储器71作为一种计算机可读存储介质,可用于存储软件程序、计算机可执行程序以及模块,如本发明实施例中的视频编码方法对应的模块(例如,视频编码装置中的关键帧图像获取模块310、关键帧宏块编码模块320以及编码帧图像编码模块330)。处理器70通过运行存储在存储器71中的软件程序、指令以及模块,从而执行计算机设备的各种功能应用以及数据处理,即实现上述的视频编码方法。该方法包括:The memory 71, as a computer-readable storage medium, can be used to store software programs, computer-executable programs and modules, such as the modules corresponding to the video encoding method in the embodiment of the present invention (for example, the key frame image acquisition module in the video encoding device 310, key frame macroblock coding module 320 and coded frame image coding module 330). The processor 70 executes various functional applications and data processing of the computer device by running the software programs, instructions and modules stored in the memory 71 , that is, realizes the above-mentioned video encoding method. The method includes:

获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组;其中,所述关键帧刷新组中包含目标数量个前向参考帧图像;Acquiring a key frame image, determining a key frame group and a key frame refresh group matching the key frame image; wherein, the key frame refresh group includes a target number of forward reference frame images;

将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码;Divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock;

根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。A coded frame image is generated according to each key frame macroblock, and other forward reference frame images in the key frame group except the forward reference frame images in the key frame refresh group are coded according to the coded frame image.

存储器71可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据终端的使用所创建的数据等。此外,存储器71可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器71可进一步包括相对于处理器70远程设置的存储器,这些远程存储器可以通过网络连接至计算机设备。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory 71 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and at least one application required by a function; the data storage area may store data created according to the use of the terminal, and the like. In addition, the memory 71 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage devices. In some examples, the memory 71 may further include memory located remotely relative to the processor 70, and these remote memories may be connected to the computer device through a network. Examples of the aforementioned networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

输入装置72可用于接收输入的数字或字符信息,以及产生与计算机设备的用户设置以及功能控制有关的键信号输入。输出装置73可包括显示屏等显示设备。The input device 72 can be used to receive input numbers or character information, and generate key signal input related to user settings and function control of the computer equipment. The output device 73 may include a display device such as a display screen.

实施例五Embodiment five

本发明实施例五还提供一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行一种视频编码方法,该方法包括:Embodiment 5 of the present invention also provides a storage medium containing computer-executable instructions, the computer-executable instructions are used to execute a video encoding method when executed by a computer processor, and the method includes:

获取关键帧图像,确定与所述关键帧图像匹配的关键帧组以及关键帧刷新组;其中,所述关键帧刷新组中包含目标数量个前向参考帧图像;Acquiring a key frame image, determining a key frame group and a key frame refresh group matching the key frame image; wherein, the key frame refresh group includes a target number of forward reference frame images;

将所述关键帧图像划分为目标数量个关键帧宏块,根据各关键帧宏块对所述关键帧刷新组中的各前向参考帧图像进行编码;Divide the key frame image into a target number of key frame macroblocks, and encode each forward reference frame image in the key frame refresh group according to each key frame macroblock;

根据各关键帧宏块生成编码帧图像,根据所述编码帧图像,对关键帧组中除关键帧刷新组中的各前向参考帧图像之外的其他前向参考帧图像进行编码。A coded frame image is generated according to each key frame macroblock, and other forward reference frame images in the key frame group except the forward reference frame images in the key frame refresh group are coded according to the coded frame image.

当然,本发明实施例所提供的一种包含计算机可执行指令的存储介质,其计算机可执行指令不限于如上所述的方法操作,还可以执行本发明任意实施例所提供的视频编码方法中的相关操作。Certainly, a storage medium containing computer-executable instructions provided in an embodiment of the present invention, the computer-executable instructions are not limited to the method operations described above, and may also perform the video encoding method provided in any embodiment of the present invention. related operations.

通过以上关于实施方式的描述,所属领域的技术人员可以清楚地了解到,本发明可借助软件及必需的通用硬件来实现,当然也可以通过硬件实现,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在计算机可读存储介质中,如计算机的软盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(RandomAccess Memory,RAM)、闪存(FLASH)、硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。Through the above description about the implementation mode, those skilled in the art can clearly understand that the present invention can be realized by means of software and necessary general-purpose hardware, and of course it can also be realized by hardware, but in many cases the former is a better implementation mode . Based on this understanding, the essence of the technical solution of the present invention or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a floppy disk of a computer , read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), flash memory (FLASH), hard disk or optical disc, etc., including several instructions to make a computer device (which can be a personal computer, A server, or a network device, etc.) executes the methods described in various embodiments of the present invention.

值得注意的是,上述视频编码装置的实施例中,所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本发明的保护范围。It is worth noting that, in the embodiment of the video encoding device above, the units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, each The specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the present invention.

注意,上述仅为本发明的较佳实施例及所运用技术原理。本领域技术人员会理解,本发明不限于这里所述的特定实施例,对本领域技术人员来说能够进行各种明显的变化、重新调整和替代而不会脱离本发明的保护范围。因此,虽然通过以上实施例对本发明进行了较为详细的说明,但是本发明不仅仅限于以上实施例,在不脱离本发明构思的情况下,还可以包括更多其他等效实施例,而本发明的范围由所附的权利要求范围决定。Note that the above are only preferred embodiments of the present invention and applied technical principles. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, rearrangements and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and can also include more other equivalent embodiments without departing from the concept of the present invention, and the present invention The scope is determined by the scope of the appended claims.

Claims (10)

1. A video encoding method, comprising:
acquiring a key frame image, and determining a key frame group matched with the key frame image and a key frame refreshing group; the key frame refreshing group comprises a target number of forward reference frame images;
dividing the key frame image into a target number of key frame macro blocks, and encoding each forward reference frame image in the key frame refreshing group according to each key frame macro block;
and generating an encoded frame image according to each key frame macro block, and encoding other forward reference frame images except each forward reference frame image in the key frame refreshing group in the key frame group according to the encoded frame image.
2. The method of claim 1, wherein dividing the key frame image into a target number of key frame macro-blocks comprises:
and determining a motion area in the key frame image, and dividing the key frame image into a preset number of key frame macro blocks according to the motion area and a preset macro block size interval.
3. The method of claim 2, wherein encoding each forward reference frame image in the keyframe refresh set from each keyframe macroblock comprises:
sequencing each key frame macro block according to whether each key frame macro block contains a motion area and the position of each key frame macro block;
and sequentially distributing each key frame macro block to each forward reference frame image in the key frame refreshing group for encoding according to the sequence of each key frame macro block.
4. A method according to claim 3, wherein generating an encoded frame image from each key frame macroblock comprises:
and splicing the key frame macro blocks according to the sequence of the key frame macro blocks to generate an encoded frame image.
5. The method of claim 1, wherein encoding, from the encoded frame image, other forward reference frame images in the key frame group than each forward reference frame image in the key frame refresh group, comprises:
encoding a first forward reference frame image in the key frame group except for each forward reference frame image in the key frame refreshing group according to the encoded frame image;
and encoding each forward reference frame image after the first forward reference frame image in a forward prediction mode.
6. The method according to any one of claims 1-5, further comprising, after encoding the other forward reference frame pictures in the key frame group than the forward reference frame pictures in the key frame refresh group:
generating custom information according to the sequence of each key frame macro block in the coded frame image;
and transmitting the custom information and the encoded video to a decoding party so that the decoding party decodes the encoded video according to the custom information.
7. The method of claim 6, wherein transmitting the custom information and the encoded video to a decoder comprises:
determining a first key frame group in the video;
performing key frame coding on a first forward reference frame image before a first key frame group so as to realize the streaming of the video;
and sending the custom information to a decoder along with the video stream.
8. A video encoding apparatus, comprising:
the key frame image acquisition module is used for acquiring a key frame image and determining a key frame group matched with the key frame image and a key frame refreshing group; the key frame refreshing group comprises a target number of forward reference frame images;
the key frame macro block coding module is used for dividing the key frame image into a target number of key frame macro blocks, and coding each forward reference frame image in the key frame refreshing group according to each key frame macro block;
and the encoding frame image encoding module is used for generating encoding frame images according to each key frame macro block, and encoding other forward reference frame images except each forward reference frame image in the key frame refreshing group in the key frame group according to the encoding frame images.
9. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the video encoding method of any of claims 1-7 when the program is executed by the processor.
10. A storage medium containing computer executable instructions which, when executed by a computer processor, are for performing the video encoding method of any of claims 1-7.
CN202111493884.5A 2021-12-08 2021-12-08 Video coding method, device, computer equipment and storage medium Pending CN116248890A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111493884.5A CN116248890A (en) 2021-12-08 2021-12-08 Video coding method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111493884.5A CN116248890A (en) 2021-12-08 2021-12-08 Video coding method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116248890A true CN116248890A (en) 2023-06-09

Family

ID=86624756

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111493884.5A Pending CN116248890A (en) 2021-12-08 2021-12-08 Video coding method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116248890A (en)

Similar Documents

Publication Publication Date Title
CN114554211B (en) Content-adaptive video encoding method, device, equipment and storage medium
WO2021114846A1 (en) Video noise cancellation processing method and apparatus, and storage medium
WO2016131223A1 (en) Frame loss method for video frame and video sending apparatus
CN110430441B (en) Cloud mobile phone video acquisition method, system, device and storage medium
CN110392284B (en) Video encoding method, video data processing method, video encoding apparatus, video data processing apparatus, computer device, and storage medium
US9560379B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
CN107820095B (en) Long-term reference image selection method and device
CN108924574B (en) Packet loss processing method, device, equipment and storage medium in recording and broadcasting system
CN115134629A (en) Video transmission method, system, device and storage medium
US10536726B2 (en) Pixel patch collection for prediction in video coding system
CN110996035A (en) Information sending method and device
CN105474644A (en) Processing and reproduction of frames
CN117714700B (en) Video coding method, device, equipment, readable storage medium and product
WO2016161678A1 (en) Method, device, and processing system for video encoding and decoding
CN116248890A (en) Video coding method, device, computer equipment and storage medium
CN103152570B (en) A kind of video bit stream coding/decoding method and device
WO2023024832A1 (en) Data processing method and apparatus, computer device and storage medium
US9451285B2 (en) Inter-prediction method and video encoding/decoding method using the inter-prediction method
US11956441B2 (en) Identifying long term reference frame using scene detection and perceptual hashing
CN103327336B (en) A kind of method and apparatus of 3-dimensional encoding
CN113660487B (en) Parameter determination method and device for distributing corresponding bit number for frame image
CN117596392B (en) Coding information determining method of coding block and related product
CN119854473A (en) Binocular image display method based on motion compensation and virtual reality equipment
CN119316633A (en) Multi-view video encoding and decoding method, device and storage medium
WO2025016312A1 (en) Image coding/decoding method and apparatus

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