A storage method, system, device and storage medium for video data
By dividing the storage space into different levels of storage blocks and storing and managing according to the type and importance of video data, the problem of video data storage resulting in short retention periods of important video data in chronological order is solved, and efficient storage and management of video data is achieved.
Patent Information
- Application Number
- CN202211568736.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-08
- Publication Date
- 2025-06-27
- Estimated Expiration
- 2042-12-08
AI Technical Summary
In the prior art, video data storage is in chronological order, resulting in a short retention period of important video data and the inability to effectively manage the life cycle of video data.
By dividing the storage space into index blocks and multiple storage blocks, and dividing levels according to different retention periods of the storage blocks, video data is stored in the corresponding storage blocks according to their type and importance, and ordinary-type video data is extracted and stored.
Different types of video data are managed according to their importance and retention period, extending the retention period of high-value video data, and optimizing the utilization of storage space to ensure the balance of storage space.
Smart Images

Figure CN116170642B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data storage, and in particular, to a method, system, device and storage medium for storing video data. Background Art
[0002] With the rapid growth of various video data, the preservation scheme of video data has attracted more and more attention. Currently, the main mechanisms for video storage are full overwrite, stop when full, or partial full overwrite. The storable video duration of the above methods is proportional to the storage space. The main measure for the video space optimization scheme is to compress the video during storage. However, because the video storage duration and the storage space of these video data storage schemes are linearly related, the cost of extending the storage duration is relatively high, and a large amount of storage capacity needs to be expanded. Secondly, due to the simple video compression, the quality of the compressed video data is lost, and it is difficult to meet the search needs during playback.
[0003] Because the storage life cycle management of video data is only set according to the time dimension, the update of information only simply determines whether information needs to be overwritten according to the time sequence. Thus, valuable information may be prematurely overwritten because it occurred earlier in time, and after these valuable overwritten information, there are still a lot of useless video data occupying precious storage space. As a result, the storage of video data cannot play a greater value.
[0004] To solve the above problems, the prior art discloses a method for storing video data. This method determines the importance of video data based on video data content analysis, and flexibly adjusts the life cycle of the stored video data according to the difference in importance. It preferentially stores video data containing important content, and preferentially overwrites video data without important information or with low importance. In the case of the same storage space, it preferentially ensures the storage of important video data, maximizing the effectiveness of video data. It first stores the video data and then performs periodic analysis on the video data. However, the video data is still stored in the order of time. After the ordinary video data is recorded, if it is an event, only a label is added to the ordinary video data, and the actual event video data will survive or perish with the ordinary video data, resulting in a very short retention period for important video data.
[0005] Aiming at the problem in the related art that video data is stored in the order of time, resulting in a very short retention period for important video data, no effective solution has been proposed yet. Summary of the Invention
[0006] In this embodiment, a method, a system, a device, and a storage medium for storing video data are provided to solve the problem in the related art that video data is stored in chronological order, resulting in a very short retention period for important video data.
[0007] In a first aspect, in this embodiment, a method for storing video data is provided. The method includes:
[0008] Dividing the storage space into an index block and multiple storage blocks according to preset conditions, and dividing the storage blocks into different levels according to different retention periods of the storage blocks;
[0009] According to the correspondence relationship between the type of the preset video data and the level of the storage block, storing the video data in the storage block of the corresponding level, and writing the storage location information of the video data in the corresponding storage block into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type, and multiple event types;
[0010] When the current video data is completely stored, performing frame extraction storage on the video data of the ordinary type.
[0011] In some embodiments, the storage block includes an index area and a data area, and the index area includes a secondary index area and an extended index area;
[0012] The secondary index area records the data summary information of the current data area;
[0013] The extended index area records the storage location indication relationship established according to the chronological order of the data stored in other data areas and the current data area.
[0014] In some embodiments, when the storage block corresponding to the current type of video data is completely stored, select the storage block with the lowest level and being idle for storage, and / or select an idle storage block for storage according to the retention time set by the user.
[0015] In some embodiments, the performing frame extraction storage on the video data of the ordinary type includes:
[0016] Dividing the video data of the ordinary type into n equal parts, taking key frames at intervals for comparison and analysis, comparing whether the change between two intervals of the key frames reaches a threshold. If so, continue to divide the video data within the two key frame time periods into n1 equal parts until the change between two intervals of the key frames does not reach the threshold and / or the two intervals of the key frames reach a set interval time and stop. Store the key frames into the data area of the corresponding storage block, and supplement the content in the index area of the corresponding storage block, where n and n1 are natural numbers.
[0017] In some of these embodiments, after the frame extraction and storage of the video data of the ordinary type are completed, the storage block storing the video data of the ordinary type is released.
[0018] In some of these embodiments, the method further includes:
[0019] After the frame extraction and storage of the video data of the ordinary type are completed, multi-level frame extraction and storage are performed on the frame-extracted and stored video data.
[0020] In a second aspect, a storage system for video data is provided in this embodiment. The storage system includes:
[0021] A front-end management device, a switch, a network camera, and a client storage device;
[0022] The front-end management device is connected to the network camera through the switch and receives the video data collected by the network camera;
[0023] When the front-end management device first accesses the client storage device, the storage space of the client storage device is divided into an index block and a plurality of storage blocks according to preset conditions. According to the different retention periods of the storage blocks, the storage blocks are divided into different levels. According to the corresponding relationship between the type of the preset video data and the level of the storage block, the video data is stored in the storage block of the corresponding level, and the storage location information of the video data in the corresponding storage block is written into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type, and multiple event types;
[0024] When the current video data is completed being stored, frame extraction and storage are performed on the video data of the ordinary type.
[0025] In a third aspect, a storage device for video data is provided in this embodiment. The device includes:
[0026] A partitioning module, configured to divide the storage space into an index block and a plurality of storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks;
[0027] A storage module, configured to store the video data in the storage block of the corresponding level according to the corresponding relationship between the type of the preset video data and the level of the storage block, and write the storage location information of the video data in the corresponding storage block into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type, and multiple event types; when the current video data is completed being stored, frame extraction and storage are performed on the video data of the ordinary type.
[0028] Fourthly, in this embodiment, an electronic device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the storage method of video data described in the first aspect above is implemented.
[0029] Fifthly, in this embodiment, a storage medium is provided, on which a computer program is stored. When the program is executed by a processor, the storage method of video data described in the first aspect above is implemented.
[0030] Compared with the related art, a storage method, system, device, and storage medium for video data provided in this embodiment divide the storage space into an index block and multiple storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks; according to the correspondence between the preset type of video data and the level of the storage block, the video data is stored in the storage block of the corresponding level, and the storage information in the corresponding storage block of the video data is written into the index block, solving the problem in the related art that video data is stored in chronological order, resulting in a very short retention period for important video data, and realizing the management of different storage block types according to different retention periods, facilitating the management of storage blocks and achieving a balance between a longer retention period for high-value video data and the storage space.
[0031] Details of one or more embodiments of the present application are set forth in the following drawings and description, so that other features, objects, and advantages of the present application become more concise and understandable. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] The drawings described herein are used to provide a further understanding of the present application, and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:
[0033] Figure 1 is a schematic structural diagram of a storage system for video data in an embodiment of the present application.
[0034] Figure 2 is a flowchart of a storage method for video data in an embodiment of the present application.
[0035] Figure 3 is a flowchart of a storage method for video data in a preferred embodiment of the present application.
[0036] Figure 4 is a schematic diagram of the space division of a client storage device in a preferred embodiment of the present application.
[0037] Figure 5It is a schematic diagram of a storage block selection strategy in a preferred embodiment of the present application.
[0038] Figure 6 It is a structural block diagram of a storage device for video data in an embodiment of the present application. Detailed implementation manners
[0039] To more clearly understand the purpose, technical solution and advantages of the present application, the present application will be described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0040] Unless otherwise defined, the technical terms or scientific terms involved in the present application shall have the general meaning understood by those with ordinary skills in the technical field to which the present application belongs. In the present application, words such as "a", "one", "a kind of", "the", "these" and the like do not indicate a limitation in quantity, and they can be singular or plural. The terms "including", "comprising", "having" and any variants thereof involved in the present application are intended to cover non-exclusive inclusion; for example, a process, method, system, product or device including a series of steps or modules (units) is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules (units) inherent in these processes, methods, products or devices. The terms "connected", "coupled" and the like involved in the present application do not limit to physical or mechanical connections, but may include electrical connections, whether directly or indirectly connected. The "multiple" involved in the present application means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" may mean: A exists alone, A and B exist simultaneously, and B exists alone. Usually, the character " / " indicates that the objects associated before and after are in an "or" relationship. The terms "first", "second", "third" and the like involved in the present application only distinguish similar objects and do not represent a specific sorting for the objects.
[0041] In this embodiment, a storage system for video data is further provided. Figure 1 It is a schematic structural diagram of a storage system for video data in this embodiment, as Figure 1 shown. The storage system includes:
[0042] Network camera 10, switch 20, front-end management device 30 and client storage device 40;
[0043] The front-end management device 30 is connected to the network camera 10 through the switch 20 and receives the video data collected by the network camera 10.
[0044] When the front-end management device 30 first accesses the client storage device 40, the storage space of the client storage device 40 is divided into an index block and multiple storage blocks according to preset conditions. According to the different retention periods of the storage blocks, the storage blocks are divided into different levels. According to the correspondence relationship between the type of video data preset and the level of the storage block, the video data is stored in the storage block of the corresponding level, and the storage information in the storage block corresponding to the video data is written into the index block; wherein, the types of video data include ordinary type, multi-level frame extraction type and multiple event types; when the current video data is stored, frame extraction storage is performed on the ordinary type of video data.
[0045] Specifically, the client storage device 40 can be a hard disk, CD-ROM, USB flash drive, external hard disk, external hard disk cabinet, etc. inside the front-end management device; the front-end management device 30 can be a network video recorder NVR, a storage video integrated machine VMS, etc.
[0046] Through the above steps, by dividing the storage space into an index block and multiple storage blocks according to preset conditions, and dividing the storage blocks into different levels according to the different retention periods of the storage blocks; according to the correspondence relationship between the type of video data preset and the level of the storage block, the video data is stored in the storage block of the corresponding level, and the storage information in the storage block corresponding to the video data is written into the index block, the problem that in the related technology, video data is stored in chronological order, resulting in a very short retention period for important video data is solved, and different types of storage blocks are managed according to different retention periods, which is convenient for storage block management and balances the longer retention period of high-value video data and the storage space.
[0047] In this embodiment, a method for storing video data is provided. Figure 2 It is a flowchart of a method for storing video data in this embodiment, as Figure 2 shown, and this process includes the following steps:
[0048] Step S201, divide the storage space into an index block and multiple storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks.
[0049] Specifically, in video monitoring, in order to store the video data collected by the camera, a storage client storage device will be set up, and the storage space in the client storage device is divided into an index block and multiple storage blocks. The specific division method can be divided according to size. For example, each storage block is set to 512M in size. Of course, it can also be set to different sizes, which is not limited here. Users set multiple storage blocks with different retention periods according to the different degrees of importance. According to the different retention periods of the storage blocks, the storage blocks are divided into different levels, and the storage block with a longer retention period has a higher level.
[0050] Step S202: According to the preset correspondence between the type of video data and the level of storage blocks, store the video data in the storage blocks of the corresponding level, and write the storage information in the corresponding storage blocks of the video data into the index block. Among them, the types of video data include ordinary type, multi-level frame extraction type, and multiple event types. When the current video data is completely stored, perform frame extraction storage on the ordinary type of video data.
[0051] Specifically, when the front-end management device receives the data collected by the network camera, it performs block storage according to the video data events. The front-end management device identifies the type of video data according to the preset deep learning model, including that the video data of the ordinary type has the picture change threshold within the set range within a predetermined time, the video data of the ordinary dynamic detection type without human figures and motor vehicles, and the event type video data of the set events (which can be motor vehicle video data or human figure video data, or the video data of the alarm type set by the user). Exemplarily, the storage block corresponding to the ordinary type of video data is level 1, the storage block corresponding to the video data obtained by frame extraction processing of the ordinary video data according to the policy is level 2, the storage block corresponding to the ordinary dynamic detection type of video data is level 3, and the storage block corresponding to the event type of video data is level 4. The storage blocks of the corresponding levels can be named ordinary block, frame extraction block, dynamic detection block, and event block in sequence. Other video data events can be set according to user requirements and the intelligent analysis algorithms supported by the IPC. The retention periods corresponding to different levels are different.
[0052] Further, the front-end management device receives the data collected by the network camera. When the network camera uploads a video segment, the video segment may include ordinary type and event type videos. Among them, the ordinary type of video is a video without events occurring, where the objects in the picture remain unchanged for a long time, with possible minor differences and not reaching the alarm level. The event type videos include but are not limited to ordinary dynamic detection videos, that is, videos without human figures and motor vehicles, motor vehicle video data videos, and human figure video data videos. Exemplarily, when a video segment uploaded by the current network camera is an ordinary type of video and a human figure video data video, the ordinary type of video and the human figure video data video are respectively stored in the corresponding storage blocks of the client storage device, and the storage position relationship of the current ordinary type of video and the human figure video data video is stored in the index area. When the storage of this video segment uploaded by the current network camera is completed, perform frame extraction storage on the ordinary type of video data.
[0053] Through the above steps, the storage space is divided into index blocks and multiple storage blocks according to preset conditions. According to the different retention periods of the storage blocks, the storage blocks are divided into different levels; according to the corresponding relationship between the types of preset video data and the levels of the storage blocks, the video data is stored in the storage blocks of the corresponding levels, and the storage information in the corresponding storage blocks of the video data is written into the index blocks. The video data of different events is stored according to the storage block level. Since the corresponding index block stores the storage location information and storage time information of the video data, the chronological order of the video data will not be damaged during video data playback. When retrieving video data by event type, there is no need to retrieve and eliminate ordinary video data records, and the retrieval efficiency is greatly improved. The complete video data uploaded by the network camera is divided into blocks and stored in the storage blocks of the corresponding levels according to different types of video data. Without changing the retention period of the complete video data set by the user, the retention period of the video data with a higher level becomes longer. Moreover, the retention period is managed according to the video data type, and the management efficiency is high, without additional database records for the relationships of each event.
[0054] In some of these embodiments, the storage block includes an index area and a data area. The index area includes a secondary index area and an extended index area; the secondary index area records the data summary information of the current data area; the extended index area records the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area.
[0055] Specifically, when the currently uploaded video data segment contains two types of video data at the same time, according to the video types, the currently uploaded video data segment is respectively stored in the data areas of the storage blocks of the corresponding levels. At the same time, the secondary index areas of the storage blocks of the corresponding levels respectively record the data summary information of the current data area, and the extended index areas of the storage blocks of the corresponding levels record the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area.
[0056] In some of these embodiments, when the storage of the storage block corresponding to the current type of video data is completed, the storage block with the lowest level and being idle is selected for storage, and / or an idle storage block is selected for storage according to the retention time of the video data set by the user.
[0057] Specifically, when there are no available free storage blocks of the corresponding level for ordinary type video data, or when the retention period of the free storage blocks of the corresponding level for ordinary type video data is insufficient. For example, if the user sets the integrity of ordinary video data to 7 days, but now there are no available free storage blocks of the corresponding level to continue storing the complete video data, then first select from the oldest frame extraction block of the next higher level, and then use it as the next consecutive block of the current ordinary type storage block. When there are no available free storage blocks of the corresponding level for other higher-level blocks, select blocks in ascending order of storage block level. Exemplarily, when event video data occurs and there are no available free storage blocks of the corresponding level in the current event storage block, first select from ordinary blocks. If there are no ordinary blocks, then select from the frame extraction blocks of the next higher level. If there are no frame extraction blocks either, then select from the oldest motion detection blocks of ordinary type, and so on. When selecting storage blocks for video data with a higher event level, preferentially select from blocks with a lower level, so as to determine the retention period of the data type block according to the importance of the video data.
[0058] Furthermore, according to the different retention periods of the storage blocks, exemplarily, ordinary storage blocks with a 3-day retention period, frame extraction storage blocks with a 7-day retention period, motion detection storage blocks with a 15-day retention period, and event storage blocks with a 30-day retention period are respectively used to store ordinary type video data, frame extraction type video data, motion detection type video data, motor vehicle video data, and / or humanoid video data. In the case where a video uploaded by the current network camera has been completely stored, and in the case where the ordinary type video data with a 3-day retention period has been completely stored, perform frame extraction storage on the ordinary type video data. Since most of the time, ordinary video data occupies the vast majority of the storage space, if frame extraction analysis is performed on ordinary video data, valuable changed data can be extracted from the ordinary video data, without losing any frames with slight differences, and useless video data can be eliminated, then the storage space can be greatly reduced, and data with a longer retention period can be saved.
[0059] In some of the embodiments, performing frame extraction storage on ordinary type video data includes: dividing the ordinary type video data into n equal parts, taking key frames at intervals for comparison and analysis, comparing whether the change between two intervals of key frames reaches a threshold. If so, then continue to divide the video data within the two intervals of key frames into n1 equal parts until the change between the two intervals of key frames does not reach the threshold and / or the two intervals of key frames reach a set interval time and stop. Store the key frames into the data area of the corresponding storage block, and supplement the content in the index area of the corresponding storage block, where n and n1 are natural numbers.
[0060] Specifically, if the time period corresponding to a certain ordinary type of video data is [t1, t2], then the video data in this time period is divided into n equal intervals for key frame comparison and analysis. When the change of key frames in two intervals reaches the threshold, the video data in the time period within these two key frames is further divided into n1 equal parts until the threshold is not reached and then it stops. Exemplarily, if the interval between t2 and t1 is 1 hour, then key frame comparison and analysis can be preset for every 2 minutes of video data. If there is no difference in the video data every 2 minutes and the change threshold is not reached, then 1 key frame is sent to the storage block of level 2 for storage every 2 minutes, and only 2 key frames of the 2-minute video data are saved; if the change threshold is reached within 2 minutes, then it is further divided into 6 equal parts within this 2 minutes, that is, key frame comparison and analysis are performed every 20 seconds. If the threshold is not reached, 1 key frame is sent to the level 2 storage every 20 seconds; if the change threshold is still reached within 20 seconds, then it is divided into 4 equal parts, that is, comparison is made every 5 seconds. Regardless of whether the threshold is reached subsequently, only the key frames at 5-second intervals are saved to the block of level 2 for storage.
[0061] In some embodiments, after the ordinary type of video data is frame-extracted and stored, the storage block storing the ordinary type of video data is released.
[0062] Specifically, when the ordinary video data is frame-selected and stored on the frame-extracted block, the data index of this frame-extracted block needs to re-establish the index relationship with other video data blocks to achieve sequential coherence in terms of data time order. When all current ordinary blocks are processed, the storage block storing the ordinary type of video data is released. Thus, the storage space for ordinary video data can be greatly reduced, which not only extends the retention period of ordinary video data pictures but also does not lose the detailed pictures with changes.
[0063] In some embodiments, after the ordinary type of video data is frame-extracted and stored, multi-level frame extraction and storage are performed on the frame-extracted and stored video data.
[0064] Specifically, according to user settings or the remaining storage space, multi-level frame extraction can be performed on the already stored video data, so that the more important video frames in the video data are saved for a longer time, and the unimportant video frames stored for too long can be overwritten.
[0065] The following describes and illustrates this embodiment through preferred embodiments.
[0066] Figure 3 It is a flowchart of a storage method for a type of video data in this preferred embodiment, as Figure 3 shown, and this process includes the following steps:
[0067] Step S301, formatting the client storage device, dividing the client storage device into blocks according to a preset space size, and dividing it into a super block, a main index area, and multiple data areas.
[0068] Specifically, Figure 4 As shown, the client storage device is first formatted and divided into blocks, wherein the block size can be set according to user needs, such as 16K for the super block, 64K for the main index area, and 512M for the data area.
[0069] Step S302, the divided data area is divided into a secondary index area and a storage area according to a preset ratio, wherein the secondary index area is used to store index data, and the storage area is used to store video data.
[0070] Specifically, the secondary index area and the storage area can be divided according to a ratio of 5 to 95. The secondary index area is set to a size of 512K. Figure 4 As shown, the secondary index area is a secondary index (512K), and the secondary index area includes the current level index area and the index extension area. The current level index area is the secondary index 1, secondary index 2, secondary index 3, ..., secondary index n in the figure. The secondary index records the data summary information of the current block. The index extension area is the index extension area 1, index extension area 2, index extension area 3, ..., index extension area n in the figure. The index extension area records the storage position indication relationship between the data stored in other storage areas and the current storage area in chronological order. The storage area includes I frame group 1, I frame group 2, ..., I frame group n and a reserved area.
[0071] Step S303, when performing data storage, the video data storage data is written into the data area in blocks, and when the data storage of a block is completed in the data area, the written storage data is indexed and maintained in the main index area.
[0072] Specifically, when writing video data in the data area of the client storage device, the video data is written in the blocks in the data area one by one, and when each block of data storage is completed in the data area, index information of the completed block is generated, and then the index information is written into the main index area of the client storage device, and finally the client storage device information such as the write position of the client storage device is updated. Since index maintenance is also performed while writing video data.
[0073] Furthermore, when ordinary type video data is stored, the network camera IPC sends the video data to the network hard disk recorder NVR, and the NVR stores the data in the storage block of level 1. If an alarm event occurs in the IPC, the IPC marks the video data type and sends the video data to the NVR side. When the NVR receives the video data, it stores it in storage blocks of different preset levels according to the alarm type. Then the extended index of the secondary index area of the ordinary video data (i.e., the index extension area in the figure) points to the location of the event video data just stored. If the alarm event ends, the location extension area of the event video data storage points to the ordinary video data storage location after the event ends. In this way, when playing back the video data, ordinary video data and event video data can be played in chronological order to achieve the continuity of the video data playback time. If the alarm video data is retrieved, it is only necessary to retrieve the secondary index on the non-ordinary video data. Since the retrieval process does not need to traverse and eliminate the secondary index of the ordinary video data, the retrieval efficiency is greatly improved. The ordinary block secondary index records ordinary video data. After an event occurs, the video data is recorded in the event block, and then the ordinary block index extension 2 points to the location 2 where the event video data block is stored. When the event video data is recorded, the event block secondary index extension area records the location where the subsequent ordinary video data is stored.
[0074] Step S304: When the storage blocks corresponding to the level of the video data are consumed, a cross-type storage block is selected for storage.
[0075] Specifically, in order to facilitate the instant selection of blocks for seamless storage when the current ordinary video data storage block is used up, and to preserve the retention period of the previous video data as much as possible, the subsequent three blocks must be pre-selected when the current block is selected and stored. The pre-selection operation means that the current block is being stored and has not been written yet, and the subsequent blocks have been selected, but the subsequent block data index has not been cleared, and the data can still be retrieved. As long as the current block storage is completed, the original data index of the selected subsequent block can be cleared, and then the current data is stored. The oldest block of the video data is selected according to the block selection strategy to determine which block is selected. The block selection strategy refers to Figure 5As shown in the figure, the horizontal axis is the retention period timeline and the vertical axis is the block type. It can be seen that for the storage space of the same block size, the retention periods of different block storage types are usually different. For example, ordinary block 1 < frame extraction block 2 < motion detection block 3 < event block 4. Among them, the video data of the ordinary type corresponds to the storage block of level 1, the video data obtained by frame extraction processing of ordinary video data according to the strategy corresponds to the storage block of level 2, the video data of the ordinary motion detection type corresponds to the storage block of level 3, and the video data of the event type corresponds to the storage block of level 4. The storage blocks of the corresponding levels can be named as ordinary block 1, frame extraction block 2, motion detection block 3, and event block 4 in sequence. Other video data events can be set according to user requirements and the intelligent analysis algorithms supported by the IPC. The retention periods corresponding to different levels are different.
[0076] Specifically, the block selection strategy is as follows: (1) If it is a new disk and there are enough storage blocks and the retention period of ordinary video data is also sufficient, when the ordinary video data reaches the retention period, the oldest storage block is cyclically overwritten, and other types of storage blocks are allocated as needed until all storage blocks are used up. See the following for details; (2) Normally, it cyclically overwrites within the same storage block level, and the oldest block is selected to store the latest data; (3) The retention period of the data block of the block type with a higher level is always at least one block longer than that of the adjacent lower-level block, and the retention period of the data block with a higher level is longer than that of the adjacent lower-level data block. If the retention period is not enough, borrow blocks from the oldest data block of the adjacent lower level for storage; (4) The ordinary video data block is generally not borrowed by the higher-level block, and it will only be borrowed upward when the retention period of the higher-level video data is shorter than that of the ordinary block (since the number of event blocks is relatively small compared to ordinary blocks, for example, if there is event video data for a certain period of time and the event blocks are quickly occupied, then blocks need to be borrowed from the ordinary blocks for storage); (5) When the retention period of the ordinary block video data is not enough and the retention period of the higher level is greater than that of the ordinary block, blocks can be selected upward. Since the index area of the ordinary video data block stores this ordinary video data, the storage location of the ordinary video data corresponding to this index can be found. From the index information, the duration intervals [t1, t2] of each time period corresponding to all the ordinary video data of this block can be known. Therefore, data analysis of the ordinary video data can be carried out according to the frame extraction preset strategy.
[0077] Step S305, the types of video data include ordinary type and event type; when the current video data is stored, the ordinary type of video data is frame-extracted and stored.
[0078] Specifically, since there are no events in ordinary video data and the objects in the picture remain unchanged for a long time, there may be slight differences that do not reach the alarm level. However, it is also necessary to store the video data with weak changes. According to the selected picture comparison difference threshold, frames are extracted and stored in block level 2. The retention period of ordinary block records is T, that is, the time span is [-T, 0]. It is not necessary to extract frames from all ordinary videos. It can be preset to process ordinary blocks in the time period [-T, (-9 / 10)T], and not process ordinary blocks in the time period [(-9 / 10)T, 0]. If the corresponding blocks are processed as follows, for example, about 1000 blocks with a retention period of T are required, and [1000, 900] blocks have been processed. When actually releasing the oldest 1000th block, only select the previous block, that is, the 899th block, for frame extraction and storage. When the oldest block is selected to store the latest data, an ordinary block will be selected to process the ordinary video of this block. Process the ordinary video data of each segment index record. For example, if the time period corresponding to a certain index is [t1, t2], then the video data is divided into n equal intervals for key frame comparison and analysis. When the change of key frames in two intervals reaches the threshold, the video data in the time period between these two key frames is further preset into n1 equal parts until the threshold is not reached and then stop. For example, if the interval between t2 and t1 is 1 hour, it can be preset to perform key frame comparison and analysis on the video data every 2 minutes. If the video data every 2 minutes is the same and does not reach the change threshold, then send 1 key frame to the storage block of level 2 for storage every 2 minutes, and only 2 key frames of the 2-minute video data are saved. If the 2-minute interval reaches the change threshold, then divide it into 6 equal parts within this 2 minutes, that is, perform key frame comparison and analysis every 20 seconds. If the threshold is not reached, send a key frame to the level 2 storage block every 20 seconds for storage; if the change threshold is still reached within 20 seconds, then divide it into 4 equal parts, that is, compare every 5 seconds. Regardless of whether the threshold is reached subsequently, only save the key frames at 5-second intervals to the storage block of level 2. When the selected frame of this ordinary video data is stored on the frame extraction block, the data index of this frame extraction block needs to be re-established with the index relationship established by other video data blocks to achieve the sequential coherence of the data in time order. When all current ordinary blocks are processed, release this ordinary block. Thus, the storage space for ordinary video data can be greatly reduced, which not only extends the retention period of ordinary video data pictures but also does not lose the detailed pictures with changes.
[0079] It should be noted that the steps shown in the above process or the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here, such as step S304 and step S305.
[0080] In this embodiment, a storage device for video data is also provided. This device is used to implement the above-mentioned embodiments and preferred implementation manners, and those that have been described will not be repeated here. The following terms such as "module", "unit", "sub-unit", etc. can be a combination of software and / or hardware that can achieve a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.
[0081] Figure 6 is a structural block diagram of a storage device for video data in this embodiment. As Figure 6 shown, the device includes:
[0082] A partitioning module 50, configured to partition the storage space into an index block and multiple storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks;
[0083] A storage module 60, configured to store the video data in the storage blocks of the corresponding level according to the correspondence between the preset types of video data and the levels of the storage blocks, and write the storage information in the corresponding storage blocks of the video data into the index block.
[0084] In the embodiment of the present invention, in the above manner, a storage device for video data divides the storage space into an index block and multiple storage blocks according to preset conditions, divides the storage blocks into different levels according to the different retention periods of the storage blocks; according to the correspondence between the preset types of video data and the levels of the storage blocks, stores the video data in the storage blocks of the corresponding level, and writes the storage information in the corresponding storage blocks of the video data into the index block, solving the problem in the related art that video data is stored in chronological order, resulting in a very short retention period for important video data, and achieving the management of different storage block types according to different retention periods, facilitating the management of storage blocks and balancing the longer retention period of high-value video data and the storage space.
[0085] It should be noted that the above-mentioned each module can be a functional module or a program module, and can be implemented either by software or by hardware. For the modules implemented by hardware, the above-mentioned each module can be located in the same processor; or the above-mentioned each module can also be located in different processors in any combination form.
[0086] In this embodiment, an electronic device is also provided, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
[0087] Optionally, the above-mentioned electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the above-mentioned processor, and the input / output device is connected to the above-mentioned processor.
[0088] Optionally, in this embodiment, the above-mentioned processor may be configured to perform the following steps by a computer program:
[0089] S1, divide the storage space into index blocks and multiple storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks;
[0090] S2, according to the corresponding relationship between the type of preset video data and the level of the storage block, store the video data in the storage block of the corresponding level, and write the storage information in the corresponding storage block of the video data into the index block; wherein, the types of video data include ordinary type, multi-level frame extraction type and multiple event types;
[0091] When the current video data is completely stored, perform frame extraction storage on the video data of the ordinary type.
[0092] It should be noted that specific examples in this embodiment may refer to the examples described in the above-mentioned embodiment and optional implementation manners, and will not be elaborated in this embodiment.
[0093] In addition, in combination with the storage method of a kind of video data provided in the above-mentioned embodiment, a storage medium may also be provided in this embodiment to implement. A computer program is stored on the storage medium; when the computer program is executed by a processor, the storage method of any kind of video data in the above-mentioned embodiment is implemented.
[0094] It should be understood that the specific embodiments described here are only used to explain this application, rather than to limit it. According to the embodiments provided by the present application, all other embodiments obtained by those of ordinary skill in the art without creative work belong to the protection scope of the present application.
[0095] Obviously, the accompanying drawings are only some examples or embodiments of the present application. For those of ordinary skill in the art, the present application can also be applied to other similar situations according to these drawings without creative work. In addition, it can be understood that although the work done during the development process here may be complex and time-consuming, for those of ordinary skill in the art, certain design, manufacturing or production changes based on the technical content disclosed in the present application are only conventional technical means and should not be regarded as insufficient disclosure of the present application.
[0096] As used in this application, the term "embodiment" means that the specific features, structures, or characteristics described in connection with an embodiment may be included in at least one embodiment of this application. The phrase appears in various places in the specification and does not necessarily mean the same embodiment, nor does it mean that it is independent or alternative to other embodiments and mutually exclusive. Those of ordinary skill in the art can clearly or implicitly understand that the embodiments described in this application can be combined with other embodiments without conflict.
[0097] The above-described embodiments merely represent several implementation manners of this application. Their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of patent protection. It should be noted that for those of ordinary skill in the art, without departing from the concept of this application, several modifications and improvements can still be made, and these all fall within the protection scope of this application. Therefore, the protection scope of this application shall be subject to the appended claims.
Claims
1. A method for storing video data, characterized in that, The method includes: Dividing the storage space into index blocks and multiple storage blocks according to preset conditions, and dividing the storage blocks into different levels according to the different retention periods of the storage blocks; According to the corresponding relationship between the type of the video data preset and the level of the storage block, storing the video data into the storage block of the corresponding level, and writing the storage location information corresponding to the video data in the storage block into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type and multiple event types; the storage block includes an index area and a data area, and the index area includes a secondary index area and an extended index area; the secondary index area records the data summary information of the current data area; the extended index area records the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area; When the current video data is completely stored, performing frame extraction storage on the video data of the ordinary type; The storing the video data into the storage block of the corresponding level according to the corresponding relationship between the type of the video data preset and the level of the storage block includes: In the case that the video data contains two types of video data at the same time, according to the type of the video data, storing the video data into the data areas of the storage blocks of the corresponding levels respectively, and at the same time, the secondary index areas of the storage blocks of the corresponding levels respectively record the data summary information of the current data area, and the extended index areas of the storage blocks of the corresponding levels record the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area.
2. The storage method of video data according to claim 1, wherein When the storage of the storage block corresponding to the current type of video data is completed, selecting the storage block with the lowest level and being idle for storage, and / or selecting an idle storage block for storage according to the retention time set by the user for the video data.
3. The storage method of video data according to claim 1, characterized in that The performing frame extraction storage on the video data of the ordinary type includes: Dividing the video data of the ordinary type into n equal parts, taking key frames at intervals for comparison and analysis, comparing whether the change of the key frames in two intervals reaches a threshold value. If so, further dividing the video data in the two key frame time periods into n1 equal parts until the change of the key frames in the two intervals does not reach the threshold value and / or the key frames in the two intervals reach the set interval time, storing the key frames into the data area of the corresponding storage block, and supplementing the content in the index area of the corresponding storage block, where n and n1 are natural numbers.
4. The storage method of video data according to claim 3, characterized in that The method further includes: After the frame extraction storage of the video data of the ordinary type is completed, releasing the storage block storing the video data of the ordinary type.
5. The storage method of video data according to claim 3, wherein The method further includes: After the frame extraction storage of the video data of the ordinary type is completed, performing multi-level frame extraction storage on the frame extraction stored video data.
6. A storage system for video data, characterized in that, The storage system includes: A front-end management device, a switch, a network camera and a client storage device; The front-end management device is connected to the network camera through the switch and receives the video data collected by the network camera; When the front-end management device accesses the client storage device for the first time, it divides the storage space of the client storage device into an index block and multiple storage blocks according to preset conditions. According to the different retention periods of the storage blocks, the storage blocks are divided into different levels. According to the corresponding relationship between the type of the preset video data and the level of the storage block, the video data is stored in the storage block of the corresponding level, and the storage location information of the video data corresponding to the storage block is written into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type and multiple event types; the storage block includes an index area and a data area, and the index area includes a secondary index area and an extended index area; the secondary index area records the data summary information of the current data area; the extended index area records the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area; When the current video data is stored, frame extraction storage is performed on the video data of the ordinary type The step of storing the video data in the storage block of the corresponding level according to the corresponding relationship between the type of the preset video data and the level of the storage block includes: When the video data contains two types of video data at the same time, according to the type of the video data, the video data is respectively stored in the data areas of the storage blocks of the corresponding levels. At the same time, the secondary index areas of the storage blocks of the corresponding levels respectively record the data summary information of the current data area, and the extended index areas of the storage blocks of the corresponding levels record the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area.
7. A storage device for video data, characterized in that, The device includes: A division module, configured to divide the storage space into an index block and multiple storage blocks according to preset conditions, and divide the storage blocks into different levels according to the different retention periods of the storage blocks; A storage module, configured to store the video data in the storage block of the corresponding level according to the corresponding relationship between the type of the preset video data and the level of the storage block, and write the storage location information of the video data corresponding to the storage block into the index block; wherein, the types of the video data include ordinary type, multi-level frame extraction type and multiple event types; when the current video data is stored, frame extraction storage is performed on the video data of the ordinary type; the storage block includes an index area and a data area, and the index area includes a secondary index area and an extended index area; the secondary index area records the data summary information of the current data area; the extended index area records the storage location indication relationship established in chronological order for the data stored in other data areas and the current data area; The storage module is specifically configured to, when the video data contains two types of video data at the same time, according to the type of the video data, store the video data into the data areas of the storage blocks of corresponding levels respectively, and at the same time, the secondary index areas of the storage blocks of corresponding levels respectively record the data summary information of the current data area, and the extended index areas of the storage blocks of corresponding levels record the storage position indication relationships established in chronological order for the data stored in other data areas and the current data area.
8. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to run the computer program to execute the video data storage method according to any one of claims 1 to 5.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, the steps of the video data storage method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Video data storage method and device, and terminal device
CN110100243A
Multimedia data storage method, apparatus, device, storage medium, and program product
CN113711619A
Video storage method and device based on key event identification, equipment and medium
CN114139015A