Video processing method, device and electronic equipment

By recording and copying the storage location information of I-frame and P-frame data in the video file, the problem of excessive storage space occupied by the increase in I-frame interval in the wireless transmission environment is solved, and independent decoding playback and device applicability are improved.

CN119402611BActive Publication Date: 2025-04-01HANGZHOU HIKVISION DIGITAL TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411974572.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-30
Publication Date
2025-04-01
Estimated Expiration
2044-12-30

AI Technical Summary

Technical Problem

In wireless transmission environments, in order to adapt to the small channel capacity, the I-frame interval is usually increased, resulting in excessive storage space occupies when decoding videos. The prior art relies on the previous video file for cache and encoding, resulting in limited device memory burden and device applicability.

Method used

By recording the storage location information of the last I-frame data in the first video file and the subsequent P-frame data, and copying these data as a starting frame in the second video file, the storage space is reduced, and the second video file can be independently decoded and played without relying on the previous video file.

Benefits of technology

It realizes the reduction of storage space usage during video decoding, reduces the occurrence of video rebounce problems, and improves the applicability of the device, so that encoding and decoding can be performed independently.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119402611B_ABST
    Figure CN119402611B_ABST
Patent Text Reader

Abstract

The embodiment of the present application provides a video processing method, device and electronic device, which relates to the field of video processing technology. In the process of collecting a first video file, the storage position information of the first target frame data in the first video file is recorded, wherein the first target frame data includes the last I frame data in the first video file, and the P frame data after the last I frame data; when the first video file is collected, according to the storage position information, the first target frame data is copied to the starting position of the second video file, and other frame data of the second video file is collected, and the other frame data is stored in the position after the first target frame data in the second video file; the second target frame data in the first video file is deleted, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data. The embodiment of the present application reduces the storage space occupied when decoding the video.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to a video processing method, device and electronic equipment. Background Art

[0002] I-frame (Intra-coded picture) refers to a key frame, which is a complete preservation of a frame. P-frame (Predictive-coded Picture) refers to the difference between the current frame and the previous key frame. The I-frame and the subsequent P-frame data can jointly generate a video picture. When decoding recorded video, the first frame data of each recorded video clip must be an I-frame to ensure that the video playback after decoding is not lost. The I-frame interval refers to the time interval or frame number interval between two I-frames in video encoding. The larger the I-frame interval, the higher the possibility of video distortion after decoding. The smaller the interval, the larger the video data volume, and the higher the storage pressure and transmission bandwidth requirements.

[0003] In order to adapt to the development trend of wireless and match the characteristics of wireless transmission, which has fast transmission speed but small channel capacity and limited data transmission, the I frame interval is usually increased in the encoding design of video recording. In this case, in order to avoid frame loss and ensure video quality, the last I frame of the previous video file and the P frame data after it are usually copied to the beginning of the next video file to ensure that the first frame of each video clip is an I frame. However, this method will cause the last I frame of the previous video file and the P frame data after it to be stored repeatedly, which takes up too much space.

[0004] In order to solve this problem, a decoding method for concurrent video session IP frame image groups is proposed in the related art (see CN112449196A). When decoding two segments of video data, this solution first caches and decodes the first segment of video data, encodes the non-I frame of the tail frame in the first segment of video data as an I frame, splices the encoded new I frame with the tail frame data, and then splices it with the first frame of the next segment of video data to ensure that the next segment of video data can be decoded starting from the I frame. However, this method requires that the decoding of each video data needs to cache and encode the previous video data first, which is too dependent on the previous video data, still causing a memory burden on the device during decoding, and is not applicable to devices that only have decoding capabilities but no encoding capabilities. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a video processing method, device and electronic device to reduce the storage space occupied by video decoding. The specific technical solution is as follows:

[0006] In a first aspect, an embodiment of the present application provides a video processing method, including:

[0007] In the process of acquiring the first video file, recording storage location information of the first target frame data in the first video file, wherein the first target frame data includes the last I frame data in the first video file and the P frame data after the last I frame data;

[0008] When the acquisition of the first video file is completed, copying the first target frame data to the starting position of the second video file according to the storage position information, acquiring other frame data of the second video file, and storing the other frame data in the position after the first target frame data in the second video file;

[0009] Delete the second target frame data in the first video file, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data.

[0010] In a possible implementation, when the second target frame data is P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes:

[0011] When the first video file is sent, analyzing the data type of the last frame data in the first video file, and recording identification information of the last frame data when the data type of the last frame data is I frame data;

[0012] Before sending the second video file, analyzing the data type of the first frame data in the second video file, and recording identification information of the first frame data when the data type of the first frame data is I frame data;

[0013] Compare identification information of the last frame data in the first video file and the first frame data in the second video file;

[0014] When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the first frame data in the second video file is not sent, and the second video file is sent, wherein the first video file and the second video file are two consecutive video recordings.

[0015] In a possible implementation, when the second target frame data is P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes:

[0016] Before sending the first video file and the second video file, analyzing the data types of the last frame data in the first video file and the first frame data in the second video file;

[0017] When the data types of the last frame data in the first video file and the first frame data in the second video file are both I-frame data, comparing the identification information of the last frame data and the first frame data;

[0018] When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the last frame data in the first video file is not sent, and the first video file and the second video file are sent.

[0019] In a possible implementation manner, after deleting the second target frame data in the first video file, the method further includes:

[0020] When the collection of the second video file is completed, the first video file and the second video file are sent in sequence.

[0021] In a possible implementation, when the second target frame data is P frame data after the last I frame data, deleting the second target frame data in the first video file includes:

[0022] Acquire storage location information of the second target frame data and length information of the first video file;

[0023] determining length information of the second target frame data based on storage location information of the second target frame data;

[0024] According to the length information of the second target frame data, the length information of the first video file is modified to be the length after the second target frame data is removed.

[0025] In a second aspect, an embodiment of the present application provides a video processing device, including:

[0026] An information recording module, used for recording storage location information of first target frame data in the first video file during the process of collecting the first video file, wherein the first target frame data includes the last I frame data in the first video file and the P frame data after the last I frame data;

[0027] A video capture module, configured to copy the first target frame data to the starting position of a second video file according to the storage position information when the first video file is captured, capture other frame data of the second video file, and store the other frame data in a position after the first target frame data in the second video file;

[0028] The data deletion module is used to delete the second target frame data in the first video file, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data.

[0029] In a possible implementation manner, the device further includes:

[0030] A first identification information recording module is used to analyze the data type of the last frame data in the first video file when the first video file is sent, and record the identification information of the last frame data when the data type of the last frame data is I frame data;

[0031] A second identification information recording module is used to analyze the data type of the first frame data in the second video file before the second video file is sent, and record the identification information of the first frame data when the data type of the first frame data is I frame data;

[0032] A first identification information comparison module, used to compare identification information of the last frame data in the first video file and the first frame data in the second video file;

[0033] The first video sending module is used for not sending the first frame data in the second video file and sending the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, wherein the first video file and the second video file are two consecutive video recordings.

[0034] In a possible implementation manner, the device further includes:

[0035] A data analysis module, used for analyzing the data types of the last frame data in the first video file and the first frame data in the second video file before sending the first video file and the second video file;

[0036] an identification information comparison module, configured to compare identification information of the last frame data and the first frame data when both the data types of the last frame data and the first frame data are I frame data;

[0037] The second video sending module is used for not sending the last frame data in the first video file, but sending the first video file and the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data.

[0038] In a possible implementation manner, the device further includes:

[0039] The third video sending module is used to send the first video file and the second video file in sequence when the collection of the second video file is completed.

[0040] In a possible implementation, the data deletion module is specifically used to:

[0041] Acquire storage location information of the second target frame data and length information of the first video file;

[0042] determining length information of the second target frame data based on storage location information of the second target frame data;

[0043] According to the length information of the second target frame data, the length information of the first video file is modified to be the length after the second target frame data is removed.

[0044] In a third aspect, an embodiment of the present application provides an electronic device, including:

[0045] Memory, used to store computer programs;

[0046] The processor is used to implement any of the above-mentioned video recording processing methods when executing the program stored in the memory.

[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, any of the above-mentioned video recording processing methods is implemented.

[0048] The embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the above-mentioned video recording processing methods.

[0049] Beneficial effects of the embodiments of the present application:

[0050] The video processing method, device, electronic device and storage medium provided by the embodiment of the present application record the storage location information of the last I frame data and the P frame data thereafter in the first video file during the process of collecting the first video file. When the first video file is collected, the last I frame data and the P frame data thereafter are quickly located according to the storage location information, thereby improving the efficiency of video processing. The first target frame data are all copied to the starting position of the second video file, and then other frame data of the second video file are collected, and the other frame data are stored in the position after the first target frame data in the second video file, so that the second video file must start with the I frame data, thereby ensuring that the second video file can be decoded and played independently without relying on the previous video file. In addition, encoding and decoding can be performed independently, and the decoding device does not need to have encoding capabilities, and the device is more widely applicable. The second target frame data in the first video file is deleted, the same frame data in the two video files is reduced, the problem of continuous playback of video repetition caused by a large I frame interval is reduced as much as possible, and the occurrence of video replay problems is reduced. At the same time, the repeated occupation of device storage is reduced, and the storage pressure brought by the video file to the device is reduced during decoding cache and storage.

[0051] Of course, implementing any product or method of the present application does not necessarily require achieving all of the advantages described above at the same time. BRIEF DESCRIPTION OF THE DRAWINGS

[0052] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other embodiments can also be obtained based on these drawings.

[0053] Figure 1 A schematic diagram of a video processing method in the related art;

[0054] Figure 2 A first flow chart of the video processing method according to an embodiment of the present application;

[0055] Figure 3 A second flow chart of the video processing method according to an embodiment of the present application;

[0056] Figure 4 This is a schematic diagram of the first storage solution for video files in the acquisition device;

[0057] Figure 5 This is a schematic diagram of the first sending solution of the video file in the acquisition device;

[0058] Figure 6A third flow chart of the video processing method according to an embodiment of the present application;

[0059] Figure 7-1 This is a schematic diagram of a second storage solution for video files in a collection device;

[0060] Figure 7-2 This is a schematic diagram of the second sending solution of the video file in the acquisition device;

[0061] Figure 8 The third method for sending video files in the acquisition device is shown in FIG.

[0062] Fig. 9 A schematic diagram of a possible implementation of step S103 in an embodiment of the present application;

[0063] Fig.10 A schematic diagram of the structure of a video processing device according to an embodiment of the present application;

[0064] Fig.11 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0065] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.

[0066] First, the professional terms mentioned in the embodiments of the present application are explained:

[0067] I frame: Also known as intra picture, I frame is the first frame of each GOP (a video compression technology used by MPEG (motion picture experts group standard)). It is moderately compressed and used as a reference point for random access. In the MPEG encoding process, part of the video frame sequence is compressed into I frames, part into P frames, and part into B frames (bidirectional interpolation frames). I frame method is an intra-frame compression method, also known as "key frame" compression method. I frame method is a compression technology based on discrete cosine transform (DCT). Using I frame compression can achieve a compression ratio of 1 / 6 without obvious compression traces. I frame is a full-frame compression encoding frame. It compresses and transmits the full-frame image information in JPEG (image format). When decoding, only the data of I frame can reconstruct the complete image. I frame describes the details of the image background and moving subject. It does not need to refer to other pictures to generate, and does not need to consider motion vectors. It is a reference frame for P frames and B frames. Its quality directly affects the quality of subsequent frames in the same group. The amount of information occupied by I frame data is relatively large.

[0068] P frame: P frame indicates the difference between this frame and the previous key frame (or P frame). When decoding, the difference defined in this frame needs to be superimposed with the previously cached picture to generate the final picture. P frame does not have complete picture data, but only the picture difference data with the previous frame. Specifically, P frame uses I frame as reference frame, finds the prediction value and motion vector of "some point" of P frame in I frame, takes the prediction difference and motion vector and transmits them together. The receiving end finds the prediction value of "some point" of P frame from I frame according to the motion vector and adds it to the difference to obtain the sample value of "some point" of P frame, so as to obtain the complete P frame. P frame is a coded frame separated by 1-2 frames after I frame. P frame uses motion compensation to transmit the difference and motion vector between it and the previous I or P frame. When decoding, the prediction value in I frame and prediction error must be summed to reconstruct the complete P frame image. P frame belongs to forward prediction inter-frame coding. It only refers to the I frame or P frame closest to it in front. P frame can be the reference frame of the P frame behind it, or the reference frame of the B frame before and after it. Since P frames are reference frames, they may cause the spread of decoding errors. Since they are transmitted as differential values, the compression of P frames is relatively high. Therefore, the decoding of a video must start from the I frame.

[0069] I-frame interval: refers to the time or frame interval between two I-frames in video encoding. Since I-frames are complete image frames and do not depend on other frames, they can be decoded independently, while P-frames and B-frames are encoded by referring to previous frames to reduce the amount of data. The setting of I-frame interval will affect the compression rate and quality of the video. A smaller I-frame interval can provide better random access performance. When playing a video, you can locate a specific frame more quickly. Since the amount of data in I-frames is usually larger than that in P-frames and B-frames, this will increase the amount of data in the video. A larger I-frame interval can reduce the amount of data, but it will affect the random access performance and video quality, especially when packet loss occurs during network transmission. The I-frame interval will affect the image clarity, video smoothness, data volume and storage requirements of the video quality, and is usually set according to the requirements of different application scenarios. For example, in a video surveillance system, the I-frame interval is adjusted according to the storage requirements and real-time requirements: if you need to quickly view the picture at a specific moment, set a smaller I-frame interval; if storage resources are limited, set a larger I-frame interval to reduce the storage space occupied.

[0070] Traditional security systems mostly transmit video recordings via wired channels, usually with a smaller I-frame interval, such as 1 second. However, in order to adapt to the development trend of wireless, due to the small capacity of wireless channels, susceptibility to interference, and poor signal-to-noise ratio, the wireless signal is weak over long distances or in the presence of obstacles, and the amount of data that can be transmitted is limited. It is necessary to set a smaller I-frame interval to reduce the amount of data transmitted, such as 10 seconds, 20 seconds, or even 60 seconds. In this case, when playing back the video continuously, it is easy to have a serious problem of video replay, for example, the video has been played to 10:50 seconds, and then it starts again from 10:40 seconds. The main reasons for this problem are:

[0071] Due to the limitations of the file system and management requirements, recorded videos are stored one file at a time, which is convenient for display and management. When recording is turned on 24 hours a day, the recorded videos are also recorded one by one. In order to ensure that each video clip can be decoded and played independently, the first frame data of the video file must be I frame data, otherwise the beginning cannot be played and it is necessary to wait until the next I frame to decode and play, which is equivalent to the loss of the beginning video. However, since the timing of switching the video to a new file storage is affected by many factors, such as the size limit of the video file, the speed of writing the video file is affected by the encoding bit rate, the encoding rate is related to the current picture scene, and the picture scene has uncertainty, it is impossible to ensure that the I frame data is encoded when the video file is switched.

[0072] To solve this problem, a common method is to copy the last I frame and the P frame data after it of the previous video file to the beginning of the next video file, and then store the data in the video buffer at the beginning of the next video file, so as to ensure that the beginning of each video clip is an I frame. Figure 1 As shown in the figure, this results in a video repetition with an I-frame interval between the previous video file and the next video file. When the video files are played continuously and the I-frame interval is large, the above-mentioned video rewind problem will occur.

[0073] In order to solve the problem of video rewinding, the related technology (CN112449196A) caches and decodes the first video data segment first when decoding two video data segments, encodes the non-I frame of the tail frame in the first video data segment as an I frame, splices the encoded new I frame with the tail frame data, and then splices it with the first frame of the next video data segment to ensure that the next video data segment can be decoded starting from the I frame. However, this method requires that the previous video data be cached and encoded before decoding each video data segment. The decoded data is too dependent on the previous video data segment, which still causes a memory burden on the device during decoding, and is not applicable to devices that only have decoding capabilities but no encoding capabilities.

[0074] In order to solve at least one of the above problems, a video processing method is provided in a first aspect of an embodiment of the present application. The method can be executed by an electronic device. Specifically, the electronic device can be an industrial computer, a personal computer, a server, etc. connected to a video acquisition device.

[0075] The video recording processing method of the embodiment of the present application is described in detail below. Figure 2 , Figure 2 The first flow chart of the video processing method of the embodiment of the present application includes:

[0076] S101, in the process of collecting a first video file, recording storage location information of first target frame data in the first video file;

[0077] The first target frame data includes the last I frame data in the first video file, and the P frame data after the last I frame data.

[0078] When the video capture device captures the scene video, it captures it in a file-by-file manner, and each video file is a video clip. In the case of continuous capture, each video file is a continuous video clip.

[0079] The storage position information of the first target frame refers to the position information of the first target frame in the first video file, and specifically, it may be the starting position offset and the ending position offset of the first target frame in the first video file. The offset refers to the relative offset compared to the starting position of the first video file. According to the starting position offset and the ending position offset of the first target frame, the length information of the first target frame may be obtained. Specifically, the total length of the last I frame data and the P frame data after the last I frame data may be obtained respectively, and the length of the P frame data after the last I frame data may also be obtained.

[0080] S102, when the acquisition of the first video file is completed, copy the first target frame data to the starting position of the second video file according to the storage position information, acquire other frame data of the second video file, and store the other frame data in the position after the first target frame data in the second video file;

[0081] When collecting videos, the start and end positions of each video file stored in the device are recorded, as well as the current length of the video file in the current length information of the first video file. When the current length information reaches the preset length, it means that the collection of the first video file is completed. Specifically, the preset length is set according to the storage status of the collection device.

[0082] After the first video file is collected, the first target frame data is quickly located in the first video file according to the storage location information of the first target frame data, the first target frame data is copied to the starting position of the second video file, and then other video frame data of the second video file is collected, so that the collected video frame data of the second video file continues after the first target frame data.

[0083] S103, deleting the second target frame data in the first video file;

[0084] The second target frame data is the first target frame data, or the P frame data after the last I frame data.

[0085] Delete the P frame data after the last I frame data in the first video file, and use the last I frame data as the last frame data, or delete the last I frame data and the P frame data after it, and use the P frame data before the last I frame data as the last frame data.

[0086] As can be seen from the above, the video processing method provided by the embodiment of the present application records the storage position information of the last I frame data and the P frame data thereafter in the first video file during the process of collecting the first video file. When the first video file is collected, the last I frame data and the P frame data thereafter are quickly located according to the storage position information, thereby improving the efficiency of video processing. The first target frame data are all copied to the starting position of the second video file, and then other frame data of the second video file are collected, and the other frame data are stored in the position after the first target frame data in the second video file, so that the second video file must start with the I frame data, thereby ensuring that the second video file can be decoded and played independently without relying on the previous video file. In addition, encoding and decoding can be performed independently, and the decoding device does not need to have encoding capabilities, and the device is more widely applicable. Deleting the second target frame data in the first video file reduces the same frame data in the two video files, minimizes the problem of continuous playback of video repetitions caused by large I frame intervals, reduces the occurrence of video replay problems, and reduces the repeated occupation of device storage, and reduces the storage pressure brought to the device by the video file during decoding cache and storage.

[0087] In one possible implementation, see Figure 3 , in the case where the second target frame data is the P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes:

[0088] S201, when the first video file is sent, analyzing the data type of the last frame data in the first video file, and when the data type of the last frame data is I frame data, recording identification information of the last frame data;

[0089] S202, before sending the second video file, analyzing the data type of the first frame data in the second video file, and recording identification information of the first frame data if the data type of the first frame data is I frame data;

[0090] S203, comparing identification information of the last frame data in the first video file and the first frame data in the second video file;

[0091] S204: When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the first frame data in the second video file is not sent, and the second video file is sent;

[0092] The first video file and the second video file are two consecutive video recordings.

[0093] Delete the P frame data after the last I frame data in the first video file. At this time, the first video file ends with the last I frame data. At this time, the storage scheme of the first video file and the second video file in the acquisition device is as follows: Figure 4 shown.

[0094] After the video capture device completes the acquisition, the video file needs to be sent to other devices for further processing, such as decoding and playback. When the first video file is sent, the data type of the last frame data of the first video file is analyzed. When the last frame data is I frame data, the identification information of the last frame data is recorded. Specifically, the identification information includes the data volume size, length information, relative time scale and absolute time scale of the I frame data. The relative time scale refers to the recording clock information of the last frame data in the video capture device. For example, the clock information when the device is turned on is 0 (the world time at this time can be, for example, 10:00:00 on December 3, 2024). The clock information increases monotonically in microseconds. The clock information when the last frame data is collected can be, for example, 2000 microseconds; the absolute time scale refers to the world time when the last frame data is collected, for example, at 22:00:00 on December 5, 2024.

[0095] Before sending the second video file, analyze the data type of the first frame data in the second video file, and record the identification information of the first frame data if the first frame data is I frame data. Compare the first frame data of the second video file with the last frame data of the first video file based on the identification information. If the identification information is completely consistent, it means that the two frames of data are the same frame data, then skip the first frame data of the second video file and do not send it, and only send the remaining data of the second video file, such as Figure 5 As shown, the arrows in the figure indicate the sending order.

[0096] As can be seen from the above, in the video processing method provided by the embodiment of the present application, when the first video file is sent, before the second video file is sent, when the last frame data of the first video file and the first frame data of the second video file are the same frame data, the first frame data of the second video file is skipped and not sent, and only the remaining data is sent. Since the first video file and the second video file are two consecutive video recordings, they are usually processed continuously during decoding and playback, so the last frame data of the first video file can be used to decode and play the second video file, thereby further reducing the storage pressure of the decoding device and reducing the occurrence of video rewind problems.

[0097] In one possible implementation, see Figure 6 , in the case where the second target frame data is the P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes:

[0098] S301, before sending a first video file and a second video file, analyzing the data types of the last frame data in the first video file and the first frame data in the second video file;

[0099] S302, when the data types of the last frame data in the first video file and the first frame data in the second video file are both I-frame data, compare identification information of the last frame data and the first frame data;

[0100] S303: When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the last frame data in the first video file is not sent, and the first video file and the second video file are sent.

[0101] The first frame data of the second video file is compared with the last frame data of the first video file according to the identification information. If the identification information is completely consistent, it means that the two frames of data are the same frame data, then the last frame data of the first video file is skipped and not sent, and only the other data before the last I frame data of the first video file is sent. The second video file is sent in full. Figure 7-1 and Figure 7-2 shown.

[0102] As can be seen from the above, in the video processing method provided in the embodiment of the present application, the first video file only sends other data before the last I frame data, and the second video file is sent in full, including the last I frame data copied from the first video file to the second video file and the P frame data thereafter, so that when the second video file arrives at other devices, the starting frame is still I frame data, thereby ensuring that the second video file can be decoded and played independently, reducing the occurrence of video rewind problems.

[0103] In a possible implementation manner, after deleting the second target frame data in the first video file, the method further includes:

[0104] When the collection of the second video file is completed, the first video file and the second video file are sent in sequence.

[0105] When the acquisition of the second video file is completed, there is no need to process the first video file and the second video file again, and the two video files can be directly sent in sequence, thereby improving the efficiency of video sending.

[0106] When the second target frame data is the first target frame data, the first video file ends with the P frame data before the last I frame data, which ensures the independence of decoding and playing the second video file and reduces the occurrence of video rewinding problems.

[0107] When the second target frame data is the P frame data after the last I frame data, the first video file ends with the last I frame data. The storage scheme in the acquisition device is as follows: Figure 4 As shown, the sending scheme is as follows Figure 8 The first video file and the second video file only repeat the last I frame data, and do not repeat the P frame data, which reduces the storage space occupied and the occurrence of video replay problems, while ensuring the analyzability of the association between the first video file and the second video file.

[0108] In one possible implementation, see Fig. 9 , when the second target frame data is P frame data after the last I frame data, deleting the second target frame data in the first video file includes:

[0109] S401, obtaining storage location information of second target frame data and length information of the first video file;

[0110] S402, determining length information of the second target frame data based on storage location information of the second target frame data;

[0111] S403: According to the length information of the second target frame data, modify the length information of the first video file to the length after removing the second target frame data.

[0112] When modifying the length information of the first video file, the length information is modified to the current length minus the length of the deleted second target frame data. The data deletion here does not actually clear the data, but only modifies the attribute information stored in the video file. Since the second target frame data only includes P frame data that occupies less memory and has a smaller data volume, and does not include I frame data that occupies more memory and has a larger data volume, it can reduce the time for deleting data while reducing repeated storage occupation, and reduce the performance consumption of the acquisition device in processing data.

[0113] See also Fig.10 The embodiment of the present application also provides a structural schematic diagram of a video processing device, including:

[0114] The information recording module 501 is used to record the storage location information of the first target frame data in the first video file during the process of collecting the first video file, wherein the first target frame data includes the last I frame data in the first video file and the P frame data after the last I frame data;

[0115] The video acquisition module 502 is used for, when the acquisition of the first video file is completed, copying the first target frame data to the starting position of the second video file according to the storage position information, acquiring other frame data of the second video file, and storing the other frame data in the position after the first target frame data in the second video file;

[0116] The data deletion module 503 is used to delete the second target frame data in the first video file, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data.

[0117] As can be seen from the above, the video processing device provided by the embodiment of the present application records the storage position information of the last I frame data and the P frame data thereafter in the first video file during the process of collecting the first video file. When the first video file is collected, the last I frame data and the P frame data thereafter are quickly located according to the storage position information, thereby improving the efficiency of video processing. The first target frame data are all copied to the starting position of the second video file, and then other frame data of the second video file are collected, and the other frame data are stored in the position after the first target frame data in the second video file, so that the second video file must start with the I frame data, thereby ensuring that the second video file can be decoded and played independently without relying on the previous video file. In addition, encoding and decoding can be performed independently, and the decoding device does not need to have encoding capabilities, and the device is more widely applicable. Deleting the second target frame data in the first video file reduces the same frame data in the two video files, minimizes the problem of continuous playback of video repetitions caused by a large I frame interval, reduces the occurrence of video replay problems, and reduces the repeated occupation of device storage, and reduces the storage pressure brought to the device by the video file during decoding cache and storage.

[0118] In a possible implementation, the device further includes:

[0119] A first identification information recording module is used to analyze the data type of the last frame data in the first video file when the first video file is sent, and record the identification information of the last frame data when the data type of the last frame data is I frame data;

[0120] A second identification information recording module is used to analyze the data type of the first frame data in the second video file before the second video file is sent, and record the identification information of the first frame data when the data type of the first frame data is I frame data;

[0121] A first identification information comparison module, used to compare identification information of the last frame data in the first video file and the first frame data in the second video file;

[0122] The first video sending module is used for not sending the first frame data in the second video file and sending the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, wherein the first video file and the second video file are two consecutive video recordings.

[0123] As can be seen from the above, the video processing device provided in the embodiment of the present application, when the first video file is sent, before the second video file is sent, when the last frame data of the first video file and the first frame data of the second video file are the same frame data, skips the first frame data of the second video file and does not send it, and only sends the remaining data. Since the first video file and the second video file are two consecutive video recordings, they are usually processed continuously during decoding and playback, so the last frame data of the first video file can be used to decode and play the second video file, thereby further reducing the storage pressure of the decoding device.

[0124] In a possible implementation, the device further includes:

[0125] A data analysis module, used for analyzing the data types of the last frame data in the first video file and the first frame data in the second video file before sending the first video file and the second video file;

[0126] an identification information comparison module, configured to compare identification information of the last frame data and the first frame data when both the data types of the last frame data and the first frame data are I frame data;

[0127] The second video sending module is used for not sending the last frame data in the first video file, but sending the first video file and the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data.

[0128] As can be seen from the above, in the video processing device provided in the embodiment of the present application, the first video file only sends other data before the last I frame data, and the second video file is sent in full, including the last I frame data copied from the first video file to the second video file and the P frame data thereafter, so that when the second video file arrives at other devices, the starting frame is still I frame data, thereby ensuring that the second video file can be decoded and played independently, reducing the occurrence of video rewind problems.

[0129] In a possible implementation, the device further includes:

[0130] The third video sending module is used to send the first video file and the second video file in sequence when the collection of the second video file is completed.

[0131] The two video files are sent directly in sequence, which improves the efficiency of video sending. When the second target frame data is the first target frame data, the independence of decoding and playing the second video file is guaranteed. When the second target frame data is the P frame data after the last I frame data, the analyzability of the association between the first video file and the second video file is guaranteed.

[0132] In a possible implementation manner, the data deletion module 503 is specifically configured to:

[0133] Acquire storage location information of the second target frame data and length information of the first video file;

[0134] determining length information of the second target frame data based on storage location information of the second target frame data;

[0135] According to the length information of the second target frame data, the length information of the first video file is modified to be the length after the second target frame data is removed.

[0136] Since the second target frame data only includes P frame data that occupies less memory and has a smaller data volume, and does not include I frame data that occupies more memory and has a larger data volume, it can reduce the time for deleting data while reducing duplicate storage and reduce the performance consumption of the acquisition device in processing data.

[0137] The present application also provides an electronic device, such as Fig.11 As shown, including:

[0138] Memory 601, used for storing computer programs;

[0139] The processor 602 is used to implement any of the above-mentioned video recording processing methods when executing the program stored in the memory 601.

[0140] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 602, the communication interface, and the memory 601 communicate with each other via the communication bus.

[0141] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0142] The communication interface is used for communication between the above electronic device and other devices.

[0143] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0144] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0145] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned video processing methods are implemented.

[0146] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any video recording processing method in the above embodiments.

[0147] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.

[0148] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0149] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0150] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A video processing method, characterized in that: include: In the process of acquiring the first video file, recording storage location information of the first target frame data in the first video file, wherein the first target frame data includes the last I frame data in the first video file and the P frame data after the last I frame data; When the acquisition of the first video file is completed, copying the first target frame data to the starting position of the second video file according to the storage position information, acquiring other frame data of the second video file, and storing the other frame data in the position after the first target frame data in the second video file; Delete the second target frame data in the first video file, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data.

2. The method according to claim 1, characterized in that: In the case where the second target frame data is P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes: When the first video file is sent, analyzing the data type of the last frame data in the first video file, and recording identification information of the last frame data when the data type of the last frame data is I frame data; Before sending the second video file, analyzing the data type of the first frame data in the second video file, and recording identification information of the first frame data when the data type of the first frame data is I frame data; Compare identification information of the last frame data in the first video file and the first frame data in the second video file; When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the first frame data in the second video file is not sent, and the second video file is sent, wherein the first video file and the second video file are two consecutive video recordings.

3. The method according to claim 1, characterized in that In the case where the second target frame data is P frame data after the last I frame data, and after deleting the second target frame data in the first video file, the method further includes: Before sending the first video file and the second video file, analyzing the data types of the last frame data in the first video file and the first frame data in the second video file; When the data types of the last frame data in the first video file and the first frame data in the second video file are both I-frame data, comparing the identification information of the last frame data and the first frame data; When the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, the last frame data in the first video file is not sent, and the first video file and the second video file are sent.

4. The method according to claim 1, characterized in that: After deleting the second target frame data in the first video file, the method further includes: When the collection of the second video file is completed, the first video file and the second video file are sent in sequence.

5. The method according to claim 1, characterized in that In a case where the second target frame data is P frame data after the last I frame data, deleting the second target frame data in the first video file includes: Acquire storage location information of the second target frame data and length information of the first video file; determining length information of the second target frame data based on storage location information of the second target frame data; According to the length information of the second target frame data, the length information of the first video file is modified to be the length after the second target frame data is removed.

6. A video processing device, characterized in that: include: An information recording module, used for recording storage location information of first target frame data in the first video file during the process of collecting the first video file, wherein the first target frame data includes the last I frame data in the first video file and the P frame data after the last I frame data; A video capture module, configured to copy the first target frame data to the starting position of a second video file according to the storage position information when the first video file is captured, capture other frame data of the second video file, and store the other frame data in a position after the first target frame data in the second video file; The data deletion module is used to delete the second target frame data in the first video file, wherein the second target frame data is the first target frame data, or the P frame data after the last I frame data.

7. The device according to claim 6, characterized in that The device also includes: A first identification information recording module is used to analyze the data type of the last frame data in the first video file when the first video file is sent, and record the identification information of the last frame data when the data type of the last frame data is I frame data; A second identification information recording module is used to analyze the data type of the first frame data in the second video file before the second video file is sent, and record the identification information of the first frame data when the data type of the first frame data is I frame data; A first identification information comparison module, used to compare identification information of the last frame data in the first video file and the first frame data in the second video file; The first video sending module is used for not sending the first frame data in the second video file and sending the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data, wherein the first video file and the second video file are two consecutive video recordings.

8. The device according to claim 6, characterized in that The device also includes: A data analysis module, used for analyzing the data types of the last frame data in the first video file and the first frame data in the second video file before sending the first video file and the second video file; an identification information comparison module, configured to compare identification information of the last frame data and the first frame data when both the data types of the last frame data and the first frame data are I frame data; The second video sending module is used for not sending the last frame data in the first video file, but sending the first video file and the second video file when the identification information indicates that the last frame data in the first video file and the first frame data in the second video file are the same frame data.

9. The device according to claim 6, characterized in that The device also includes: The third video sending module is used to send the first video file and the second video file in sequence when the collection of the second video file is completed.

10. The device according to claim 6, characterized in that The data deletion module is specifically used for: Acquire storage location information of the second target frame data and length information of the first video file; determining length information of the second target frame data based on storage location information of the second target frame data; According to the length information of the second target frame data, the length information of the first video file is modified to be the length after the second target frame data is removed.

11. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-5 when executing a program stored in a memory.

Citation Information

Patent Citations

  • Decoding method for IP frame image group of concurrent video session

    CN112449196A

  • Method for fast removing redundancy key frames and device thereof

    CN101655859A

  • Method for realizing prerecording of real-time audio / video stream

    CN102938829A