Video storage method and device, equipment and storage medium
By storing the original video stream in the form of video file groups, and splitting and deleting video files according to preset intervals, the problems of high storage cost and large server resource consumption in the existing technology are solved, and server resources and storage costs are saved. effect.
Patent Information
- Application Number
- CN202411489738.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-24
- Publication Date
- 2025-01-24
AI Technical Summary
In the prior art, the original video and the extracted frame video need to exist simultaneously, and two different storage media need to be set up separately, which increases storage cost, and multiple readings of the original video stream consume a large amount of server resources.
By storing the original video stream in the form of a video file group, the frame group in the original video stream is split according to the preset interval, and multiple video files are obtained, and each video file is stored to the storage pool. The video file group records the storage time and deletes the video files in the video file group according to the storage time and the preset video retention period.
There is no need to consume additional server resources, and there is no need to transfer the video files after frame extraction to other storage pools, saving server resources and storage costs.
Smart Images

Figure CN119363908A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a video storage method, apparatus, device and storage medium. Background Art
[0002] As the number of cameras deployed increases, the video content continues to increase and the resolution of cameras becomes higher and higher, the storage space occupied by the video is also increasing, and the storage cost is increasing. Therefore, it is particularly important to seek effective video compression and storage management technology.
[0003] In the related art, in order to save memory space, the video is usually processed and saved by extracting frames. However, during the video extraction process, it is usually necessary to save the read original video stream to a storage medium. When the storage time reaches a certain time threshold, the original video stream is re-read, and the read original video stream is processed by extracting frames. The video file after the extraction is transferred to another storage medium and then the original video stream is deleted. Although the above method can save storage space to a certain extent, the original video and the extracted frame video need to exist at the same time during the extraction and transfer process, and two different storage media need to be set up respectively for storing the original video stream and the extracted frame file, which increases the storage cost. The process of reading the original video stream multiple times consumes a lot of server resources. Summary of the invention
[0004] The embodiments of the present application provide a video storage method, apparatus, device and storage medium, which solve the problem that the original video and the frame-extracted video need to exist at the same time, and two different storage media need to be set up respectively for storing the original video stream and the frame-extracted file, which increases the storage cost, and the process of reading the original video stream multiple times consumes a large amount of server resources. By storing the original video stream in the form of a video file group, there is no need to consume additional server resources, and there is no need to transfer the frame-extracted video file to other storage pools, thereby saving server resources and storage costs.
[0005] In a first aspect, an embodiment of the present application provides a video storage method, comprising:
[0006] Get the raw video stream from the surveillance camera;
[0007] Splitting the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file is equal to the preset interval;
[0008] Each of the video files is stored in a storage pool respectively, associated as a video file group and the storage time is recorded;
[0009] One or more video files in the video file group are deleted according to the storage time and the preset video retention period.
[0010] Optionally, the preset interval is at least 2 frame groups, and the multiple video files correspond to at least 3;
[0011] Correspondingly, deleting one or more video files in the video file group according to the storage time and the preset video retention period includes:
[0012] According to the storage time and a plurality of preset video retention periods, the video files in the video file group are deleted multiple times, and one or more remaining video files in the video file are deleted each time.
[0013] Optionally, the number of the multiple video files corresponds to a power of 2, where n is an integer greater than 1;
[0014] Accordingly, deleting one or more of the remaining video files in the video file group each time includes:
[0015] Before deleting the last video file in the video file group, half of the remaining video files are deleted each time.
[0016] Optionally, the multiple video files are sorted according to the number of the first frame group therein;
[0017] Accordingly, deleting half of the remaining video files each time includes:
[0018] Each time, the deletion is performed according to the sorting interval of the remaining video files to delete half of the remaining video files.
[0019] Optionally, after splitting the frame groups in the original video stream according to the preset interval to obtain multiple video files, the method further includes:
[0020] In response to a video query instruction sent by a client, determining a target video file group in the storage pool;
[0021] The remaining video files in the target video file group are read, and a frame group data stream is returned to the client, so that the client plays the target video stream according to the frame group data stream.
[0022] Optionally, reading the remaining video files in the target video file group and returning the frame group data stream to the client so that the client plays the target video stream according to the frame group data stream includes:
[0023] Reading frame groups in the remaining video files in the target video file group in turn, and merging frame group data of the read frame groups according to the sequence numbers of the frame groups to obtain a frame group data stream;
[0024] The frame group data stream is returned to the client, so that the client decodes the frame group data stream to obtain a target video stream to be played.
[0025] In a second aspect, an embodiment of the present application provides a video storage device, including:
[0026] A video stream acquisition module is used to acquire the original video stream from the surveillance camera;
[0027] A frame group splitting module, used for splitting the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file group is equal to the preset interval;
[0028] A video file group storage module, used to store each of the video files in a storage pool, associate them into a video file group and record the storage time;
[0029] The video file deletion module is used to delete one or more video files in the video file group according to the storage time and the preset video retention period.
[0030] Optionally, the preset interval is at least 2 frame groups, and the multiple video files correspond to at least 3;
[0031] The video file deletion module is specifically used to delete the video files in the video file group in multiple times according to the storage time and multiple preset video retention periods, and delete one or more of the remaining video files in the video file group each time.
[0032] Optionally, the plurality of video files corresponds to a number which is a power of 2, where n is an integer greater than 1;
[0033] The video file deletion module is specifically used to delete half of the remaining video files each time before deleting the last video file in the video file group.
[0034] Optionally, the plurality of video files corresponds to a number which is a power of 2, where n is an integer greater than 1;
[0035] The video file deletion module is further specifically configured to delete half of the remaining video files each time before deleting the last video file in the video file group.
[0036] Optionally, the multiple video files are sorted according to the number of the first frame group therein;
[0037] The video file deletion module is specifically used to delete the remaining video files each time according to the sorting interval of the remaining video files, so as to delete half of the remaining video files.
[0038] Optionally, the video storage device further includes a frame group data stream reading module;
[0039] A frame group data stream reading module, used to determine a target video file group in the storage pool in response to a video query instruction sent by a client;
[0040] The remaining video files in the target video file group are read, and a frame group data stream is returned to the client, so that the client plays the target video stream according to the frame group data stream.
[0041] Optionally, a frame group data stream reading module is specifically used to read the frame groups in the remaining video files in the target video file group in turn, and merge the frame group data of the read frame groups according to the sequence numbers of the frame groups to obtain the frame group data stream;
[0042] The frame group data stream is returned to the client, so that the client decodes the frame group data stream to obtain a target video stream to be played.
[0043] In a third aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors; a storage device configured to store one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the video storage method described in the first aspect.
[0044] In a fourth aspect, an embodiment of the present application provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to execute the video storage method as described in the first aspect.
[0045] The embodiment of the present application obtains the original video stream from the surveillance camera; splits the frame groups in the original video stream according to the preset interval to obtain multiple video files, and the interval between two adjacent frame groups in the same video file is equal to the preset interval; stores each video file in a storage pool and associates it with a video file group and records the storage time; deletes one or more video files in the video file group according to the storage time and the preset video retention period. By storing the original video stream in the form of a video file group, there is no need to consume additional server resources, and there is no need to transfer the video files after frame extraction to other storage pools, saving server resources and storage costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 is a flow chart of a video storage method provided by an embodiment of the present application;
[0047] Figure 2 This is a schematic diagram of a video file storage structure provided by an embodiment of the present application;
[0048] Figure 3 This is another schematic diagram of a video file storage structure provided by an embodiment of the present application;
[0049] Figure 4 This is another schematic diagram of a video file storage structure provided by an embodiment of the present application;
[0050] Figure 5 It is a flowchart of a frame group data stream reading method provided by an embodiment of the present application;
[0051] Figure 6 is a structural schematic diagram of a video storage device provided in an embodiment of the present application;
[0052] Figure 7 It is a structural schematic diagram of a video storage device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0055] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0056] The video storage method, device, equipment and medium provided in the embodiments of the present application are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0057] The video storage method provided in the embodiment of the present application can be used in the scenario where the surveillance video collected by the surveillance camera is stored for a long time. Based on the above application scenario, it can be understood that the executor of the present application can be a storage server.
[0058] Figure 1 is a flow chart of a video storage method provided by an embodiment of the present application, such as Figure 1 As shown, including:
[0059] Step S101: Obtain an original video stream from a surveillance camera.
[0060] In one embodiment, the original video stream captured by the surveillance camera can be obtained based on a preset time or a preset video acquisition cycle. The original video stream can be transmitted based on the Real Time Streaming Protocol (RTSP) or the GB / T28181 protocol to obtain the original video screen captured by the surveillance camera.
[0061] Step S102: split the frame groups in the original video stream according to a preset interval to obtain multiple video files, and the interval between two adjacent frame groups in the same video file is equal to the preset interval.
[0062] Wherein, the preset interval is used to indicate the interval between two adjacent frame groups, which can be a time interval, such as 2 seconds, or a frame group interval, such as an interval of 3 frame groups. A frame group (Group of Pictures, referred to as GOP) can be a video frame group composed of a series of continuous video frames, which can include an I frame and a number of P frames and B frames following the I frame. A video file is composed of multiple frame groups, and the interval between each two adjacent frame groups in the video file is the same as the preset interval. If the preset interval is an interval of 2 seconds, the interval between two adjacent frame groups in the same video file is also 2 seconds. If the preset interval is an interval of 3 frame groups, the interval between two adjacent frame groups in the same video file is also 3 frame groups. In one embodiment, the frame groups in the original video stream are split according to the preset interval to obtain multiple frame groups, and each frame group is written into a corresponding file to obtain multiple video files. Figure 2 is a schematic diagram of a video file storage structure provided by an embodiment of the present application, such as Figure 2 As shown, if the preset interval is 4 frame groups, the original video stream is split into 4 frame groups according to the time interval to obtain multiple frame groups, namely GOP1, GOP5, GOP9, and GOP1, GOP5, GOP9 are written into one video file, GOP2, GOP6, GOP10 are written into one video file, GOP3, GOP7, GOP11 are written into one video file, and GOP4, GOP8, GOP12 are written into one video file, so as to obtain 4 video files.
[0063] Step S103: Each of the video files is stored in a storage pool and associated into a video file group, and the storage time is recorded.
[0064] In one embodiment, multiple video files obtained by splitting the same original video stream are stored in a storage pool respectively and associated as a video file group, and the storage time of the video file group is recorded. After obtaining multiple video files, the same identifier can be used to identify the video files obtained by splitting the same original video stream, so as to facilitate subsequent associated storage. The identifier can be the camera name / video shooting time. Figure 2 As shown, video file 1, video file 2, video file 3 and video file 4 are associated as a video file group.
[0065] Step S104: deleting one or more video files in the video file group according to the storage time and the preset video retention period.
[0066] Wherein, the video retention period is used to indicate the period during which the video stream can be retained in the storage pool, such as 30 days, and the video retention period can be configured in advance by relevant personnel according to actual needs. In one embodiment, the deletion time of the video file is determined according to the storage time of the video file group and the preset video retention period. For example, if the storage time of the video file group is 2024.01.01 and the video retention period is 30 days, 2024.01.31 can be determined as the deletion time of the video file, and one or more video files in the video file group can be deleted at this time, wherein when there are 2 video files in the video file group, one of the video files can be deleted, and when the number of video files in the video file group is 4 or greater than 4, multiple video files in the video file group can be deleted, and the number of video files to be deleted is determined according to the total number in the video file group, such as deleting 1 / 3 of the video files, that is, when the number of video files in the video file group is 6, 2 of the video files are deleted.
[0067] The embodiment of the present application obtains the original video stream from the surveillance camera; splits the frame groups in the original video stream according to the preset interval to obtain multiple video files, and the interval between two adjacent frame groups in the same video file is equal to the preset interval; stores each video file in a storage pool and associates it with a video file group and records the storage time; deletes one or more video files in the video file group according to the storage time and the preset video retention period. By storing the original video stream in the form of a video file group, there is no need to consume additional server resources, and there is no need to transfer the video files after frame extraction to other storage pools, saving server resources and storage costs.
[0068] Optionally, the preset interval is at least 2 frame groups, and the multiple video files correspond to at least 3;
[0069] Correspondingly, deleting one or more video files in the video file group according to the storage time and the preset video retention period includes:
[0070] According to the storage time and a plurality of preset video retention periods, the video files in the video file group are deleted multiple times, and one or more remaining video files in the video file are deleted each time.
[0071] In one embodiment, the video reservation period can be set to multiple, such as 30 days, 45 days, 60 days, etc. Exemplarily, when the video file group is stored for 30 days, the multiple video files in the video file group are subjected to the first round of deletion processing, when the video file group is stored for 45 days, the multiple video files in the video file group are subjected to the second round of deletion processing, and when the video file group is stored for 60 days, the multiple video files in the video file group are subjected to the third round of deletion processing, wherein the number of video files deleted in each round can be determined according to the number of video files retained in the current video file group. Exemplarily, 1 / 2, 1 / 3 or 1 / 4 of the number of currently retained video files can be deleted, that is, when the number of remaining video files is 2, 1 video file is deleted, when the number of remaining video files is 6, 2 video files are deleted, or when the number of remaining video files is 8, 2 video files are deleted, etc.
[0072] In the above, according to the storage time and the preset multiple video retention periods, the video files in the video file group are deleted multiple times, and one or more of the remaining video files in the video file are deleted each time, wherein the preset interval is at least 2 frame groups, and the preset interval is at least 3 for multiple video files. On the basis of saving storage space, the video storage time is fully guaranteed, and the impact of the storage method on the video playback effect can be fully reduced.
[0073] Optionally, the plurality of video files corresponds to a number which is a power of 2, where n is an integer greater than 1.
[0074] Accordingly, deleting one or more of the remaining video files in the video file group each time includes:
[0075] Before deleting the last video file in the video file group, half of the remaining video files are deleted each time.
[0076] In one embodiment, in order to accurately determine one or more video files to be deleted from the remaining video files, the number of the plurality of video files corresponds to 2 raised to the power of n, where n is an integer greater than 1. Figure 3 is another schematic diagram of a video file storage structure provided by an embodiment of the present application, such as Figure 3As shown, the video file group includes 8 video files, namely video file 1, video file 2, video file 3, video file 4, video file 5, video file 6, video file 7 and video file 8. According to the multiple video reservation periods, the first video file deletion process is performed on the 30th day of the video file group storage. At this time, 4 video files in the video file group are deleted, such as deleting video file 2, video file 4, video file 6 and video file 8, and correspondingly, video file 1, video file 3, video file 5 and video file 7 are retained. On the 45th day of the video file group storage, two video files among the retained video files 1, video file 3, video file 5 and video file 7 are deleted, such as deleting video file 3 and video file 7, and correspondingly, video file 1 and video file 5 are retained. On the 60th day of the video file group storage, one video file among the retained video files 1 and video file 5 is deleted. For example, video file 5 is deleted and video file 1 is retained.
[0077] In the above, before deleting the last video file in the video file group, half of the remaining video files are deleted each time, wherein the plurality of video files corresponds to the nth power of 2, and n is an integer greater than 1. One or more video files to be deleted can be accurately and quickly determined from the remaining video files, thereby ensuring the subsequent video playback effect.
[0078] Optionally, the multiple video files are sorted according to the number of the first frame group therein;
[0079] Accordingly, deleting half of the remaining video files each time includes:
[0080] Each time, the deletion is performed according to the sorting interval of the remaining video files to delete half of the remaining video files.
[0081] In one embodiment, multiple video files are sorted according to the number of the first frame group therein. For example, if multiple video files are A, B, C, D, and E, wherein the first frame group number GOP1 contained in video file A, the first frame group number GOP3 contained in video file B, the first frame group number GOP4 contained in video file C, the first frame group number GOP2 contained in video file D, and the first frame group number GOP5 contained in video file E, then according to the number of the frame groups, it can be determined that video file A is the first video file, video file D is the second video file, video file B is the third video file, and video file C is the fourth video file. The sorting interval of video files refers to the interval between two adjacent video files, such as the sorting interval of video file 2 and video file 5 is 3.
[0082] Figure 4 is another schematic diagram of a video file storage structure provided by an embodiment of the present application, such as Figure 4 As shown, since the original video stream is split and stored based on the numbering order of the frame group when splitting, in order to avoid affecting the playing effect of the video when playing the video, when deleting the currently reserved video files in the video file group, avoid deleting the continuous video files, so that it can be avoided that when reading the frame groups contained in each video file, the intervals of the adjacent frame groups read are large. For example, when deleting 4 video files from video file 1, video file 2, video file 3, video file 4, video file 5, video file 6, video file 7 and video file 8, avoid deleting the continuous video files 2, video file 3, video file 4 and video file 5, and the video files can be deleted according to the sorting interval, such as deleting according to the shooting interval of 2, that is, deleting video files 2, video file 4, video file 6 and video file 8, retaining video files 1, video file 3, video file 5 and video file 7, or deleting video files 1, video file 3, video file 5 and video file 7, retaining video files 2, video file 4, video file 6 and video file 8.
[0083] In the above, each time the remaining video files are deleted according to the sorting interval, half of the remaining video files are deleted, wherein the plurality of video files are sorted according to the number of the first frame group therein, so as to fully avoid that when reading the frame groups contained in each video file, the interval between adjacent frame groups read is large, which affects the video playback effect.
[0084] Figure 5 is a flowchart of a frame group data stream reading method provided by an embodiment of the present application, such as Figure 5 As shown, including:
[0085] Step S201: In response to a video query instruction sent by a client, determine a target video file group in the storage pool.
[0086] The video query instruction is a command for instructing to view the corresponding video file group, and the video query instruction can also be a download instruction or a playback instruction. The target video file group is one of the video file groups to be read stored in the storage pool. In one embodiment, an association relationship between the video query instruction and the video file group identifier is preset. After receiving the video query instruction sent by the client, the target video file group corresponding to the video file group identifier associated with the video query instruction in the storage pool is determined according to the preset association relationship.
[0087] Step S202: read the remaining video files in the target video file group, and return the frame group data stream to the client, so that the client plays the target video stream according to the frame group data stream.
[0088] In one embodiment, the remaining video files in the target video file group are read in parallel, frame groups are merged according to the frame group sequence numbers in each video file to obtain a frame group data stream, and the frame group data stream is returned to the client so that the client plays the target video stream according to the frame group data stream.
[0089] In the above, in response to the video query instruction sent by the client, the target video file group in the storage pool is determined; the remaining video files in the target video file group are read, and the frame group data stream is returned to the client, so that the client plays the target video stream according to the frame group data stream. This can not only meet the user's need to access the frame group data stream for a long time, but also save the storage space of the frame group data stream.
[0090] Optionally, reading the remaining video files in the target video file group and returning the frame group data stream to the client so that the client plays the target video stream according to the frame group data stream includes:
[0091] Reading frame groups in the remaining video files in the target video file group in turn, and merging frame group data of the read frame groups according to the sequence numbers of the frame groups to obtain a frame group data stream;
[0092] The frame group data stream is returned to the client, so that the client decodes the frame group data stream to obtain a target video stream to be played.
[0093] Exemplarily, if the remaining video files in the target video file group are video file 1 and video file 3, respectively, wherein video file 1 includes GOP1, GOP4, GOP7, GOP10, and video file 3 includes GOP3, GOP6, GOP9, GOP12, the frame groups in video file 1 and video file 3 are read in turn, and the frame groups in video file 1 and video file 3 are decoded in the order of each other to obtain a frame group data stream containing GOP1, GOP3, GOP4, GOP6, GOP7, GOP9, GOP10, GOP12, and the frame group data stream is returned to the client.
[0094] In the above, the frame groups in the remaining video files in the target video file group are read in turn, the frame group data of the read frame groups are merged according to the sequence numbers of the frame groups to obtain a frame group data stream, and the frame group data stream is returned to the client, so that the client decodes according to the frame group data stream to obtain the target video stream to be played, thereby ensuring the smoothness of the playback of the target video stream.
[0095] Figure 6 is a schematic diagram of the structure of a video storage device provided in an embodiment of the present application, such as Figure 6 As shown, including:
[0096] The video stream acquisition module 31 is used to acquire the original video stream from the surveillance camera;
[0097] A frame group splitting module 32 is used to split the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file group is equal to the preset interval;
[0098] The video file group storage module 33 is used to store each of the video files in a storage pool, associate them into a video file group and record the storage time;
[0099] The video file deletion module 34 is used to delete one or more video files in the video file group according to the storage time and the preset video retention period.
[0100] The embodiment of the present application obtains the original video stream from the surveillance camera; splits the frame groups in the original video stream according to the preset interval to obtain multiple video files, and the interval between two adjacent frame groups in the same video file is equal to the preset interval; stores each video file in a storage pool and associates it with a video file group and records the storage time; deletes one or more video files in the video file group according to the storage time and the preset video retention period. By storing the original video stream in the form of a video file group, there is no need to consume additional server resources, and there is no need to transfer the video files after frame extraction to other storage pools, saving server resources and storage costs.
[0101] In a possible embodiment, the preset interval is at least 2 frame groups, and the plurality of video files corresponds to at least 3;
[0102] The video file deletion module 34 is specifically used to delete the video files in the video file group in multiple times according to the storage time and multiple preset video retention periods, and delete one or more remaining video files in the video file group each time.
[0103] In a possible embodiment, the plurality of video files corresponds to a number which is a power of 2, where n is an integer greater than 1;
[0104] The video file deleting module 34 is further configured to delete half of the remaining video files each time before deleting the last video file in the video file group.
[0105] In a possible embodiment, the plurality of video files are sorted according to the number of the first frame group therein;
[0106] The video file deleting module 34 is further configured to delete the remaining video files according to the sorting interval each time, so as to delete half of the remaining video files.
[0107] In a possible embodiment, the video storage device further includes a frame group data stream reading module;
[0108] A frame group data stream reading module, used to determine a target video file group in the storage pool in response to a video query instruction sent by a client;
[0109] The remaining video files in the target video file group are read, and a frame group data stream is returned to the client, so that the client plays the target video stream according to the frame group data stream.
[0110] In a possible embodiment, the frame group data stream reading module is specifically used to read the frame groups in the remaining video files in the target video file group in turn, and merge the frame group data of the read frame groups according to the sequence numbers of the frame groups to obtain the frame group data stream;
[0111] The frame group data stream is returned to the client, so that the client decodes the frame group data stream to obtain a target video stream to be played.
[0112] The embodiment of the present application also provides a video storage device, which can integrate a video storage device provided by the embodiment of the present application. Figure 7 Schematic diagram of a video storage device provided by an embodiment of the present application. Figure 7 The video storage device includes: an input device 43, an output device 44, a memory 42 and one or more processors 41; the memory 42 is used to store one or more programs; when one or more programs are executed by one or more processors 41, the one or more processors 41 implement the video storage method provided in the above embodiment. The input device 43, the output device 44, the memory 42 and the processor 41 can be connected by a bus or other means. Figure 7 The example of connecting through bus is taken in the following.
[0113] The memory 42, as a computing device readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the video storage method provided in any embodiment of the present application. The memory 42 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application required for a function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 42 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 42 may further include a memory remotely arranged relative to the processor 41, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0114] The input device 43 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 44 may include a display device such as a display screen.
[0115] The processor 41 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 42, that is, implements the above-mentioned video storage method.
[0116] The video storage device, equipment and computer provided above can be used to execute the video storage method provided in any of the above embodiments, and have corresponding functions and beneficial effects.
[0117] The embodiment of the present application further provides a storage medium storing computer executable instructions. When the computer executable instructions are executed by a computer processor, they are used to execute the video storage method provided in the above embodiment. The video storage method includes:
[0118] Get the raw video stream from the surveillance camera;
[0119] Splitting the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file is equal to the preset interval;
[0120] Each of the video files is stored in a storage pool respectively, associated as a video file group and the storage time is recorded;
[0121] One or more video files in the video file group are deleted according to the storage time and the preset video retention period.
[0122] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media that may reside in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.
[0123] Of course, the storage medium containing computer executable instructions provided in the embodiments of the present application is not limited to the video storage method described above, and the computer executable instructions can also execute related operations in the video storage method provided in any embodiment of the present application.
[0124] The video storage device, equipment and storage medium provided in the above embodiments can execute the video storage method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the video storage method provided in any embodiment of the present application.
[0125] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments described herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the scope of protection of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.
Claims
1. A video storage method, characterized in that: include: Get the raw video stream from the surveillance camera; Splitting the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file is equal to the preset interval; Each of the video files is stored in a storage pool respectively, associated as a video file group and the storage time is recorded; One or more video files in the video file group are deleted according to the storage time and the preset video retention period.
2. The video storage method according to claim 1, characterized in that: The preset interval is at least 2 frame groups, and the plurality of video files corresponds to at least 3; Correspondingly, deleting one or more video files in the video file group according to the storage time and the preset video retention period includes: The video files in the video file group are deleted multiple times according to the storage time and a plurality of preset video retention periods, and one or more remaining video files in the video file are deleted each time.
3. The video storage method according to claim 2, characterized in that: The plurality of video files corresponds to a number which is a power of 2, where n is an integer greater than 1; Accordingly, deleting one or more of the remaining video files in the video file group each time includes: Before deleting the last video file in the video file group, half of the remaining video files are deleted each time.
4. The video storage method according to claim 3, characterized in that: The multiple video files are sorted according to the number of the first frame group therein; Accordingly, deleting half of the remaining video files each time includes: Each time, the deletion is performed according to the sorting interval of the remaining video files to delete half of the remaining video files.
5. The video storage method according to claim 1, characterized in that: After the frame groups in the original video stream are split according to the preset intervals to obtain multiple video files, the method further includes: In response to a video query instruction sent by a client, determining a target video file group in the storage pool; The remaining video files in the target video file group are read, and a frame group data stream is returned to the client, so that the client plays the target video stream according to the frame group data stream.
6. The video storage method according to claim 5, characterized in that: The step of reading the remaining video files in the target video file group and returning the frame group data stream to the client so that the client plays the target video stream according to the frame group data stream comprises: Reading frame groups in the remaining video files in the target video file group in turn, and merging frame group data of the read frame groups according to the sequence numbers of the frame groups to obtain a frame group data stream; The frame group data stream is returned to the client, so that the client decodes the frame group data stream to obtain a target video stream to be played.
7. A video storage device, characterized in that: include: A video stream acquisition module is used to acquire the original video stream from the surveillance camera; A frame group splitting module, used for splitting the frame groups in the original video stream according to a preset interval to obtain multiple video files, wherein the interval between two adjacent frame groups in the same video file group is equal to the preset interval; A video file group storage module, used to store each of the video files in a storage pool, associate them into a video file group and record the storage time; The video file deletion module is used to delete one or more video files in the video file group according to the storage time and the preset video retention period.
8. The video storage device according to claim 7, characterized in that: The preset interval is at least 2 frame groups, and the plurality of video files corresponds to at least 3; The video file deletion module is specifically used to delete the video files in the video file group in multiple times according to the storage time and multiple preset video retention periods, and delete one or more of the remaining video files in the video file group each time.
9. An electronic device, comprising: one or more processors; A storage device, used for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the video storage method according to any one of claims 1-7.
10. A storage medium storing computer executable instructions, wherein the computer executable instructions are used to perform the video storage method according to any one of claims 1 to 7 when executed by a computer processor.