Video index management method, device and equipment

By dividing the index file of the video data into multiple sub-index files, the problem of video information being unable to be read due to index file exceptions is solved, and the stability and reliability of video query, playback and download are improved.

CN120296199APending Publication Date: 2025-07-11TP-LINK
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510400929.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-31
Publication Date
2025-07-11

AI Technical Summary

Technical Problem

In the prior art, as the index file increases, the risk of abnormal video index file increases, resulting in the system being unable to read the video information correctly, affecting the normal use of query, playback and download functions.

Method used

The index file of the video data is divided into multiple video sub-index files. Each sub-index file contains video partition information and video event index information. These sub-index files are indexed to reduce the probability of abnormality and improve the stability of reading.

Benefits of technology

By dividing the index file into multiple sub-index files, the negative impact caused by exceptions is reduced, and the reliability of recording query, playback and download is ensured. Even if individual sub-index files are abnormal, it will not affect the management of other recording data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120296199A_ABST
    Figure CN120296199A_ABST
Patent Text Reader

Abstract

The invention relates to the field of data storage, in particular to a video index management method, device and equipment. The method comprises the following steps: acquiring video recording event information of to-be-managed video recording data; a video sub-index file corresponding to the video event information is determined, the video sub-index file comprises video partition information and video event index information, and an index file corresponding to the video data comprises more than two video sub-index files; and performing index management on the to-be-managed video event information according to the video partition information and the video event index information of the video sub-index file. Because the video sub-index file is smaller than the index file, the probability of content abnormity can be reduced, the stability and reliability of index reading are improved, and even if an individual video sub-index file is abnormal, the management of other video sub-index files on the video data is not influenced, so that the video data management efficiency is improved. The validity and reliability of data reading according to the video sub-index file can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data storage, and in particular to an indexing management method, apparatus, and device for video recording. Background Art

[0002] IPC (Internet Protocol Camera in English, Network Camera in Chinese) supports a variety of detection functions, and these detection functions can trigger different video recording events. When a video recording event triggers video recording, the system not only saves the video data and audio data of the video recording, but also records the relevant information of the video recording, including the ID, type, start and end times of the event, and the index information associated with the video and audio data, etc. These relevant information can be used for subsequent video recording query, playback, and download.

[0003] Normally, the relevant information of these video recordings is stored in a dedicated index file. However, with the increase in the capacity of the SD card, the number of video recording files that can be stored also increases, and the index file needs to record more relevant information, resulting in the continuous growth of the size of the index file. As the index file grows, the risk of anomalies occurring during read and write operations on it also increases. If the data in the index file is abnormal, it may cause the system to be unable to correctly read the index information of the video recording, which will affect the normal use of the video recording query, playback, and download functions. Summary of the Invention

[0004] In view of this, embodiments of this application provide an indexing management method, apparatus, and device for video recording data to solve the problem in the prior art that when the index file increases, anomalies may occur, resulting in the system being unable to correctly read the index information of the video recording.

[0005] The first aspect of the embodiments of this application provides an indexing management method for video recording data, and the method includes:

[0006] Obtain the video recording event information of the video recording data to be managed;

[0007] Determine the video recording sub-index file corresponding to the video recording event information, where the video recording sub-index file includes video recording partition information and video recording event index information, and the index file corresponding to the video recording data includes two or more of the video recording sub-index files;

[0008] Perform indexing management on the video recording event information according to the video recording partition information and video recording event index information of the video recording sub-index file.

[0009] In combination with the first aspect, in the first possible implementation manner of the first aspect, the video recording event information includes the video recording event information to be stored, and the video recording event information to be stored includes a video recording event index ID;

[0010] Determine the video sub-index file corresponding to the video event information, including:

[0011] Determine the video sub-index file ID to which the video event index ID belongs according to the video event index ID and the number of video event indexes included in each pre-determined video sub-index file, and determine the video sub-index file corresponding to the video event information according to the video sub-index file ID.

[0012] Combined with the first possible implementation manner of the first aspect, in the second possible implementation manner of the first aspect, perform index management on the video event information according to the video partition information and video event index information of the video sub-index file, including:

[0013] Open the corresponding video sub-index file according to the video sub-index file ID;

[0014] Determine the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the video partition information and video event index information of the video sub-index file;

[0015] Write the video event index at the starting position of the video sub-index file.

[0016] Combined with the second possible implementation manner of the first aspect, in the third possible implementation manner of the first aspect, determine the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the video partition information and video event index information of the video sub-index file, including:

[0017] Determine the first video event index ID in the video sub-index file according to the video event index information;

[0018] Determine the first quantity of the video event indexes written in the video sub-index file according to the video event index ID to be stored and the first video event index ID;

[0019] Determine the length of a single video event index according to the video partition information, and determine the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the first quantity and the length of a single video event index.

[0020] Combined with the first aspect, in the fourth possible implementation manner of the first aspect, the video event information includes the video event information to be read, and the video event information to be read includes the start and end time ranges of the video event;

[0021] Determine the video sub-index file corresponding to the video event information, including:

[0022] Traverse the video data file according to the start and end time ranges of the video event to be read, and determine the video data file ID related to the start and end time ranges;

[0023] According to the video data file ID, combined with the number of video data files corresponding to each video sub-index file determined in advance, determine the video sub-index file ID related to the start and end time ranges, and determine the video sub-index file corresponding to the start and end time ranges according to the video sub-index file ID.

[0024] Combined with the fourth possible implementation manner of the first aspect, in the fifth possible implementation manner of the first aspect, according to the video partition information and video event index information of the video sub-index file, perform index management on the video event information, including:

[0025] Open the corresponding video sub-index file according to the video sub-index file ID;

[0026] Determine the position of each video event index in the opened video sub-index file according to the video partition information;

[0027] According to the position of the video event index, combine the video event index information to obtain the time range of the video event corresponding to the video event index;

[0028] Filter the video event indexes according to the time range of the video event and the start and end time ranges of the video event to be read, and determine the video data to be read according to the filtered video event indexes and the video event index information.

[0029] Combined with the fifth possible implementation manner of the first aspect, in the sixth possible implementation manner of the first aspect, determine the position of each video event index in the opened video sub-index file according to the video partition information, including:

[0030] Determine the first video event index ID in the opened video sub-index file according to the video partition information;

[0031] Determine the ID difference between the video event index ID to be located in the opened video sub-index file and the first video event index ID;

[0032] Determine the position of the video event index ID to be located in the video sub-index file according to the ID difference and the length of a single video event.

[0033] The second aspect of the embodiments of the present application provides an index management device for video data, and the device includes:

[0034] A video event information acquisition unit, configured to acquire video event information of the video data to be managed;

[0035] A video sub-index file determination unit, configured to determine a video sub-index file corresponding to the video event information, where the video sub-index file includes video partition information and video event index information, and the index file corresponding to the video data includes two or more of the video sub-index files;

[0036] An index management unit, configured to perform index management on the video event information according to the video partition information and video event index information of the video sub-index file.

[0037] A third aspect of the embodiments of the present application provides an index management device for video data, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the index management device for video data implements the method according to any one of the first aspects.

[0038] A fourth aspect of the embodiments of the present application provides a computer program product, which, when running on a computer, causes the computer to execute the method according to the first aspect or its various implementation manners.

[0039] A fifth aspect of the embodiments of the present application provides a computer-readable storage medium, where the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of the first aspects are implemented.

[0040] A sixth aspect of the embodiments of the present application provides a chip, configured to implement the methods according to the various implementation manners in the first aspect. Specifically, the chip includes: a processor, configured to call and run a computer program from a memory, so that a device installed with the chip executes the method according to the first aspect or its various implementation manners.

[0041] The beneficial effects of the embodiments of the present application compared with the prior art are as follows: By dividing the index file corresponding to the video recording data into two or more video recording sub-index files, determining the video recording sub-index file corresponding to the video event information to be managed, and each video recording sub-index file includes video recording partition information and video event index information. Therefore, when indexing and managing the video event information to be managed through the video recording partition information and video event index information of the video recording sub-index file, since the video recording sub-index file is smaller than the index file, the probability of content abnormality can be reduced, the stability and reliability of index reading can be improved, and even if there is an abnormality in an individual video recording sub-index file, it will not affect the management of video recording data by other video recording sub-index files, and the effectiveness and reliability of data reading according to the video recording sub-index file can be effectively improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings in the following descriptions are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0043] Figure 1 is a schematic flowchart of the implementation of an index management method for video recording data provided by an embodiment of the present application;

[0044] Figure 2 is a schematic diagram of an index file without divided video recording sub-index files provided by an embodiment of the present application;

[0045] Figure 3 is a schematic flowchart of the implementation of determining a video recording sub-index file provided by an embodiment of the present application;

[0046] Figure 4 is a schematic diagram of a video recording sub-index file provided by an embodiment of the present application;

[0047] Figure 5 is a schematic flowchart of the process of writing a video event index provided by an embodiment of the present application;

[0048] Figure 6 is a schematic flowchart of the process of reading a video event index provided by an embodiment of the present application;

[0049] Figure 7 is a schematic diagram of an index management device for video recording data provided by an embodiment of the present application;

[0050] Figure 8 is a schematic diagram of an index management device for video recording data provided by an embodiment of the present application. Detailed implementation manners

[0051] In the following description, for the purpose of illustration rather than limitation, specific details such as specific system architectures, technologies, etc. are presented to provide a thorough understanding of the embodiments of the present application. However, those skilled in the art should clearly understand that the present application can also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid unnecessary details from interfering with the description of the present application.

[0052] To illustrate the technical solutions described in the present application, the following will be described through specific embodiments.

[0053] The following introduces the relevant concepts related to the embodiments of the present application.

[0054] IPC (Internet Protocol Camera) has multiple detection functions, and these functions can trigger different video recording events. Once a video recording event is triggered, the system will not only save video and audio data, but also record detailed information related to the video recording. This information includes the ID, type, start and end times of the event, as well as index information related to the video and audio data, etc. This relevant information facilitates subsequent video recording query, playback, and download operations.

[0055] Normally, relevant information is saved through an independent index file. However, as the SD capacity expands, the number of video recording files saved on the SD card gradually increases, and the index information of the video recording events saved in the index file also gradually increases. The length of the index file increases, and the probability of file content anomalies caused by read and write operations on the index file also increases. Once the index file content is abnormal, it is very likely that the index information of the video recording events on the entire SD card cannot be read normally, resulting in the inability to query, download, and playback the video recording normally.

[0056] To solve the problem of index file anomalies, an index file for backup can be newly added. When the content of the original index file is abnormal, the backup index file is used to read the index information. Since the backup index file has the same length as the original index file and is updated simultaneously when the content of the original index file is updated, there is also a risk of file content anomalies caused by the same read and write operations as the original index file.

[0057] Based on this, the embodiments of the present application propose an index management method for video recording data. Figure 1 As a schematic flowchart of an implementation of this method, this method includes:

[0058] In S101, obtain the video recording event information of the video recording data to be managed.

[0059] In the embodiments of the present application, the video events to be managed can be those to be stored or read. The video event information to be managed can include the video event information to be stored or the video event information to be read.

[0060] The video event information includes the video event index ID or the video event ID, or includes information such as the start and end time range of the video event.

[0061] When the video event information to be managed includes the video event information to be stored, it is necessary to determine the position of the video event index of the video event to be stored in the video sub-index file in the embodiments of the present application according to the video event information to be stored, and write the video event index at this position to complete the writing of the video event index in the video sub-index file.

[0062] When the video event information to be managed includes the video event information to be read, it is necessary to determine the video event file where the video event to be read is located according to the start and end time of the video event information to be read included in the video event information to be read. According to the corresponding relationship between the video event file and the video sub-index file, determine the video sub-index file where the video event index to be read is located, and determine the position of the video event index to be read in the video sub-index file, and read the required video event index, so as to read the corresponding video event.

[0063] In S102, determine the video sub-index file corresponding to the video event information.

[0064] Among them, the video sub-index file in the embodiments of the present application includes video partition information and video event index information, and the index file corresponding to the video data includes more than two video sub-index files.

[0065] Among them, the video partition information in the embodiments of the present application can include common information such as the length of the video data file and the number of video data files. The length of the video data file is the total length or size of all video data files, and each video data file can correspond to a video partition. The length of the video data file helps to understand the storage space occupied by each partition, which is convenient for storage management and optimization.

[0066] The number of video data files represents the total number of video data files when the video data is stored, for example, when it is stored in an SD card.

[0067] The video event index information includes multiple video event indexes. Each video event index corresponds to a specific video event and records the detailed information related to the index of that video event. Each video event index includes the ID of the video event, the type of the video event, the start and end times of the video event, the ID of the video data file corresponding to the video event, and the index information related to the audio and video data of the video event, etc.

[0068] Among them, the ID of the video event is automatically generated when the video event is triggered. For example, in ascending order of numerical values, the IDs of video events with unique identifiers are generated in sequence.

[0069] The type of the video event is used to identify the trigger type of the video event. For example, it can include motion detection type, sound detection type, alarm trigger type, etc., so as to classify and retrieve video events according to the event type.

[0070] The start and end times of the video event are used to record the start time and end time of the triggered video event. According to the start time and end time of the video event, it is convenient to determine the video event located within this start and end time according to the read start and end times.

[0071] The ID of the video data file corresponding to the video event is determined when the video event is stored. Generally, a video event is stored in only one video data file and corresponds to the unique ID of the video data file.

[0072] The index information related to the audio and video data of the video event can include the video event index related to the audio and video data, and the length of the video event index, etc.

[0073] The length of the video data file is usually a preset fixed value. Each video data file corresponds to a group of video event indexes. The number of this group of video event indexes represents the maximum number of video events that can be saved in this video data file. The maximum number of video event indexes corresponding to a single video data file can be expressed as:

[0074]

[0075] Among them, C 录像事件 represents the maximum number of video events included in a single video data file, that is, the maximum number of video event indexes corresponding to the video events included in a single video data file, L 录像数据文件 represents the length of the video data included in a single video data file, L 录像事件 represents the preset length of the video data corresponding to a single video event, and S represents the magnification factor for allowing more video events to be saved.

[0076] For example, L 录像数据文件 can take a value of 256 MB, L录像事件 M can take the value of 1MB, S can take the value of 3, and then C is calculated 录像事件 is 768, indicating that the maximum number of video event indexes corresponding to a single video data file is 768.

[0077] After deducting the capacity for storing other SD card information from the SD card that stores the audio - video data of video events, the remaining capacity can be used to store video data files and video event indexes. When determining the number of video data files that can be stored in the SD card, the length of a video file unit (including a single video data file and the video event index corresponding to the single video data file) can be determined first, and then based on the ratio of the remaining space of the SD card to the length of the video file unit, the number of video file units that can be stored in the remaining capacity of the SD card can be determined. The calculation method can include:

[0078] L 录像文件单位 = L 录像数据文件 + L 录像事件索引 * C 录像事件 ;

[0079]

[0080] Among them, L 录像文件单位 represents the estimated total length of a single video file unit (including a single video data file and the video event index corresponding to the video data file), C 录像事件 represents the number of video events included in a single video data file, L 录像事件索引 represents the length of a single video event index. A single video file unit includes a single video data file and the video event index corresponding to the single video data file, that is, a single video file unit includes L 录像数据文件 and L 录像事件索引 * C 录像事件 two parts. L 录像数据文件 represents the length of a single video data file; the product of L 录像事件索引 and C 录像事件 represents the total length of the video event indexes corresponding to a single video file. C 录像数据文件 represents the number of video data files that can be stored in the SD card, L SD卡剩余容量 represents the remaining capacity of the SD card, represents the floor calculation.

[0081] Based on the length of a single video event index, the number of video events included in the video data file, and the number of video data files included in the SD card, the length of all video event indexes in the SD card can be determined. As Figure 2 shown, the total length of the index file in the SD card can be determined according to the length of all video event index information in the SD card and the length of the video partition information. The calculation process can be expressed as:

[0082] L 所有录像事件索引 = L 录像事件索引 * C 录像事件 * C 录像数据文件

[0083] L 录像索引文件 = L 录像分区信息 + L 所有录像事件索引

[0084] Among them, L 录像索引文件 represents the total length of the video index files in the SD card, and L 录像分区信息 represents the length of the video partition information, and this length is a fixed value. L 所有录像事件索引 represents the length of all video event indexes in the SD card, and C 录像事件 represents the number of video events included in a single video data file, and C 录像数据文件 represents the number of video data files that the SD card can store.

[0085] Before the index file is divided into video sub-index files, as Figure 2 shown, the index file first saves the video partition information, and then saves the video event indexes corresponding to each video data file in sequence according to the video data file ID (that is, the ID of the video data file, and a single video data file includes the video data corresponding to multiple video events). For example Figure 2 each video data file in it corresponds to i + 1 video event indexes, that is, each video data file includes i + 1 video event segments (such as video event index 0 to video event index i, and video event index j * (i + 1) to video event index j * (i + 1)+i in the figure, corresponding to video data file 0 and video data file j respectively), and each video event segment corresponds to a video event index.

[0086] The embodiment of the present application divides the index file and creates several video sub-index files corresponding to the video event information. The creation process can be as Figure 3 shown, including:

[0087] In S301, according to the number of video data files corresponding to the index file to be divided, and the preset number of video sub-index files, determine the number of video data files corresponding to each of the video sub-index files.

[0088] Among them, the number of video sub-index files can be preset. For example, it can be set to 3-10 video sub-index files. The number of video data files in the SD card can be determined according to the remaining available space of the SD card.

[0089] Determining the number of video data files corresponding to each video sub-index file can be expressed as:

[0090]

[0091] where C 等分的录像数据文件 represents the number of video data files corresponding to each video sub-index file, and C 录像子索引文件 represents the preset number of video sub-index files, which can be preset to 5 for example, and C 等分的录像事件索引 represents the maximum number of video event indexes included in each video sub-index file, and C 录像事件 represents the number of video events included in a single video data file, and C 录像数据文件 represents the number of video data files that the SD card can store, represents rounding down.

[0092] In S302, according to the number of video data files corresponding to each video sub-index file and the number of video events included in each video data file, determine the number of video event indexes included in each video sub-index file, and according to the number of video event indexes included and the partition information before partitioning, determine the video sub-index file corresponding to the video event information.

[0093] After determining the number of video sub-index files, video sub-index files can be created in sequence. The structure of each video sub-index file is the same as that of the index file. First, save the video partition information with the same content, and then, according to the determined range of video data files and video event indexes, save the video event indexes in each video data file in sequence in combination with the video data file ID until the number of video event indexes in the video sub-index file reaches C 等分的录像事件索引 . After saving is full, that is, when reaching C 等分的录像事件索引 , create a new video sub-index file to continue saving. The structure of the created video sub-index file can be as Figure 4 shown. According to Figure 2 the schematic diagram of the video sub-index file after partitioning of the index file shown, assuming that video data file 0, video data file j, and video data file k are the first video data file IDs saved by the video sub-index file after partitioning, according to the partitioning result, the number of video data files corresponding to the video event indexes saved by each video sub-index file is j, and the number of video event indexes corresponding to each video data file is i + 1, that is, the number of video event indexes saved by each video sub-index file is j*(i + 1).

[0094] In the embodiment of the present application, when partitioning the video event indexes, the last video sub-index file will save the remaining video data files later, and according to the video data file ID, save the video event indexes corresponding to each video data file in sequence.

[0095] Such asFigure 4 As shown, each video sub-index file is sorted according to the creation order. Each video sub-index file has the same video partition information, and the video event indexes in each video sub-index file are continuous, that is, the video event index IDs in each video sub-index file are the same as those in the case of using a single index file, and there is no re-numbering of the video event index IDs, that is, there is no re-numbering starting from 0 after switching to different video sub-index files. For example Figure 4 As shown, video sub-index file 0 includes video partition information and j*(i + 1) video event indexes, and the video event index IDs are 0 to j*(i + 1) - 1 respectively, corresponding to j video data files. Video sub-index file 1 includes video partition information and (k - j)*(i + 1) video event indexes, and the video event index IDs are j*(i + 1) to k*(i + 1) - 1 respectively, corresponding to k - j video data files.

[0096] In the embodiment of the present application, when the video event information to be managed is video event information to be stored, it can be used to store newly triggered video event information into the SD card, including storing the video data file into the video data file and storing the video event index into the video index file.

[0097] When a new detection event triggers video recording, a new video event index will be allocated to save the relevant index information of this video event, and during the duration of the video event, it will be periodically (such as every 2 minutes) written into the SD card. When the video event ends, or when it is necessary to switch to a new video data file, the update of a video event index will be ended.

[0098] When the currently used video data file is full, or when it is necessary to switch to a new video data file for other reasons. At this time, all video event indexes that are still being updated in the current video data file can be forcibly ended, written into the SD card, and new video event indexes are allocated for the video events that are still ongoing.

[0099] When determining the video sub-index file corresponding to the video event information, the video event index ID included in the video event information can be compared with the number of video event indexes included in each video sub-index file to determine the video sub-index file ID to which the video event index ID belongs, and the video sub-index file corresponding to the video event information can be determined according to this video sub-index file ID.

[0100] For example, the determination of the video sub-index file ID can be expressed as:

[0101]

[0102] Where ID 录像子索引文件Indicates the video sub-index file number, i.e., which video sub-index file, ID 录像事件索引 Indicates the ID of the video event index, C 等分的录像事件索引 Indicates the number of video data files included in each video sub-index file.

[0103] After determining the video event index ID in the video sub-index file ID, it is necessary to further determine the position of the video event index in the video sub-index file, including the start position, etc.

[0104] Based on the video partition information and video event index information of the video sub-index file, the start position of the video event index corresponding to the video event index ID in the video sub-index file can be determined, and the video event index can be written according to this start position.

[0105] Among them, when determining the start position of the video event index corresponding to the video event index ID in the video sub-index file based on the video partition information and video event index information of the video sub-index file, the first video event index ID in the video sub-index file can be determined according to the video event index information, and then according to the difference between the video event index ID to be stored and the first video event index ID in the video sub-index file, the first quantity of the video event indexes included before writing the video event index ID to be stored in this video sub-index file can be determined. According to the partition information, the length of a single video event index can be determined. Based on the first quantity and the length of a single video event index, the offset length backward from the first position in this video sub-index file can be determined, and the start position of the video event index ID to be stored can be determined according to this start position and the offset length.

[0106] The calculation method can be expressed as:

[0107] O 录像事件索引 =(ID 录像事件索引 -ID 首个录像事件索引 )*L 录像事件索引

[0108] Among them, O 录像事件索引 Indicates the start position of the video event index to be stored in the video sub-index file, ID 首个录像事件索引 Indicates the ID of the first video event index in the video sub-index file, L 录像事件索引 Indicates the length of a single video event index.

[0109] Write the video event index to be stored according to the determined start position of the video event index to be stored in the video sub-index file, so that the video event index is updated in the video sub-index file.

[0110] When the video event information to be managed includes the video event information to be read, the required video event index can be read from the video sub-index file according to the video event information, so as to read the audio-visual data of the corresponding video event from the video data file.

[0111] After a video capture device such as a network camera is started, it will first traverse all the video sub-index files in the SD card. According to the start and end times of the video events saved in the video event index and the video data file ID, the start and end times of the video data file are recorded and updated. That is, the start time of the video data file is the minimum start time of the video events included in the video data file, and the end time of the video data file is the maximum end time of the video events included in the video data file. Finally, the start and end time ranges of all video data files, as well as the corresponding video event index ID ranges, can be obtained.

[0112] When performing IPC query, playback, or download to read video events, the video data files can be traversed according to the video partition information in combination with the start and end time ranges to filter the matching video data files. Then, the corresponding video sub-index file can be determined according to the video data file ID. The video event index is obtained from the corresponding video sub-index file, and the video event index ID to be read is filtered by querying the video event index in the corresponding video sub-index file within the start and end time ranges. The video event is read according to the filtered video event index ID.

[0113] In S103, the video event information is index-managed according to the video partition information and video event index information of the video sub-index file.

[0114] After determining the video sub-index file corresponding to the video event index in the video event information for the index file to be divided in the embodiments of the present application, multiple video sub-index files can be created, and each video event index is divided into each video sub-index file.

[0115] For the video event information to be stored, the starting position of the video event index corresponding to the video event index ID in the video sub-index file can be determined according to the video partition information and video event index information of the video sub-index file, and the video event index is written according to this starting position.

[0116] For the video event information to be read, the matching video data files can be filtered according to the query start and end time ranges, and then the corresponding video sub-index file can be determined according to the video data file ID. For example, the calculation method for determining the video sub-index file ID according to the video data file ID can be:

[0117]

[0118] Among them, ID 录像数据文件 represents the ID of the video data file, ID 录像子索引文件 represents the ID of the video sub-index file, C 等分的录像数据文件 represents the number of corresponding video data files in each video sub-index file, represents rounding up.

[0119] After determining the ID of the video sub-index file, when searching for the required video event index from the video sub-index file, the video sub-index file can be opened according to the ID of the video sub-index file. Based on the video partition information and video event index information, the video event indexes in the video sub-index file are traversed and filtered to determine the video event indexes related to the start and end time ranges of the video event to be read, and the video data file is read based on the filtered relevant video event indexes.

[0120] For example, after determining the ID of the video sub-index file, the currently opened video sub-index file ID can be compared with the determined video sub-index file ID to determine whether they are the same. If they are different, the currently opened video sub-index file is closed, and the video sub-index file is opened according to the determined video sub-index file ID.

[0121] After opening the video sub-index file, since there are multiple video event indexes in the video sub-index file, it is necessary to determine the position of each video event index according to the partition information, so as to correctly read the information of the video event index.

[0122] In the embodiments of the present application, the position of each video event index in the video sub-index file can be obtained according to the length of a single video event index, combined with the serial number or ID offset of the video event index in the video sub-index file. Based on the determined position of the video event index, the information of the video event index is read to obtain the time range of the video data corresponding to the video event index. The time range corresponding to each video event index in the determined video sub-index file is compared with the queried start and end time ranges. If the two have a common time range, it means that the video event index matches the query requirement (start and end time ranges). One or more video event indexes that meet the requirements are obtained through screening. Combining the video event index information, the video data that matches the start and end time requirements can be read.

[0123] For example, the position of the video event index in the video sub-index file can be expressed as:

[0124] O 录像事件索引 =(ID 录像事件索引 -ID 首个录像事件索引 )*L 录像事件索引 ,

[0125] where O 录像事件索引Indicates the starting position of the video event index in the video sub-index file, ID 首个录像事件索引 Indicates the ID of the first video event index in the video sub-index file, which can be determined through video partition information. ID 录像事件索引 Indicates the ID of the read video event index.

[0126] Among them, ID 录像事件索引 - ID 首个录像事件索引 Indicates the ID difference between any video event index to be located in the opened video sub-index file and the ID of the first video event index, that is, the sequence number of the video event index in this video sub-index file, or it can also be called the ID offset of the video event index in this video sub-index file. Based on the ID offset and the length of a single video event, the position of this video event index in the video sub-index file can be determined.

[0127] For example, the start and end time range of the video event to be read is from 18:10:10 on October 10, 2024 to 20:10:10 on October 10, 2024. Based on this start and end time range, traverse and match in the video data, that is, compare the start and end time ranges of each video data file with the read start and end time range to determine whether the two intersect, that is, whether there is an intersecting time range. If so, determine that this video data file meets the matching requirements. If there is no intersecting time range, it does not meet the matching requirements. Through the matching of time ranges, the video data files that meet the requirements are video data file 18, video data file 19, video data file 20, and video data file 21.

[0128] Based on the ID of the matched video data file and combined with the number of video data files corresponding to the index of each video sub-index file, the ID of the video sub-index file corresponding to the ID of the matched video data file can be determined. Assume that the video data file ID starts from 0 and the video sub-index file ID starts from 0, and each video event index of the video sub-index file corresponds to 4 video data files. Then it can be calculated respectively: (18 + 1) / 4 = 4.75; (19 + 1) / 4 = 5; (20 + 1) / 4 = 5.25; (21 + 1) / 4 = 5.5. By rounding up, it can be determined that the video event indexes of video data file 18 and video data file 19 correspond to the video sub-index file 4, and the video event index of video data file 21 corresponds to the video sub-index file 5.

[0129] Based on the determined video event sub-index file, determine the positions of the video event indexes in the video event sub-index file one by one. Determine the video event index information through the positions of the video event indexes, including the start and end time ranges of the video event. Compare the determined start and end time ranges of the video event with the start and end time ranges that need to be read. If there is an intersecting time range between the two, it means that the video event index meets the reading requirements. By traversing the video event indexes in the associated video sub-index file, determine all the video event indexes related to the reading requirements. The corresponding video data can be read through the determined video event indexes.

[0130] To illustrate the storage process of the video event index in detail, as Figure 5 shown, an embodiment of the present application provides a schematic diagram of the storage process of the video event index, which is described in detail as follows:

[0131] In S501, determine the video sub-index file to be written.

[0132] The video sub-index file to which the video event index to be written belongs can be determined according to the ID of the video event index to be written and in combination with the number of video event indexes included in each pre-determined video sub-index file. For example, if the ID of the video event index to be written is 125 and the number of video event indexes included in each video sub-index file is 100, then the ID of the video sub-index file is 1, corresponding to the second video sub-index file.

[0133] In S502, determine whether the video sub-index file to be written has been opened.

[0134] If the video sub-index file to be written has been opened, execute S503. If it has not been opened, execute S504 to open the video sub-index file.

[0135] In S503, determine the starting position of the video event index to be written in the video sub-index file.

[0136] The first video event index ID in the video sub-index file to be written can be determined according to the video partition information and the video event index information. In combination with the ID of the video event index to be written, the first quantity of the video event indexes already written in the video sub-index file can be determined. According to the first quantity and the length of a single video event index, determine the starting position of the video event index to be written in the video sub-index file.

[0137] In S505, write the video event index in the video sub-index file.

[0138] In S506, close the video sub-index file.

[0139] After writing the video event index into the video sub-index file, the sub-index file can be closed to end the writing process of the current video event index.

[0140] Figure 6 The following is a schematic diagram of the reading process of a video event index provided by an embodiment of the present application:

[0141] In S601, the corresponding video data file IDs are filtered according to the start and end time ranges of the video event index to be read.

[0142] The start and end time ranges of the video data file can be determined according to the video event index information in the video data file. According to the start and end time ranges of the video event index to be read and the start and end time ranges of each video data file, the video data file IDs that can be filtered can be determined.

[0143] In S602, the video sub-index file ID is found according to the filtered video data file ID.

[0144] Since the video sub-index file ID and the video data file ID are both encoded in sequence, therefore, according to the number of video data files included in the video sub-index file, combined with each video data file ID, the video sub-index file ID to which the video data file belongs can be determined.

[0145] In S603, it is compared whether the video sub-index file IDs are the same.

[0146] That is, it is compared whether the currently opened video sub-index file ID is the same as the found video sub-index file ID. If they are different, then S604 is executed to close the current video sub-index file and open the video sub-index file corresponding to the filtered video sub-index file ID. If they are the same, then S605 is executed to, according to the video to be stored

[0147] In S605, the starting position of the video event index ID to be read in the video sub-index file is determined.

[0148] According to the start time corresponding to the video event index ID to be read, combined with the start time of the first video event index in the video sub-index file and the length of each video event index, the starting position corresponding to the video event index ID to be read can be determined.

[0149] In S606, the video event index is read according to this starting position.

[0150] In S607, it is judged whether it meets the query start and end time ranges. If it does not meet, then S608 is executed to discard the read video event index. If it meets, then S609 is executed to save the queried video event index.

[0151] In S610, it is determined whether the video event index IDs in the currently opened video sub-index file have been traversed.

[0152] If the video event index IDs in the currently opened video sub-index file have been traversed, then S611 is executed to determine whether the video data file IDs that have been filtered out have been traversed. If the video event index IDs in the currently opened video sub-index file have not been traversed, then return to execute S605.

[0153] If the filtered video sub-index file IDs have been traversed, then S612 is executed to close the video sub-index file and return the query result, or further provide playback or download based on the query result for the video data segment. If the filtered video sub-index file IDs have not been traversed, then return to execute S602.

[0154] During the reading process, if the reading of one of the video sub-index files is abnormal, the reading process of this video sub-index file can be skipped, and then continue to traverse the video data file IDs, skipping the corresponding problematic video sub-index file ID until the next video sub-index file is found, and then continue to process according to the original process. This is equivalent to only losing the video data segments corresponding to the video event information saved by the video event indexes in the abnormal video sub-index file, and the video data segments corresponding to the video event information saved by the video event indexes in other video sub-index files are not affected, and the query, playback, or download processing can continue to be executed.

[0155] In summary, the embodiments of the present application have the following technical effects:

[0156] 1. By dividing a single index file with a large length into several video sub-index files with smaller lengths, the video event indexes are dispersed into multiple video sub-index files. Compared with a single index file, it can avoid the problem that the content of the index file of the entire SD card cannot be read normally, which in turn leads to the inability to query, playback, and download videos normally.

[0157] 2. Since the length of the video sub-index file is small, the number of video event indexes lost due to abnormal file content of the video sub-index file is small, that is, the videos that cannot be queried, played back, and downloaded normally are also small, which can effectively further reduce the negative impact when an abnormality occurs.

[0158] 3. Each video sub-index file stores the video partition information, and the video partition information can be conveniently read from any video sub-index file, avoiding the situation where the video partition information cannot be read due to abnormal content of a single index file.

[0159] It should be understood that the sequence numbers of the steps in the above embodiments do not imply the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.

[0160] Figure 7 The figure is a schematic diagram of an index management device for video data provided by an embodiment of the present application. The device includes:

[0161] A video event information acquisition unit 701, configured to acquire video event information of the video data to be managed;

[0162] A video sub-index file determination unit 702, configured to determine a video sub-index file corresponding to the video event information. The video sub-index file includes video partition information and video event index information, and the index file corresponding to the video data includes two or more of the video sub-index files;

[0163] An index management unit 703, configured to perform index management on the video event information according to the video partition information and video event index information of the video sub-index file.

[0164] Figure 7 The shown index management device for video data corresponds to Figure 1 The shown index management method for video data.

[0165] Figure 8 It is a schematic diagram of an index management device for video data provided by an embodiment of the present application. As Figure 8 shown, the index management device 8 for video data in this embodiment includes: a processor 80, a memory 81, and a computer program 82 stored in the memory 81 and executable on the processor 80, such as an index management program for video data. When the processor 80 executes the computer program 82, the steps in the above embodiments of the index management method for each video data are implemented. Alternatively, when the processor 80 executes the computer program 82, the functions of each module / unit in the above device embodiments are implemented.

[0166] Exemplarily, the computer program 82 can be divided into one or more modules / units. The one or more modules / units are stored in the memory 81 and executed by the processor 80 to complete the present application. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, and these instruction segments are used to describe the execution process of the computer program 82 in the index management device 8 for video data.

[0167] The index management device 8 for the video data may be a computing device such as a desktop computer, a notebook, a personal digital assistant, and a video server. The index management device for the video data may include, but is not limited to, a processor 80 and a memory 81. Those skilled in the art can understand that Figure 8 This is only an example of the index management device 8 for the video data and does not constitute a limitation on the index management device 8 for the video data. It may include more or fewer components than those shown in the figure, or combine certain components, or different components. For example, the index management device for the video data may further include an input / output device, a network access device, a bus, etc.

[0168] The so-called processor 80 may be a central processing unit (CPU), or may also be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0169] The memory 81 may be an internal storage unit of the index management device 8 for the video data, such as a hard disk or a memory of the index management device 8 for the video data. The memory 81 may also be an external storage device of the index management device 8 for the video data, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the index management device 8 for the video data. Further, the memory 81 may also include both an internal storage unit and an external storage device of the index management device 8 for the video data. The memory 81 is used to store the computer program and other programs and data required by the index management device for the video data. The memory 81 may also be used to temporarily store the data that has been output or will be output.

[0170] Those skilled in the art can clearly understand that, for the convenience and conciseness of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiments can be integrated into a processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit. In addition, the specific names of each functional unit and module are only for the convenience of mutual distinction and do not limit the protection scope of this application. The specific working processes of the units and modules in the above system can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated here.

[0171] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For parts not detailed or recorded in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0172] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, or by a combination of computer software and electronic hardware. Whether these functions are executed in the form of hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.

[0173] In the embodiments provided in this application, it should be understood that the disclosed device / terminal device and method can be implemented in other ways. For example, the device / terminal device embodiments described above are only illustrative. For example, the division of the modules or units is only a logical function division. In actual implementation, there can be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection can be through some interfaces. The indirect coupling or communication connection of the device or unit can be in an electrical, mechanical or other form.

[0174] The unit described as a separated component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it can be located in one place, or can be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0175] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, can exist physically alone for each unit, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.

[0176] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, all or part of the processes in the above-described embodiment methods of the present application can also be completed by hardware related to computer program instructions. The computer program can be stored in a computer-readable storage medium. When the computer program is executed by a processor, the steps of the above various method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in the form of source code, object code, executable file, or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.

[0177] In addition, the embodiments of the present application also provide a computer program product, which when running on a computer, causes the computer to execute the methods in the above various implementation manners.

[0178] The above-described embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the various embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. An indexing management method for video data, characterized in that The method includes: Obtaining video event information of the video data to be managed; Determining a video sub-index file corresponding to the video event information, where the video sub-index file includes video partition information and video event index information, and the index file corresponding to the video data includes two or more of the video sub-index files; Performing index management on the video event information according to the video partition information and video event index information of the video sub-index file.

2. The method according to claim 1, wherein The video event information includes video event information to be stored, and the video event information to be stored includes a video event index ID; Determining the video sub-index file corresponding to the video event information includes: Determining the ID of the video sub-index file to which the video event index ID belongs according to the video event index ID and the number of video event indexes included in each predetermined video sub-index file, and determining the video sub-index file corresponding to the video event information according to the video sub-index file ID.

3. The method according to claim 2, wherein Performing index management on the video event information according to the video partition information and video event index information of the video sub-index file includes: Opening the corresponding video sub-index file according to the video sub-index file ID; Determining the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the video partition information and video event index information of the video sub-index file; Writing the video event index at the starting position of the video sub-index file.

4. The method according to claim 3, wherein Determining the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the video partition information and video event index information of the video sub-index file includes: Determining the first video event index ID in the video sub-index file according to the video event index information; Determining the first quantity of the video event indexes written in the video sub-index file according to the video event index ID to be stored and the first video event index ID; Determining the length of a single video event index according to the video partition information, and determining the starting position of the video event index corresponding to the video event index ID in the video sub-index file according to the first quantity and the length of a single video event index.

5. The method according to claim 1, wherein The video event information includes video event information to be read, and the video event information to be read includes the start and end time ranges of the video event; Determining the video sub-index file corresponding to the video event information includes: Traversing the video data file according to the start and end time ranges of the video event to be read, and determining the video data file ID related to the start and end time ranges; Determining the video sub-index file ID related to the start and end time ranges according to the video data file ID and the number of video data files corresponding to each predetermined video sub-index file, and determining the video sub-index file corresponding to the start and end time ranges according to the video sub-index file ID.

6. The method according to claim 5, wherein Performing index management on the video event information according to the video partition information and video event index information of the video sub-index file includes: Open the corresponding video sub-index file according to the video sub-index file ID; Determine the position of each video event index in the opened video sub-index file according to the video partition information; Obtain the time range of the video event corresponding to the video event index according to the position of the video event index and in combination with the video event index information; Filter the video event indexes according to the time range of the video event and the start and end time ranges of the video event to be read, and determine the video data to be read according to the filtered video event indexes and in combination with the video event index information.

7. The method according to claim 6, characterized in that, Determine the position of each video event index in the opened video sub-index file according to the video partition information, including: Determine the first video event index ID in the opened video sub-index file according to the video partition information; Determine the ID difference between the ID of the video event index to be located in the opened video sub-index file and the first video event index ID; Determine the position of the ID of the video event index to be located in the video sub-index file according to the ID difference and the length of a single video event.

8. The method according to claim 1, characterized in that, The video event information includes the index file to be partitioned; Determine the video sub-index file corresponding to the video event information, including: Determine the number of video data files corresponding to each video sub-index file according to the number of video data files corresponding to the index file to be partitioned and the preset number of video sub-index files; Determine the number of video event indexes included in each video sub-index file according to the number of video data files corresponding to each video sub-index file and the number of video events included in each video data file, and determine the video sub-index file corresponding to the video event information according to the number of video event indexes included and the partition information before partitioning.

9. An indexing management device for video data, characterized in that, The device includes: A video event information acquisition unit, configured to acquire the video event information of the video data to be managed; A video sub-index file determination unit, configured to determine the video sub-index file corresponding to the video event information, where the video sub-index file includes video partition information and video event index information, and the index file corresponding to the video data includes two or more of the video sub-index files; An index management unit, configured to perform index management on the video event information according to the video partition information and the video event index information of the video sub-index file.

10. An index management device for video data, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the index management device of the video data implements the method according to any one of claims 1-7.