Video coding and decoding method, electronic device, electronic terminal and storage medium

By establishing a time-reuse encoding process in video encoding, and using a reference video sequence as a reference frame to encode subsequent video sequences, the problems of redundant repetitive scenes and wasted storage space in traditional surveillance video encoding are solved, thereby improving encoding efficiency and storage utilization.

CN120935357APending Publication Date: 2025-11-11ZHEJIANG DAHUA TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510968771.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-14
Publication Date
2025-11-11

AI Technical Summary

Technical Problem

Traditional surveillance video encoding suffers from problems such as redundant scenes and wasted storage space, especially in scenes shot by fixed cameras. Footage from the same time period is highly similar, but reference frames cannot be reused across time periods, resulting in high data duplication rates and high storage costs.

Method used

A video coding method is adopted, which acquires a reference video sequence and subsequent video sequences from multiple video sequences, uses the first image frame as a reference frame, encodes the second image frame corresponding to the acquisition time, and uses the (n-1)th first image frame as a reference frame to encode the nth first image frame, establishes a time-reused coding process, and optimizes the coding process.

Benefits of technology

It effectively solves the problems of redundancy in repetitive scenarios and waste of storage space, increases bitrate gains, and reduces storage costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120935357A_ABST
    Figure CN120935357A_ABST
Patent Text Reader

Abstract

The invention provides a video coding method, a video decoding method, an electronic device, an electronic terminal and a storage medium. Comprising the steps that a to-be-coded video is acquired, the to-be-coded video comprises a plurality of video sequences, the plurality of video sequences comprise a reference video sequence and a subsequent video sequence, the reference video sequence comprises a plurality of first image frames, the subsequent video sequence comprises a plurality of second image frames, and the acquisition time of the first image frames corresponds to the acquisition time of the second image frames; and encoding the second image frame corresponding to the acquisition time by taking the first image frame as a reference frame, and encoding the nth first image frame by taking the (n-1) th first image frame as a reference frame. According to the method, the corresponding coding process is established according to the rule of video periodicity, the reference frame can be multiplexed in a time-crossing manner, the problems of repeated scene redundancy, high data repetition rate, high storage cost and storage space waste are solved, and the code rate income is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image technology, and in particular to a video encoding and decoding method, electronic device, electronic terminal, and storage medium. Background Technology

[0002] Traditional surveillance video encoding uses standards such as H.264 / H.265 to independently segment and compress continuous video streams, which has limitations, such as redundancy in repetitive scenes: scenes captured by fixed cameras are highly similar in periodic time periods (such as the same time every day), but traditional encoders cannot reuse reference frames across time periods; another example is high storage costs: continuous video generated by surveillance needs to be stored in full, and repeated encoding of the same scene leads to a waste of storage space. Summary of the Invention

[0003] The main technical problem solved by this invention is to provide a video encoding and decoding method, electronic device, electronic terminal and storage medium, which solves the problems of high data duplication rate and waste of storage space in the encoding process of the prior art.

[0004] To solve the above-mentioned technical problems, the first technical solution adopted by the present invention is: to provide a video encoding method, comprising: acquiring a video to be encoded, the video to be encoded comprising multiple video sequences, the multiple video sequences being acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponding to one image acquisition cycle; the multiple video sequences comprising a reference video sequence and subsequent video sequences, the reference video sequence comprising multiple first image frames, the subsequent video sequences comprising multiple second image frames, the acquisition time of the first image frames and the second image frames corresponding to the acquisition time; encoding the second image frame corresponding to the acquisition time using the first image frame as a reference frame, and encoding the nth first image frame using the (n-1)th first image frame as a reference frame to obtain a bitstream; wherein, n is greater than or equal to 2, and n is a positive integer.

[0005] In one embodiment, the reference video sequence includes a plurality of first video segments, each first video segment including at least a portion of first image frames; the subsequent video sequence includes a plurality of second video segments, each second video segment including at least a portion of second image frames; the first video segments and the second video segments are acquired at corresponding times; the video encoding method includes a plurality of encoding segments, each encoding segment being used to encode the first video segment and the second video segment corresponding to the acquisition time;

[0006] In each encoding segment, the first image frame in the first video segment is used as a reference frame to encode the second image frame in the second video segment corresponding to the acquisition time; and the (m-1)th first image frame in the first video segment is used as a reference frame to encode the mth first image frame; where m is greater than or equal to 2 and m is a positive integer less than or equal to n.

[0007] In one embodiment, each coding segment includes multiple coding cycles, and each coding cycle is used to encode the first image frame and the second image frame corresponding to the acquisition time.

[0008] In each encoding cycle, the current first image frame is encoded using the previous first image frame as a reference frame; and the second image frame is encoded using the current first image frame as a reference frame.

[0009] In one embodiment, the reference video sequence includes: a video sequence among a plurality of video sequences whose correlation with other video sequences is greater than a first threshold.

[0010] In one embodiment, the video encoding method includes:

[0011] Calculate the sum of the correlations between the current video sequence and other video sequences in a set of multiple video sequences to obtain the correlation parameter of the current video sequence;

[0012] The video sequence with the highest correlation parameter is used as the benchmark video sequence.

[0013] In one embodiment, among multiple video sequences, the similarity between any two video sequences is greater than a second threshold.

[0014] In one embodiment, before acquiring the video to be encoded, the process includes:

[0015] Obtain the initial video to be encoded, which includes multiple initial video sequences.

[0016] Calculate the similarity between the current initial video sequence and other initial video sequences among multiple initial video sequences;

[0017] If the similarity is greater than the second threshold, the initial video sequence is used as the video to be encoded.

[0018] To solve the above-mentioned technical problems, the second technical solution adopted by the present invention is: to provide a video decoding method, which is used to decode the bitstream obtained by any of the above-mentioned video encoding methods, the video decoding method comprising:

[0019] The bitstream corresponding to the first image frame in the bitstream is decoded to obtain multiple first image frames; and the bitstream corresponding to the second image frame in the bitstream is decoded based on the first image frames to obtain multiple second image frames. The multiple first image frames form a reference video sequence, and the multiple second image frames form a subsequent video sequence. The reference video sequence and the subsequent video sequence form the video to be encoded.

[0020] To solve the above-mentioned technical problems, the third technical solution adopted by the present invention is: to provide an electronic device for implementing the video encoding method of any one of the above claims; the electronic device includes:

[0021] The acquisition unit is used to acquire the video to be encoded, which includes multiple video sequences. The multiple video sequences are acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponds to one image acquisition cycle. The multiple video sequences include a reference video sequence and subsequent video sequences. The reference video sequence includes multiple first image frames, and the subsequent video sequence includes multiple second image frames. The acquisition time of the first image frames and the second image frames corresponds.

[0022] The encoding unit is used to encode the second image frame corresponding to the acquisition time using the first image frame as a reference frame, and to encode the nth first image frame using the (n-1)th first image frame as a reference frame, to obtain a bitstream; where n is greater than or equal to 2 and n is a positive integer;

[0023] Furthermore, the electronic device is used to implement the video decoding method of claim 8; the electronic device further includes:

[0024] The decoding unit is used to decode the bitstream corresponding to the first image frame in the bitstream to obtain multiple first image frames; and to decode the bitstream corresponding to the second image frame in the bitstream based on the first image frames to obtain multiple second image frames. The multiple first image frames form a reference video sequence, and the multiple second image frames form a subsequent video sequence. The reference video sequence and the subsequent video sequence form the video to be encoded.

[0025] To solve the above-mentioned technical problems, the fourth technical solution adopted by the present invention is: to provide an electronic terminal, the electronic terminal including a memory and a processor coupled to each other, the processor being used to execute program instructions stored in the memory, and the processor being used to execute program data to implement the steps in the video encoding and video decoding methods described above.

[0026] To solve the above-mentioned technical problems, the fifth technical solution adopted by the present invention is to provide a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, it implements the steps in the video encoding and video decoding methods described above.

[0027] The beneficial effects of this invention are as follows: Unlike existing technologies, the provided video encoding method includes: acquiring a video to be encoded, the video to be encoded comprising multiple video sequences, the multiple video sequences being acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponding to one image acquisition cycle; the multiple video sequences including a reference video sequence and subsequent video sequences, the reference video sequence including multiple first image frames, and the subsequent video sequences including multiple second image frames, the acquisition times of the first image frames and the second image frames corresponding; encoding the second image frame corresponding to the acquisition time using the first image frame as a reference frame, and encoding the nth first image frame using the (n-1)th first image frame as a reference frame to obtain a bitstream; wherein n is greater than or equal to 2, and n is a positive integer. The video encoding method of this application establishes a corresponding encoding process based on the periodicity of the video, enabling cross-time reuse of reference frames, solving the problems of redundant repetitive scenes, high data repetition rate, high storage cost, and wasted storage space, thereby increasing the bitrate gain. Attached Figure Description

[0028] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0029] Figure 1 This is a flowchart illustrating an embodiment of the video encoding method provided in this application;

[0030] Figure 2 This is a schematic diagram of another embodiment of the video encoding method provided in this application;

[0031] Figure 3 This is a schematic diagram of the structure of an embodiment of the electronic device provided in this application;

[0032] Figure 4 This is a schematic diagram of the framework of an embodiment of the electronic terminal provided in this application;

[0033] Figure 5 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation

[0034] The embodiments of this application will now be described in detail with reference to the accompanying drawings.

[0035] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.

[0036] In this article, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, M and / or B can represent: M alone, both M and B existing simultaneously, or B alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "more" in this article means two or more objects.

[0037] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0038] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0039] The video encoding and decoding methods provided in this application can be implemented by a server or terminal alone, or by a server and terminal working together. In some embodiments, the terminal or server can implement the video encoding and decoding methods provided in this application by running a computer program. For example, the computer program can be a native program or software module in an operating system; it can be a native application (APP), i.e., a program that needs to be installed in the operating system to run, such as a client that supports virtual scenes, such as a game APP; it can also be a mini-program, i.e., a program that only needs to be downloaded to a browser environment to run; or it can be a mini-program that can be embedded in any APP. In short, the above-mentioned computer program can be any form of application, module, or plugin.

[0040] In one embodiment, the video encoding method of this application can be applied to videos captured by a fixed-viewpoint image acquisition device that need to be stored for a long time; or to the storage of videos of scenes with obvious temporal regularity.

[0041] Taking video captured by a fixed-viewpoint image acquisition device as an example, let's assume the application scenario is a convenience store. A fixed-viewpoint image acquisition device is installed at the store entrance. The images captured by this device exhibit certain patterns. For instance, images captured on weekdays show more and more frequently moving targets, while images captured on non-weekdays show fewer targets. Similarly, during certain time periods on weekdays, such as breakfast, lunch, and dinner, target movement is more frequent, while during regular working hours, target movement is less frequent. This application encodes the captured video based on these patterns, which to some extent solves the problems of high data redundancy and wasted storage space.

[0042] To enable those skilled in the art to better understand the technical solution of the present invention, a video encoding and video decoding method provided by the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0043] Please see Figure 1 , Figure 1 This is a flowchart illustrating an embodiment of the video encoding method provided in this application, specifically including:

[0044] Step S11: Obtain the video to be encoded.

[0045] The video to be encoded includes multiple video sequences, which are acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponds to one image acquisition cycle.

[0046] In one specific embodiment, among multiple video sequences, the similarity between any two video sequences is greater than a second threshold. It should be noted that the greater the similarity between any two video sequences, the stronger their correlation and the smaller their differences. In this embodiment, encoding highly correlated video sequences can improve bitrate gains, while removing weakly correlated video sequences is less relevant for subsequent image comparisons, etc., and therefore does not need to be aligned and saved, thus eliminating the need for encoding. This improves encoding efficiency and also reduces storage space waste to some extent.

[0047] In one specific embodiment, an initial video to be encoded is obtained before obtaining the video to be encoded. The initial video to be encoded includes multiple initial video sequences. The similarity between the current initial video sequence and other initial video sequences is calculated. If the similarity is greater than a second threshold, the initial video sequence is used as the video to be encoded.

[0048] Specifically, raw videos from multiple image acquisition cycles are selected from the hard drive, with each raw video corresponding to an initial video sequence. In this embodiment, one image acquisition cycle is defined as one day. Following a time pattern, multiple image acquisition cycles can, for example, be a week with 7 days. Thus, 7 initial video sequences can be obtained. In other embodiments, multiple image acquisition cycles can also be a month with 30 days; the specific method is not limited.

[0049] The similarity between the current initial video sequence and other initial video sequences is calculated. Specifically, this can be done simultaneously from the first frame to the last frame of two initial video sequences (i.e., the current initial video sequence and any other initial video sequence), comparing images frame by frame or at fixed frame sampling intervals (e.g., sampling one frame every 10 frames). For example, the pixel value difference between corresponding frames of the two initial video sequences is calculated, and an average variance value is accumulated. This average variance value represents the similarity and is negatively correlated with the similarity. Specifically, the larger the average variance value, the smaller the similarity and the weaker the correlation between the two initial video sequences; the smaller the average variance value, the larger the similarity and the stronger the correlation. It is understood that the correlation here is an indicator that measures the magnitude of the content difference between the two initial video sequences. The goal of this step is to select video sequences with similar image content for subsequent transcoding processing. Video sequences with excessively large content differences do not show significant bitrate gains in subsequent transcoding processing. After calculating the similarity, the initial video sequence with a similarity greater than the second threshold is taken as the video to be encoded. Specifically, the initial video sequence with an average variance value less than the preset value can be taken as the video to be encoded.

[0050] The multiple video sequences include a reference video sequence and subsequent video sequences. The reference video sequence includes multiple first image frames, and the subsequent video sequences include multiple second image frames. The acquisition time of the first image frames and the second image frames corresponds.

[0051] In one embodiment, multiple video sequences are divided into a reference video sequence and subsequent video sequences, with the reference video sequence serving as a reference for encoding the subsequent video sequences. In a specific embodiment, since the video sequence comprises videos captured over a day, it includes a number of image frames.

[0052] It should be noted that one of the seven video sequences can be used as the baseline video sequence, and the remaining video sequences can be used as subsequent video sequences. The baseline video sequence can be arbitrarily specified from all the video sequences. In another embodiment, in order to improve the bitrate gain after encoding, increase encoding efficiency, and reduce costs, the baseline video sequence includes video sequences among multiple video sequences whose correlation with other video sequences is greater than a first threshold. Specifically, the sum of the correlations between the current video sequence and other video sequences is calculated to obtain the correlation parameter of the current video sequence, and the video sequence with the largest correlation parameter is used as the baseline video sequence. The methods for calculating the correlation between the current video sequence and other video sequences include, but are not limited to, image content-based feature matching algorithms (such as image color features, texture features, shape features, etc.), motion information-based analysis algorithms (such as optical flow methods, motion vector analysis methods), semantic-based analysis algorithms, etc., and are not specifically limited.

[0053] This application determines a baseline video sequence through correlation, and encodes subsequent video sequences using the baseline video sequence as a reference. This can improve the bitrate gain and solve the problems of high data repetition rate and wasted storage space to some extent.

[0054] In one specific embodiment, the video sequence can be, for example, a reconstructed video of the original video, which includes the YUV images of the original video; therefore, the video sequence can also be viewed as a YUV sequence. Here, Y represents luminance, and U and V represent chrominance.

[0055] Step S12: Using the first image frame as a reference frame, encode the second image frame corresponding to the acquisition time, and using the (n-1)th first image frame as a reference frame, encode the nth first image frame to obtain a bitstream; where n is greater than or equal to 2 and n is a positive integer.

[0056] Specifically, based on the above, the first and second image frames corresponding to the same time period in the two image acquisition cycles exhibit certain regularities. For example, 8:00-10:00 AM on two days within a week (such as Monday and Tuesday) are both peak morning hours, showing similarities in target traffic and target type. In this application, using the first image frame as a reference frame to encode the second image frame corresponding to the acquisition time can reduce repetitive encoding of recurring scenes and improve bitrate gains. Furthermore, for the first image frame in the reference video sequence, using the (n-1)th first image frame as a reference frame, the nth first image frame is encoded to obtain the bitstream, where n is greater than or equal to 2 and is a positive integer.

[0057] In one embodiment of this application, the reference video sequence is further divided into multiple first video segments, each first video segment including at least a portion of first image frames. The subsequent video sequence includes multiple second video segments, each second video segment including at least a portion of second image frames. In one embodiment, the video segment can be divided according to the number of image frames, for example, a preset number of first image frames can be divided into a first video segment, and similarly, a preset number of second image frames can be divided into a second video segment. It is understood that the acquisition time of the first video segment and the second video segment corresponds. Alternatively, in another embodiment, the video segments can be divided by time, for example, dividing it into 24 video segments according to a 24-hour day, with each video segment including one hour of video; or it can be divided into 12 video segments, with each video segment including two hours of video, without specific limitation. This allows the reference video frame to be divided into multiple first video segments, and the subsequent video sequence to be divided into multiple second video segments. It should be noted that the acquisition time of the first video segment and the second video segment corresponds; for example, if the first video segment includes one hour of video, then the second video segment also includes one hour of video, and these two video segments correspond to the same time period within two days.

[0058] Furthermore, the video encoding method includes multiple encoding segments, each of which is used to encode the first video segment and the second video segment corresponding to the acquisition time.

[0059] In each of the encoded segments, the first image frame in the first video segment is used as a reference frame to encode the second image frame in the second video segment corresponding to the acquisition time; and the (m-1)th first image frame in the first video segment is used as a reference frame to encode the mth first image frame; wherein m is greater than or equal to 2 and m is a positive integer less than or equal to n.

[0060] In one specific embodiment, combined with Figure 2 Assuming there are 7 image acquisition cycles, corresponding to 7 days in a week, the first video sequence is determined as the baseline video sequence, and the rest are subsequent video sequences, including subsequent video sequences 1-6. The complete encoding method is divided into encoding multiple coding segments, which are used to complete the encoding of the video to be encoded.

[0061] Specifically, in one encoding segment, the first image frame in the first video segment is used as a reference frame to encode the second image frame in the second video segment corresponding to the acquisition time; the (m-1)th first image frame in the first video segment is used as a reference frame to encode the m-th first image frame; where m is greater than or equal to 2 and m is a positive integer less than or equal to n. It should be noted that in the first encoding segment, the first first image frame does not have a reference frame; it only needs to be sent to the encoder as a reference frame for encoding other image frames. For example, the first first image frame is used as a reference frame to encode the second video segment corresponding to the acquisition time, and the first first image frame is used as a reference frame to encode the second first image frame.

[0062] Furthermore, each of the encoding segments includes multiple encoding cycles, each encoding cycle being used to encode the first image frame and the second image frame corresponding to the acquisition time; in each encoding cycle, the first image frame preceding the current first image frame is used as a reference frame to encode the current first image frame; and the second image frame is used as a reference frame to encode the current first image frame.

[0063] Specifically, this application Figure 2 Taking a coding segment consisting of 3 coding cycles as an example, in other embodiments, a coding segment may include other numbers of coding cycles, depending on the coding algorithm, and no specific limitation is made.

[0064] like Figure 2As shown, in the first encoding cycle, the order in which the data is fed into the encoder for encoding is: ① the first first image frame 1, ② the first second image frame 2 in subsequent video sequence 1, ③ the first second image frame 2 in subsequent video sequence 2, ... ⑦ the first second image frame 2 in subsequent video sequence 6; wherein, the first first image frame 1 is used as the reference frame when encoding the first second image frame 2 in subsequent video sequence 1, the first second image frame 2 in subsequent video sequence 2, ... the first second image frame 2 in subsequent video sequence 6.

[0065] In the second encoding cycle, the order in which the encoder sends the frames for encoding is as follows: ① the second first image frame 1, ② the second second image frame 2 in subsequent video sequence 1, ③ the second second image frame 2 in subsequent video sequence 2, ... ⑦ the second second image frame 2 in subsequent video sequence 6, and so on. It should be noted that the first first image frame 1 is used as the reference frame when encoding the second first image frame 1. Similarly, the second second image frame 2 in subsequent video sequence 1, the second second image frame 2 in subsequent video sequence 2, ... the second second second image frame 2 in subsequent video sequence 6 are encoded using the second first image frame 1 as the reference frame.

[0066] It should be noted that when encoding the first video segment, the first first image frame 1 in the first video segment is used as the key frame I frame, and the remaining first image frames are used as prediction frames P frames.

[0067] The video encoding method of this application establishes a corresponding encoding process based on the periodicity of the video, which can reuse reference frames across time, solve the problems of redundancy in repeated scenes, high data repetition rate, high storage cost, and waste of storage space, and improve the bit rate.

[0068] Furthermore, this application also provides a video decoding method for decoding the bitstream obtained by any of the above video encoding methods. Specifically, the video decoding method of this application includes: decoding the bitstream corresponding to a first image frame in the bitstream to obtain multiple first image frames; and decoding the bitstream corresponding to a second image frame in the bitstream based on the first image frames to obtain multiple second image frames, wherein the multiple first image frames form a reference video sequence, the multiple second image frames form a subsequent video sequence, and the reference video sequence and the subsequent video sequence form the video to be encoded.

[0069] See Figure 3 , Figure 3 This is a schematic diagram of the structure of an embodiment of the electronic device of this application. The electronic device is used to implement the above-described video encoding method and video decoding method. The electronic device includes: an acquisition unit 31, an encoding unit 32 and a decoding unit 33.

[0070] The acquisition unit 31 is used to acquire the video to be encoded, which includes multiple video sequences. The multiple video sequences are acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponds to one image acquisition cycle. The multiple video sequences include a reference video sequence and subsequent video sequences. The reference video sequence includes multiple first image frames, and the subsequent video sequence includes multiple second image frames. The acquisition time of the first image frames and the second image frames corresponds.

[0071] The encoding unit 32 is used to encode the second image frame corresponding to the acquisition time using the first image frame as a reference frame, and to encode the nth first image frame using the (n-1)th first image frame as a reference frame to obtain a bitstream; where n is greater than or equal to 2 and n is a positive integer;

[0072] The decoding unit 33 is used to decode the bitstream corresponding to the first image frame in the bitstream to obtain multiple first image frames; and to decode the bitstream corresponding to the second image frame in the bitstream based on the first image frame to obtain multiple second image frames. The multiple first image frames form a reference video sequence, the multiple second image frames form a subsequent video sequence, and the reference video sequence and the subsequent video sequence form the video to be encoded.

[0073] Please see Figure 4 , Figure 4 This is a schematic diagram of a framework of an embodiment of the electronic terminal provided in this application. The electronic terminal 80 includes a memory 81 and a processor 82 coupled to each other. The processor 82 is used to execute program instructions stored in the memory 81 to implement the steps of any of the above-described video encoding and video decoding method embodiments. In a specific implementation scenario, the terminal 80 may include, but is not limited to, a microcomputer or a server. In addition, the terminal 80 may also include mobile devices such as laptops and tablets, which are not limited here.

[0074] Specifically, processor 82 controls itself and memory 81 to implement the steps of any of the above-described video encoding and video decoding method embodiments. Processor 82 can also be referred to as a CPU (Central Processing Unit). Processor 82 may be an integrated circuit chip with signal processing capabilities. Processor 82 can also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (MSIC), a field-programmable gate array (FPGM), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. A general-purpose processor can be a microprocessor or any conventional processor. Furthermore, processor 82 can be implemented using integrated circuit chips.

[0075] Please see Figure 5 , Figure 5 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. The computer-readable storage medium 90 stores program instructions 901 that can be executed by a processor. The program instructions 901 are used to implement the steps of any of the above-described video encoding and video decoding method embodiments.

[0076] In some embodiments, the functions or modules of the apparatus provided in this disclosure can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.

[0077] The description of the various embodiments above tends to emphasize the differences between the various embodiments. Their similarities or similarities can be used as a benchmark for each other. For the sake of brevity, these will not be repeated here.

[0078] In the several embodiments provided in this application, it should be understood that the disclosed methods and apparatus can be implemented in other ways. For example, the apparatus implementations described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection of devices or units may be electrical, mechanical, or other forms.

[0079] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0080] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RMM), magnetic disks, or optical disks.

[0081] The above are merely embodiments of the present invention and do not limit the scope of patent protection of the present invention. Any equivalent structural or procedural transformations made based on the content of the present invention’s specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.

Claims

1. A video encoding method, characterized in that, include: The video to be encoded is acquired, which includes multiple video sequences. The multiple video sequences are acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponds to one image acquisition cycle. The multiple video sequences include a reference video sequence and subsequent video sequences. The reference video sequence includes multiple first image frames, and the subsequent video sequence includes multiple second image frames. The acquisition time of the first image frames and the second image frames corresponds. Using the first image frame as a reference frame, the second image frame corresponding to the acquisition time is encoded, and using the (n-1)th first image frame as a reference frame, the nth first image frame is encoded to obtain a bitstream; where n is greater than or equal to 2 and n is a positive integer.

2. The video encoding method according to claim 1, characterized in that, The reference video sequence includes multiple first video segments, each of which includes at least a portion of the first image frames; the subsequent video sequence includes multiple second video segments, each of which includes at least a portion of the second image frames; the first video segments and the second video segments are acquired at corresponding times; the video encoding method includes multiple encoding segments, each of which is used to encode the first video segment and the second video segment corresponding to the acquisition time; In each of the encoded segments, the first image frame in the first video segment is used as a reference frame to encode the second image frame in the second video segment corresponding to the acquisition time; and the (m-1)th first image frame in the first video segment is used as a reference frame to encode the mth first image frame; wherein m is greater than or equal to 2 and m is a positive integer less than or equal to n.

3. The video encoding method according to claim 2, characterized in that, Each of the coded segments includes multiple coded cycles, and each coded cycle is used to encode the first image frame and the second image frame corresponding to the acquisition time; In each encoding cycle, the current first image frame is encoded using the preceding first image frame as a reference frame; and the second image frame is encoded using the current first image frame as a reference frame.

4. The video encoding method according to claim 1, characterized in that, The benchmark video sequence includes: among the plurality of video sequences, the video sequence whose correlation with other video sequences is greater than a first threshold.

5. The video encoding method according to claim 4, characterized in that, The video encoding method includes: Calculate the sum of the correlations between the current video sequence and other video sequences among the multiple video sequences to obtain the correlation parameter of the current video sequence; The video sequence with the highest correlation parameter is used as the benchmark video sequence.

6. The video encoding method according to claim 1, characterized in that, Among the plurality of video sequences, the similarity between any two video sequences is greater than a second threshold.

7. The video encoding method according to claim 6, characterized in that, Before obtaining the video to be encoded, the following steps are included: Obtain the initial video to be encoded, which includes multiple initial video sequences. Calculate the similarity between the current initial video sequence and other initial video sequences among the plurality of initial video sequences; If the similarity is greater than the second threshold, then the initial video sequence is used as the video to be encoded.

8. A video decoding method, characterized in that, The video decoding method is used to decode the bitstream obtained by the video encoding method according to any one of claims 1 to 7, and the video decoding method includes: The bitstream corresponding to the first image frame in the bitstream is decoded to obtain multiple first image frames; and the bitstream corresponding to the second image frame in the bitstream is decoded based on the first image frames to obtain multiple second image frames. The multiple first image frames form a reference video sequence, the multiple second image frames form a subsequent video sequence, and the reference video sequence and the subsequent video sequence form a video to be encoded.

9. An electronic device, characterized in that, The electronic device is used to implement the video encoding method according to any one of claims 1 to 7; the electronic device includes: The acquisition unit is used to acquire a video to be encoded, the video to be encoded including multiple video sequences, the multiple video sequences being acquired by the same image acquisition device in multiple image acquisition cycles, and one video sequence corresponding to one image acquisition cycle; the multiple video sequences include a reference video sequence and subsequent video sequences, the reference video sequence including multiple first image frames, the subsequent video sequence including multiple second image frames, and the acquisition time of the first image frames and the second image frames corresponding; The encoding unit is used to encode the second image frame corresponding to the acquisition time using the first image frame as a reference frame, and to encode the nth first image frame using the (n-1)th first image frame as a reference frame to obtain a bitstream; wherein n is greater than or equal to 2 and n is a positive integer; Furthermore, the electronic device is used to implement the video decoding method according to claim 8; the electronic device further includes: The decoding unit is configured to decode the bitstream corresponding to the first image frame in the bitstream to obtain a plurality of first image frames; and to decode the bitstream corresponding to the second image frame in the bitstream based on the first image frames to obtain a plurality of second image frames, wherein the plurality of first image frames form a reference video sequence, the plurality of second image frames form a subsequent video sequence, and the reference video sequence and the subsequent video sequence form a video to be encoded.

10. An electronic terminal, characterized in that, The electronic terminal includes a memory and a processor coupled to each other. The processor is used to execute program instructions stored in the memory and to execute program data to implement the steps in the video encoding method as described in any one of claims 1 to 7 and the video decoding method as described in claim 8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the video encoding method as described in any one of claims 1 to 7 and the video decoding method as described in claim 8.