[go: up one dir, main page]

CN118803175B - Video storage compression method, device and storage medium - Google Patents

Video storage compression method, device and storage medium Download PDF

Info

Publication number
CN118803175B
CN118803175B CN202411262960.5A CN202411262960A CN118803175B CN 118803175 B CN118803175 B CN 118803175B CN 202411262960 A CN202411262960 A CN 202411262960A CN 118803175 B CN118803175 B CN 118803175B
Authority
CN
China
Prior art keywords
video
video frame
condition
deletion
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202411262960.5A
Other languages
Chinese (zh)
Other versions
CN118803175A (en
Inventor
张祥
袁挚正
李萌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202411262960.5A priority Critical patent/CN118803175B/en
Publication of CN118803175A publication Critical patent/CN118803175A/en
Application granted granted Critical
Publication of CN118803175B publication Critical patent/CN118803175B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The application discloses a video storage compression method, equipment and a storage medium, wherein the video storage compression method comprises the steps of responding to a space cleaning instruction of a video storage space, acquiring a video file stored in the video storage space, and acquiring a video frame deletion condition; and respectively deleting the video frames which are deleted in the video file by taking the video frames which meet the video frame deletion condition as the pre-deleted video frames. Compared with the prior art that the whole video file is directly deleted, the method and the device have the advantages that the attribute information of the video frames in the video file is deeply considered, only part of the video frames in the video file are selected to be deleted, and under the condition that the storage space is kept unchanged from the aspect of a time line, the information with longer time and more content can be stored, and the storage space utilization rate of a memory is improved.

Description

Video storage compression method, device and storage medium
Technical Field
The present application relates to the field of video storage technologies, and in particular, to a method, an apparatus, and a storage medium for compressing a video storage disc.
Background
Currently, each video file stored in the memory is considered separately, and when the storage space of the memory is used, the video file stored earliest is deleted. For example, in the current memory, A, B, C video files are sequentially stored from early to late according to the time sequence, if a new video file is to be stored, if the remaining storage space is insufficient, the a file is deleted entirely, and then the new video file is stored.
The storage strategy logic is simple and easy to implement, but the utilization rate of storage resources is still low.
Disclosure of Invention
In order to solve the technical problems, the application at least provides a video storage compression method, a video storage compression device and a storage medium.
The first aspect of the application provides a video storage compression method, which comprises the steps of responding to a space cleaning instruction of a video storage space, obtaining a video file stored in the video storage space, obtaining video frame deleting conditions, detecting whether the video frames meet the video frame deleting conditions or not based on frame attribute information of all video frames in the video file, taking the video frames meeting the video frame deleting conditions as pre-deleted video frames, and deleting the pre-deleted video frames in the video file respectively.
In one embodiment, the number of the video frame deletion conditions is multiple, whether the video frames meet the video frame deletion conditions is detected based on frame attribute information of each video frame in the video file, the method comprises the steps of taking all stored video files as a global video file, segmenting the global video file according to storage time of each video frame to obtain multiple video segments, respectively determining the video frame deletion conditions matched with each video segment based on the video frame deletion conditions used in the video frame deletion record corresponding to each video segment and/or residual storage space corresponding to the video storage space, and detecting whether the frame attribute information of the video frames in the video segment meets the matched video frame deletion conditions.
In one embodiment, the video frame deletion conditions matched with each video segment are respectively determined based on the video frame deletion conditions used in the video frame deletion record corresponding to each video segment and/or the residual storage space corresponding to the video storage space, and the method comprises the steps of selecting a target video frame deletion condition from a plurality of video frame deletion conditions based on the video frame deletion conditions used in the video frame deletion record corresponding to each video segment and/or the residual storage space corresponding to the video storage space, and taking the target video frame deletion conditions as the video frame deletion conditions matched with each video segment.
In an embodiment, each video frame deletion condition corresponds to different condition levels respectively, the video frame deletion condition matched with each video segment is determined based on the video frame deletion condition used in the video frame deletion record corresponding to each video segment respectively, the method comprises the steps of sorting each video segment according to the storage time of each video segment, selecting a preset number of video segments with top ranks from sorting results to obtain a priority deletion video segment, acquiring the video frame deletion condition used in the video frame deletion record corresponding to the priority deletion video segment, if the video frame deletion record indicates that the video frame deletion condition of all condition levels is not used up, taking the video frame deletion condition with the lowest condition level in the unused video frame deletion condition as the video frame deletion condition matched with the priority deletion video segment, if the video frame deletion record indicates that the video frame deletion condition of all condition levels is used up, removing the priority deletion video segment from sorting results, selecting the preset number of video segments with top ranks from the sorting results to obtain a new priority deletion video segment, and taking the video frame deletion condition with the lowest condition level as the new video frame deletion condition.
In one embodiment, before sorting each video segment according to the storage time of each video segment, selecting a preset number of video segments with top rank from the sorting result to obtain a priority deleting video segment, the method further includes obtaining a video frame deleting condition used in a video frame deleting record corresponding to each video segment, if the video frame deleting record indicates that the video frame deleting condition of the preset condition level is used in each video segment, sorting each video segment according to the storage time of each video segment, selecting a preset number of video segments with top rank from the sorting result to obtain a priority deleting video segment, and if the video frame deleting record indicates that the video frame deleting condition of the preset condition level is not used in each video segment, using the video frame deleting condition with the lowest condition level in the unused video frame deleting condition as a video frame deleting condition matched with each video segment.
In one embodiment, the frame attribute information comprises a frame type of a video frame, the video frame deletion condition comprises a pre-deleted frame type, the detection of whether the video frame meets the video frame deletion condition or not is based on the frame attribute information of each video frame in the video file, the detection comprises the steps of extracting a frame header mark bit of the video frame to obtain the frame type of the video frame, detecting whether the pre-deleted frame type contains the frame type of the video frame or not, judging that the frame attribute information of the video frame meets the video frame deletion condition if the pre-deleted frame type contains the frame type of the video frame, and judging that the frame attribute information of the video frame does not meet the video frame deletion condition if the frame attribute information of the video frame does not contain the frame type of the video frame.
In one embodiment, the frame attribute information comprises frame types and storage time of video frames, and the detecting whether the video frames meet the video frame deletion condition based on the frame attribute information of each video frame in the video file comprises calculating deletion recommendation indexes of each video frame based on the frame types and the storage time of each video frame, and detecting whether the deletion recommendation indexes of the video frames meet the video frame deletion condition.
In an embodiment, before responding to the space cleaning instruction of the video storage space, the method further comprises the steps of obtaining a residual storage space corresponding to the video storage space, obtaining a preset space threshold, generating the space cleaning instruction if the residual storage space is smaller than the preset space threshold, or receiving a video storage request, obtaining the data size of the video to be stored corresponding to the video storage request, and generating the space cleaning instruction if the data size of the video to be stored is larger than the residual storage space.
The application provides a video storage compression device, which comprises an instruction response module, a video frame detection module and a video frame deletion module, wherein the instruction response module is used for responding to a space cleaning instruction of a video storage space, acquiring video files stored in the video storage space and acquiring video frame deletion conditions, the video frame detection module is used for detecting whether video frames meet the video frame deletion conditions or not based on frame attribute information of all video frames in the video files, and the video frame deletion module is used for taking the video frames meeting the video frame deletion conditions as pre-deleted video frames and respectively deleting the pre-deleted video frames in the video files.
A third aspect of the present application provides an electronic device, including a memory and a processor, where the processor is configured to execute program instructions stored in the memory to implement the video storage compression method described above.
A fourth aspect of the present application provides a computer readable storage medium having stored thereon program instructions which, when executed by a processor, implement the video storage compression method described above.
According to the scheme, the stored video files in the video storage space are acquired through responding to the space cleaning instruction of the video storage space, the video frame deleting condition is acquired, whether the video frames meet the video frame deleting condition or not is detected based on the frame attribute information of each video frame in the video files, the video frames meeting the video frame deleting condition are used as pre-deleted video frames, deleting processing is carried out on the pre-deleted video frames in the video files respectively, compared with the fact that the whole video files are deleted directly in the prior art, attribute information of the video frames in the video files is considered deeply, only partial video frames in the video files are selected to be deleted, the cost of losing partial video frames is used for replacing more information, and in the aspect of a time line, longer-time and more content information can be stored, and the storage space utilization rate of a memory is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application as claimed.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application.
FIG. 1 is a schematic illustration of an implementation environment for an embodiment of the present application;
FIG. 2 is a flow chart of a video inventory compression method according to an exemplary embodiment of the application;
FIG. 3 is a schematic diagram of a video segment shown in accordance with an exemplary embodiment of the present application;
FIG. 4 is a flow chart illustrating video frame deletion in accordance with an exemplary embodiment of the present application;
FIG. 5 is a schematic diagram illustrating video frame deletion in accordance with an exemplary embodiment of the present application;
FIG. 6 is a schematic diagram of video frame deletion shown in another exemplary embodiment of the present application;
FIG. 7 is a schematic diagram of video frame deletion as shown in another exemplary embodiment of the present application;
FIG. 8 is a block diagram of a video inventory compression device according to an exemplary embodiment of the application;
fig. 9 is a schematic structural view of an electronic device according to an exemplary embodiment of the present application;
Fig. 10 is a schematic diagram of a structure of a computer-readable storage medium according to an exemplary embodiment of the present application.
Detailed Description
The following describes embodiments of the present application in detail with reference to the drawings.
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, interfaces, techniques, etc., in order to provide a thorough understanding of the present application.
The term "and/or" is herein merely an association information describing an associated object, meaning that three relationships may exist, e.g., a and/or B, and may mean that a alone exists, while a and B exist, and B alone exists. In this context, the characters "/", and "", generally indicate that the associated objects are an "or" relationship. Further, "a plurality" herein means two or more than two. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, may mean including any one or more elements selected from the group consisting of A, B and C.
The following describes a video storage compression method provided by the embodiment of the present application.
Referring to fig. 1, a schematic diagram of an implementation environment of an embodiment of the present application is shown. The scenario implementation environment may include a terminal 110 and a server 120, with the terminal 110 and the server 120 being communicatively coupled to each other.
The number of terminals 110 may be one or more. The terminal 110 may be, but is not limited to, a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart watch, etc.
The server 120 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, a content delivery network (Content Delivery Network, CDN), basic cloud computing services such as big data and an artificial intelligent platform.
In one example, the server 120 may store the video file acquired from the terminal 110, and of course, the terminal 110 may store the video file acquired from the server 120.
In the video storage compression method provided by the embodiment of the application, the execution main body of each step can be the terminal 110 or the server 120, or the terminal 110 and the server 120 are interactively matched to execute, namely, one part of the steps of the method are executed by the terminal 110, and the other part of the steps are executed by the server 120.
Referring to fig. 2, fig. 2 is a flowchart illustrating a video save compression method according to an exemplary embodiment of the present application. The video inventory compression method can be applied to the implementation environment shown in fig. 1 and is specifically performed by a server in the implementation environment. It should be understood that the method may be adapted to other exemplary implementation environments and be specifically executed by devices in other implementation environments, and the implementation environments to which the method is adapted are not limited by the present embodiment.
As shown in fig. 2, the video save compression method at least includes steps S210 to S230, and is described in detail as follows:
step S210, responding to a space cleaning instruction of the video storage space, acquiring the video files stored in the video storage space, and acquiring a video frame deleting condition.
And detecting whether the video storage space is required to be cleaned or not, and if so, generating a space cleaning instruction. Wherein the video storage space is used for storing video files.
In some embodiments, whether space cleaning is needed may be determined according to the remaining storage space corresponding to the video storage space.
For example, whether the remaining storage space is smaller than a preset space threshold is judged, if yes, the video storage space is judged to be required to be cleaned, and a space cleaning instruction is generated. The remaining storage space determination may be performed once every predetermined time period, or once when a change in the remaining storage space is detected.
For another example, a video storage request is received, where the video storage request is used to request to store a video to be stored, obtain the data size of the video to be stored, and if the data size of the video to be stored is greater than the remaining storage space, determine that space cleaning is required for the video storage space, and generate a space cleaning instruction.
In some embodiments, the space purge instructions may also be generated periodically, such as by generating one space purge instruction every 10 days.
In some embodiments, a storage duration of each video file in the video storage space may also be obtained, and if the storage duration exceeds a preset duration threshold, a space cleaning instruction is generated.
Optionally, the spatial cleaning judgment policy corresponding to each video file may be different, and each video file is judged according to the corresponding spatial cleaning judgment policy, so as to generate a spatial cleaning instruction. For example, according to the type of the video file, the size of the video file, etc., determining the importance level to which the video file belongs, wherein different importance levels correspond to different space cleaning judging strategies, and judging all video files contained in the importance level corresponding to the video file according to the space cleaning judging strategies to determine whether to generate a space cleaning instruction, where the space cleaning instruction is used for indicating to clean all video files contained in the importance level corresponding to the space cleaning judging strategies.
It should be noted that, the generating mode of the space cleaning instruction may be flexibly set according to the actual application scenario, which is not limited in the present application.
And responding to a space cleaning instruction of the video storage space, acquiring the video files stored in the video storage space, and acquiring a video frame deletion condition.
The method can be used for acquiring all stored video files to be used as video files to be cleaned, or acquiring part of stored video files to be used as video files to be cleaned, wherein the video frame deleting condition is used for limiting video frames to be deleted.
Step S220, based on the frame attribute information of each video frame in the video file, whether the video frame meets the video frame deletion condition is detected.
The frame attribute information includes, but is not limited to, one or more of a frame type of the video frame, a storage time of the video frame, a data size of the video frame, a decoding playing number corresponding to the video frame, and the like.
Wherein the number of video frame deletion conditions is one or more.
In some embodiments, it may be directly detected whether each video frame in the video file satisfies one or more video frame deletion conditions.
In some embodiments, the number of the video frame deletion conditions is multiple, and one or more currently matched video frame deletion conditions can be selected from the multiple video frame deletion conditions, so as to detect whether each video frame in the video file meets the matched video frame deletion conditions.
For example, one or more currently matched video frame deletion conditions may be flexibly determined according to frame attribute information of video frames, a remaining storage space, a data size of a video to be stored, a video file to which the video file belongs, a video segment to which the video file belongs, and the like, so as to detect whether each video frame satisfies the matched video frame deletion conditions. The video frame deletion conditions for each video frame match may be the same or different, which is not limited in the present application.
And step S230, taking the video frames meeting the video frame deletion conditions as pre-deleted video frames, and respectively deleting the pre-deleted video frames in the video file.
And screening out the pre-deleted video frames in the video file according to the video frame deletion condition, and respectively deleting the pre-deleted video frames in the video file.
I.e. only pre-deleted video frames in the video file, and not the entire video file directly.
Compared with the prior art, the method and the device have the advantages that only partial video frames in the video file are selected to be deleted at the cost of losing the partial video frames, so that more information is stored, and in the aspect of a time line, the information with longer time and more content can be stored under the condition that the storage space is kept unchanged, and the storage space utilization of a memory is improved.
Next, some embodiments of the present application will be described in detail.
In some embodiments, the number of the video frame deletion conditions is multiple, in step S220, based on the frame attribute information of each video frame in the video file, whether the video frame meets the video frame deletion conditions is detected, which includes using all the stored video files as a global video file, segmenting the global video file according to the storage time of each video frame to obtain multiple video segments, and based on the video frame deletion conditions used in the video frame deletion record corresponding to each video segment and/or the remaining storage space corresponding to the video storage space, determining the video frame deletion conditions matched with each video segment, and detecting whether the frame attribute information of the video frame in the video segment meets the matched video frame deletion conditions.
Referring to fig. 3, fig. 3 is a schematic diagram of video segmentation according to an exemplary embodiment of the present application, and as shown in fig. 3, all the stored video files are used as a global video file, and the global video file is segmented according to the storage time of each video frame to obtain a plurality of video segments, such as video segment 1, video segment 2 and video segment 3.
The number of video segments obtained by dividing or the video segment length of each video segment may be preset or may be flexibly set.
For example, the number of video segments is set to N, and the global video file is segmented evenly to obtain N video segments.
For another example, the video segment length of the video segment is determined according to the storage time, the longer the storage time is from the current time, the longer the video segment length of the corresponding video segment is, the shorter the storage time is from the current time, the shorter the video segment length of the corresponding video segment is, so as to analyze the new video data in a finer granularity, and improve the flexibility and accuracy of video frame deletion.
And respectively determining the video frame deletion condition matched with each video segment.
For example, the video frame deletion condition used by each video segment is recorded, so as to obtain a video frame deletion record, and the video frame deletion condition matched with each video segment can be determined according to the video frame deletion record.
For example, each video frame deletion condition corresponds to a different condition level, and the video segments are ranked by level to select the currently matching video frame deletion condition, e.g., the video frame deletion condition includes deleting the video frame of the flag indicating the non-motion detection data (condition level 1), deleting the non-key frame at intervals (condition level 2), deleting all the non-key frames (condition level 3), deleting the other video frames except the key frame (condition level 4), deleting all the video frames (condition level 5) in ascending order of the condition level. And selecting the condition level 1 video frame deletion condition if the video frame deletion record of the video segment 1 indicates that the video segment 1 does not use the condition level 1 video frame deletion condition, and selecting the condition level 2 video frame deletion condition if the video segment 1 video frame deletion record indicates that the video segment 1 uses the condition level 1 video frame deletion condition. Wherein the non-key frames include a first type non-key Frame BASE Frame and a second type non-key Frame ENHANCE Frame, which both belong to a Predictive-coded Frame (P-Frame), otherwise, the key frames are also referred to as I-frames.
By using the video frame deletion condition level by level to realize video frame deletion, video frames with low importance degree can be deleted first, so that video frames with high importance degree can be reserved preferentially.
For another example, a remaining storage space corresponding to the video storage space is obtained, and a video frame deletion condition matched with each video segment is determined according to the remaining storage space, such as determining the number of video frame deletion conditions and/or the condition level of the video frame deletion conditions.
For example, a difference between the remaining storage space and a preset space threshold is calculated, or a difference between the remaining storage space and a data size of the video to be stored is calculated, and the number of video frame deletion conditions and/or the condition level of the video frame deletion conditions are determined according to the calculated difference size. If the difference value is larger, the number of the video frame deletion conditions is larger, and/or the condition level of the video frame deletion conditions is higher, and if the difference value is smaller, the number of the video frame deletion conditions is smaller, and/or the condition level of the video frame deletion conditions is lower.
Some embodiments of determining a video frame deletion condition for each video segment match are illustrated:
Embodiment 1, selecting a target video frame deletion condition from a plurality of video frame deletion conditions based on a video frame deletion condition used in a video frame deletion record corresponding to each video segment and/or a remaining storage space corresponding to a video storage space, and taking the target video frame deletion condition as a video frame deletion condition matched with each video segment.
For example, referring to fig. 4, fig. 4 is a flowchart illustrating video frame deletion according to an exemplary embodiment of the present application, as shown in fig. 4, including:
in step S401, it is detected that the video to be stored exists and the remaining storage space is insufficient, and all video files are segmented as one global video file to obtain a plurality of video segments.
Step S402, deleting the video frames of which the flag bit in each video segment indicates the non-motion detection data.
And if the condition level 1 video frame deletion condition is not used in all the video frame deletion records corresponding to each video segment, taking the condition level 1 video frame deletion condition as a target video frame deletion condition.
Step S403, judging whether the residual storage space meets the storage of the video to be stored, if not, continuing to execute step S404, otherwise, executing step S411;
After the video frame deletion condition of the condition level 1 is executed on all the current video segments, if the storage space still does not meet the storage of the video to be stored, continuing to execute the video frame deletion condition of the higher condition level.
And S404, deleting video frames of which the zone bit belongs to non-key frames in each video segment at intervals.
For example, referring to fig. 5, fig. 5 is a schematic diagram illustrating video frame deletion according to an exemplary embodiment of the present application, and as shown in fig. 5, second-class non-key frames ENHANCE frames of each video segment are deleted at intervals.
Step S405, judging whether the residual storage space meets the storage of the video to be stored, if not, continuing to execute step S406, otherwise, executing step S411;
Step S406, deleting all video frames of which the zone bit belongs to non-key frames in each video segment.
For example, referring to fig. 6, fig. 6 is a schematic diagram illustrating video frame deletion according to another exemplary embodiment of the present application, and as shown in fig. 6, all second-class non-key frames ENHANCE frames of each video segment are deleted.
Step S407, judging whether the residual storage space meets the storage of the video to be stored, if not, continuing to execute step S408, otherwise, executing step S411;
Step S408, deleting all video frames of which the zone bit does not belong to the key frame in each video segment.
For example, referring to fig. 7, fig. 7 is a schematic diagram illustrating deletion of video frames according to another exemplary embodiment of the present application, and as shown in fig. 7, all video frames except I-frames in each video segment are deleted.
Step S409, detecting whether the residual storage space meets the storage of the video to be stored, if not, continuing to execute step S410, otherwise, executing step S411;
Step S410, deleting all video frames.
Step S411, the storage of the video to be stored is completed.
By gradually deleting video frames with low importance, information with longer time and more content can be stored, the storage space utilization rate of a memory is improved, and part of video frames in a file are continuously deleted from an inter-frame reference relation without affecting analysis of other video frames in a code stream.
Besides determining the currently matched video frame deletion conditions according to the used video frame deletion conditions, the number and/or the condition level of the video frame deletion conditions can be determined according to the residual storage space, one or more matched video frame deletion conditions are obtained, and the filtered pre-deleted video frames are deleted at one time according to the one or more video frame deletion conditions, so that the video frame deletion efficiency is improved.
The embodiment 2 includes that each video frame deletion condition corresponds to different condition levels respectively, each video segment is ordered according to storage time of each video segment, a preset number of video segments with the top order are selected from an ordering result to obtain a priority deletion video segment, video frame deletion conditions which are used in a video frame deletion record corresponding to the priority deletion video segment are obtained, if the video frame deletion record indicates that the video frame deletion condition of all condition levels is not used in the priority deletion video segment, the video frame deletion condition with the lowest condition level in the unused video frame deletion condition is used as a video frame deletion condition matched with the priority deletion video segment, if the video frame deletion record indicates that the video frame deletion condition of all condition levels is used in the priority deletion video segment, the priority deletion video segment is removed from the ordering result, a preset number of video segments with the top order are selected from the ordering result after removal, and a new priority deletion video segment is obtained, and the video frame deletion condition with the lowest condition level is used as a video frame deletion condition matched with the new priority deletion video segment.
The preset number may be preset, for example, 1 number, 2 numbers, etc., and may be flexibly calculated, for example, the value of the preset number is flexibly determined according to the space size of the remaining storage space, the data size of the video to be stored, etc., and the smaller the remaining storage space is, the larger the video to be stored is, the larger the preset number is.
For example, the preset number is 1, each video segment is ordered according to the storage time of each video segment, the ordering result is video segment 1, video segment 2 and video segment 3, and video segment 1 is selected as the priority deleting video segment. The method comprises the steps of obtaining used video frame deletion conditions in a video frame deletion record corresponding to a video segment 1, taking the video frame deletion condition with the lowest condition level in the unused video frame deletion conditions as a video frame deletion condition matched with a priority deletion video segment if the video frame deletion record indicates that the video segment 1 does not use the video frame deletion condition with all condition levels, removing the video segment 1 from a sorting result if the video frame deletion record indicates that the video segment 1 uses the video frame deletion condition with all condition levels, selecting the 1 video segments with the top ranking from the sorting result after being removed to obtain a new priority deletion video segment 2, and taking the video frame deletion condition with the lowest condition level (namely the video frame deletion condition with the condition level 1) as the video frame deletion condition matched with the video segment 2.
By the method, the video frame deletion conditions of all the condition levels can be sequentially and completely executed on the video segment 1, then the video frame deletion conditions of all the condition levels can be sequentially and completely executed on the video segment 2, and so on until all the video segments are sequentially and completely executed on the video frame deletion conditions of all the condition levels, so that the video frames with high importance and new storage time can be reserved.
In embodiment 3, before sorting each video segment according to the storage time of each video segment, and selecting the preset number of video segments with the top rank from the sorting result to obtain the video segment to be deleted preferentially, the method further includes obtaining the video frame deletion condition used in the video frame deletion record corresponding to each video segment, if the video frame deletion record indicates that the video frame deletion condition of the preset condition level is not used in each video segment, using the video frame deletion condition with the lowest condition level in the unused video frame deletion condition as the video frame deletion condition matched with each video segment, and if the video frame deletion record indicates that the video frame deletion condition of the preset condition level is used in each video segment, determining the matched video frame deletion condition by adopting the method of embodiment 2.
The preset condition level may be preset, for example, a condition level 1, a condition level 2, etc., and the preset condition level may also be flexibly calculated, for example, the preset condition level may be flexibly determined according to the space size of the remaining storage space, the data size of the video to be stored, the type of the stored video file, the decoding playing number of the stored video file, etc.
For example, the preset condition level is condition level 1 (the deletion flag bit indicates the video frame of the non-motion detection data), the video segment includes video segment 1, video segment 2 and video segment 3, if the video segment 1, video segment 2 and video segment 3 do not delete the video frame of the non-motion detection data, then after deleting the video frame of the non-motion detection data in sequence for each of video segment 1, video segment 2 and video segment 3, if not, then in the manner of embodiment 2 above, the video frame deletion conditions of all other condition levels are first executed in sequence for video segment 1, then the video frame deletion conditions of all other condition levels are executed in sequence for video segment 2, and so on until all the video segments execute the video frame deletion conditions of all condition levels in sequence.
In summary, the video frame deletion conditions matched for each video segment may be flexibly combined, which is not limited in the present application.
In some embodiments, the number of the video frame deletion conditions is multiple, and in step S220, based on the frame attribute information of each video frame in the video file, whether the video frame meets the video frame deletion conditions is detected, including determining a matched video frame deletion condition based on the video frame deletion conditions used in the video frame deletion record corresponding to the video file and/or the remaining storage space corresponding to the video storage space, and detecting whether the frame attribute information of the video frame meets the matched video frame deletion condition.
That is, without dividing the video segment, one or more matched video frame deletion conditions are selected from the plurality of video frame deletion conditions, and the video frames in all video files are filtered according to the matched video frame deletion conditions.
In some embodiments, the frame attribute information includes a frame type of the video frame, the video frame deletion condition includes a pre-deleted frame type, and the step S220 includes detecting whether the video frame satisfies the video frame deletion condition based on the frame attribute information of each video frame in the video file, including extracting a frame header flag bit of the video frame to obtain the frame type of the video frame, detecting whether the pre-deleted frame type includes the frame type of the video frame, if so, determining that the frame attribute information of the video frame satisfies the video frame deletion condition, and if not, determining that the frame attribute information of the video frame does not satisfy the video frame deletion condition.
For example, frame types include BASE frames, ENHANCE frames, I frames, video frames of non-motion detection data, video frames of motion detection data.
And screening out the video frames of the preset type according to the video frame deletion condition to delete.
In some embodiments, the frame attribute information includes a frame type and a storage time of the video frame, and the step S220 of detecting whether the video frame satisfies the video frame deletion condition based on the frame attribute information of each video frame in the video file includes calculating a deletion recommendation index of each video frame based on the frame type and the storage time of each video frame, and detecting whether the deletion recommendation index of the video frame satisfies the video frame deletion condition.
For example, the longer the video frame is stored and/or the less important the frame type indicates the video frame, the higher its corresponding erasure recommendation index, and conversely the lower its corresponding erasure recommendation index. Different frame types may correspond to different importance levels, for example, the importance level of an I frame is highest, the importance level of a video frame of non-motion detection data is lowest, and the lower the importance level is, the less important the corresponding video frame is.
And detecting whether the deletion recommendation index of the video frame meets the video frame deletion condition.
For example, the video frame deletion condition is to take a video frame whose deletion recommendation index is lower than a preset index threshold as a pre-deleted video frame.
For another example, the video frame deletion condition is to sort the video frames in descending order according to the deletion recommendation index, and select M video frames before sorting as pre-deleted video frames.
After the pre-deleted video frames are obtained through the above embodiments, deletion processing is performed on the pre-deleted video frames in the video file respectively.
The video storage compression method provided by the application has the advantages that the stored video files in the video storage space are obtained through responding to the space cleaning instruction of the video storage space, the video frame deleting condition is obtained, whether the video frames meet the video frame deleting condition or not is detected based on the frame attribute information of each video frame in the video files, the video frames meeting the video frame deleting condition are used as the pre-deleted video frames, the deleting treatment is respectively carried out on the pre-deleted video frames in the video files, compared with the direct deleting of the whole video files in the prior art, the attribute information of the video frames in the video files is deeply considered, only partial video frames in the video files are selected to be deleted, the cost of losing partial video frames is used for replacing more information, and the storage space utilization rate of a memory can be improved under the condition that the storage space is kept unchanged from the aspect of a time line.
Fig. 8 is a block diagram of a video inventory compression device according to an exemplary embodiment of the application. As shown in fig. 8, the exemplary video inventory compression device 800 includes an instruction response module 810, a video frame detection module 820, and a video frame deletion module 830. Specifically:
The instruction response module 810 is configured to obtain a video file stored in the video storage space and obtain a video frame deletion condition in response to a space cleaning instruction of the video storage space;
A video frame detection module 820, configured to detect whether a video frame satisfies a video frame deletion condition based on frame attribute information of each video frame in the video file;
the video frame deletion module 830 is configured to delete video frames that satisfy the video frame deletion condition as pre-deleted video frames, and perform deletion processing on the pre-deleted video frames in the video file respectively.
It should be noted that, the video disc storage compression device provided in the foregoing embodiment and the video disc storage compression method provided in the foregoing embodiment belong to the same concept, and the specific manner in which each module and unit perform the operation has been described in detail in the method embodiment, which is not repeated herein. In practical application, the video disc storage compression device provided in the above embodiment may distribute the functions to be completed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above, which is not limited herein.
Referring to fig. 9, fig. 9 is a schematic structural diagram of an electronic device according to an embodiment of the application. The electronic device 900 comprises a memory 901 and a processor 902, the processor 902 being adapted to execute program instructions stored in the memory 901 to implement the steps of any of the video storage compression method embodiments described above. In a specific implementation scenario, electronic device 900 may include, but is not limited to, a microcomputer, a server, and further, electronic device 900 may also include a mobile device such as a notebook computer, a tablet computer, etc., without limitation.
In particular, the processor 902 is configured to control itself and the memory 901 to implement the steps in any of the video inventory compression method embodiments described above. The processor 902 may also be referred to as a central processing unit (Central Processing Unit, CPU). The processor 902 may be an integrated circuit chip having signal processing capabilities. The Processor 902 may also be a general purpose Processor, a digital signal Processor (DIGITAL SIGNAL Processor, DSP), an Application SPECIFIC INTEGRATED Circuit (ASIC), a Field-Programmable gate array (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic device, discrete gate or transistor logic device, discrete hardware components. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. In addition, the processor 902 may be commonly implemented by an integrated circuit chip.
Referring to fig. 10, fig. 10 is a schematic structural diagram of an embodiment of a computer readable storage medium according to the present application. The computer readable storage medium 1000 stores program instructions 1010 executable by a processor, the program instructions 1010 for implementing the steps in any of the video storage compression method embodiments described above.
In some embodiments, functions or modules included in an apparatus provided by the embodiments of the present disclosure may be used to perform a method described in the foregoing method embodiments, and specific implementations thereof may refer to descriptions of the foregoing method embodiments, which are not repeated herein for brevity.
The foregoing description of various embodiments is intended to highlight differences between the various embodiments, which may be the same or similar to each other by reference, and is not repeated herein for the sake of brevity.
In the several embodiments provided in the present application, it should be understood that the disclosed method and apparatus may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions of actual implementation, e.g., units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical, or other forms.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units. The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. The storage medium includes a U disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.

Claims (8)

1. A video save compression method, comprising:
Responding to a space cleaning instruction of a video storage space, acquiring stored video files in the video storage space, taking all the stored video files as a global video file, and segmenting the global video file according to the storage time of each video frame in the global video file to obtain a plurality of video segments;
Determining a video frame deletion condition for each video segment match by any of:
The method 1 comprises the steps of obtaining video frame deletion conditions used in a video frame deletion record corresponding to each video segment, and taking the video frame deletion condition with the lowest condition level in the unused video frame deletion conditions as the video frame deletion condition matched with each video segment, wherein the number of the video frame deletion conditions is a plurality of, and each video frame deletion condition corresponds to different condition levels respectively;
sorting each video segment according to the storage time of each video segment, selecting a preset number of video segments with the top ranking from the sorting result to obtain a priority deleting video segment, obtaining the used video frame deleting condition in the video frame deleting record corresponding to the priority deleting video segment, and taking the video frame deleting condition with the lowest condition level in the unused video frame deleting condition as the video frame deleting condition matched with the priority deleting video segment;
If the video frame deletion record corresponding to each video segment indicates that the video frame deletion condition of the preset condition level is used for each video segment, acquiring the video frame deletion condition according to the mode 2; if the video frame deletion record corresponding to each video segment indicates that the video frame deletion condition of the preset condition level is not used by each video segment, acquiring a video frame deletion condition according to a mode 1;
Detecting whether the video frame meets the video frame deletion condition or not based on the frame attribute information of each video frame in the video segment;
and taking the video frames meeting the video frame deletion conditions as pre-deleted video frames, and respectively deleting the pre-deleted video frames in the video segment.
2. The method of claim 1, wherein determining a video frame deletion condition for each video segment match comprises:
selecting a target video frame deletion condition from a plurality of video frame deletion conditions based on the video frame deletion condition used in the video frame deletion record corresponding to each video segment and the remaining storage space corresponding to the video storage space;
And taking the target video frame deleting conditions as the video frame deleting conditions matched with each video segment.
3. The method according to claim 1, wherein the sorting the video segments according to the storage time of each video segment, selecting a preset number of video segments with top ranks from the sorting result to obtain a priority deletion video segment, obtaining a video frame deletion condition used in a video frame deletion record corresponding to the priority deletion video segment, and using a video frame deletion condition with a lowest condition level in unused video frame deletion conditions as a video frame deletion condition matched with the priority deletion video segment, including:
If the video frame deletion record indicates that the video frame deletion condition of all condition levels is not used by the priority deletion video segment, using the video frame deletion condition with the lowest condition level in the unused video frame deletion conditions as the video frame deletion condition matched with the priority deletion video segment;
If the video frame deletion record indicates that the video frame deletion condition of all condition levels is used by the priority deletion video segment, the priority deletion video segment is removed from the sorting result, a preset number of video segments with the top rank are selected from the sorting result after removal, a new priority deletion video segment is obtained, and the video frame deletion condition with the lowest condition level is used as the video frame deletion condition matched with the new priority deletion video segment.
4. The method of claim 1, wherein the frame attribute information includes a frame type of the video frame, wherein the video frame erasure condition includes a pre-erased frame type, wherein the detecting whether the video frame satisfies the video frame erasure condition based on the frame attribute information of each video frame in the video segment includes:
extracting a frame header mark bit of the video frame to obtain a frame type of the video frame;
Detecting whether the pre-deleted frame type contains the frame type of the video frame or not;
If so, judging that the frame attribute information of the video frame meets the video frame deletion condition;
And if the video frame is not contained, judging that the frame attribute information of the video frame does not meet the video frame deleting condition.
5. The method of claim 1, wherein the frame attribute information includes a frame type and a storage time of the video frame, and wherein the detecting whether the video frame satisfies the video frame deletion condition based on the frame attribute information of each video frame in the video segment comprises:
Calculating a deletion recommendation index of each video frame based on the frame type and the storage time of each video frame;
And detecting whether the deletion recommendation index of the video frame meets the video frame deletion condition.
6. The method of claim 1, further comprising, prior to the responding to the spatial cleanup instruction for the video storage space:
Obtaining a residual storage space corresponding to the video storage space;
acquiring a preset space threshold, generating a space cleaning instruction if the residual storage space is smaller than the preset space threshold, or
Receiving a video storage request, acquiring the data size of a video to be stored corresponding to the video storage request, and generating a space cleaning instruction if the data size of the video to be stored is larger than the residual storage space.
7. An electronic device comprising a memory and a processor for executing program instructions stored in the memory to implement the steps of the method according to any of claims 1-6.
8. A computer readable storage medium storing program instructions executable by a processor to perform the steps of the method according to any one of claims 1-6.
CN202411262960.5A 2024-09-10 2024-09-10 Video storage compression method, device and storage medium Active CN118803175B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202411262960.5A CN118803175B (en) 2024-09-10 2024-09-10 Video storage compression method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202411262960.5A CN118803175B (en) 2024-09-10 2024-09-10 Video storage compression method, device and storage medium

Publications (2)

Publication Number Publication Date
CN118803175A CN118803175A (en) 2024-10-18
CN118803175B true CN118803175B (en) 2024-12-06

Family

ID=93033161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202411262960.5A Active CN118803175B (en) 2024-09-10 2024-09-10 Video storage compression method, device and storage medium

Country Status (1)

Country Link
CN (1) CN118803175B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903105A (en) * 2021-09-30 2022-01-07 杭州海康汽车软件有限公司 Video circulating storage method and device, electronic equipment and storage medium
CN116415032A (en) * 2021-12-29 2023-07-11 杭州海康威视数字技术股份有限公司 Video file reading and storing method and device

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100982516B1 (en) * 2004-01-28 2010-09-16 삼성전자주식회사 Method of managing data storage media included in video content recording device and video content recording device thereof
US20070283269A1 (en) * 2006-05-31 2007-12-06 Pere Obrador Method and system for onboard camera video editing
CN108668096B (en) * 2018-05-18 2021-08-20 京东方科技集团股份有限公司 Video data management method, device and video recording device
US11863815B2 (en) * 2019-09-17 2024-01-02 Lightmetrics Technologies Pvt. Ltd. Methods and systems for managing storage of videos in a storage device
CN112699270A (en) * 2020-12-31 2021-04-23 招明香 Monitoring security data transmission and storage method and system based on cloud computing, electronic equipment and computer storage medium
US11941282B2 (en) * 2021-06-21 2024-03-26 Western Digital Technologies, Inc. Data storage device and method for progressive fading for video surveillance systems
CN115474016A (en) * 2022-08-15 2022-12-13 深圳市锐明技术股份有限公司 Video storage method, device, smart device and storage medium
CN118138798A (en) * 2024-03-06 2024-06-04 北京爱奇艺科技有限公司 Video processing method, device, electronic equipment and readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113903105A (en) * 2021-09-30 2022-01-07 杭州海康汽车软件有限公司 Video circulating storage method and device, electronic equipment and storage medium
CN116415032A (en) * 2021-12-29 2023-07-11 杭州海康威视数字技术股份有限公司 Video file reading and storing method and device

Also Published As

Publication number Publication date
CN118803175A (en) 2024-10-18

Similar Documents

Publication Publication Date Title
CN102156751B (en) Method and device for extracting video fingerprint
US20170039729A1 (en) Method and apparatus for intelligent video pruning
CN106897141A (en) The processing method and processing device of information
CN108063914B (en) Method and device for generating and playing monitoring video file and terminal equipment
CN110555164B (en) Method, device, computer equipment and storage medium for generating group interest labels
CN112565775B (en) Method, device and storage medium for audio and video transcoding
CN112306411B (en) Data storage method and device, nonvolatile storage medium and processor
CN104408640A (en) Application software recommending method and apparatus
CN112148690A (en) File caching method, file access request processing method and device
CN111078651A (en) Method and device for counting usage amount of object storage
CN111753201A (en) Information pushing method, device, terminal and medium
WO2023151426A1 (en) Method and device for counting number of users in live broadcast room
CN103475532A (en) Hardware detection method and system thereof
CN118803175B (en) Video storage compression method, device and storage medium
CN118138483B (en) Data stream processing method, device, computer equipment and readable storage medium
CN110377821A (en) Generate method, apparatus, computer equipment and the storage medium of interest tags
CN105718524A (en) Method and device for determining video originals
CN119211055A (en) Data stream processing method, device, computer equipment and readable storage medium
JP2001077813A (en) NETWORK INFORMATION MANAGEMENT DEVICE, NETWORK INFORMATION MANAGEMENT METHOD, AND RECORDING MEDIUM CONTAINING PROCESSING PROGRAM THEREOF
CN110019870B (en) Image retrieval method and system based on memory image cluster
US11398091B1 (en) Repairing missing frames in recorded video with machine learning
CN110955710B (en) Dirty data processing method and device in data exchange operation
CN108959625A (en) The acquisition methods and device of information in cloud data system
CN112069331B (en) Data processing and searching method, device, equipment and storage medium
CN115474016A (en) Video storage method, device, smart device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant