A video data storage, video playback method, device and equipment thereof
By splicing the structured data and protection parameters of the video data and storing them on the data disk, the existing technology problems of low video data storage and playback processing performance and high database index disk space usage are solved, and efficient video data storage is achieved. and playback, reducing costs and improving data security.
Patent Information
- Application Number
- CN202410841297.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-26
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-06-26
AI Technical Summary
In the process of video data storage and playback in the existing technology, due to the large number of parameter types corresponding to the video data, multiple IO operations are required in the database, and the processing performance is poor. In addition, the index disk space of the database is high and the cost is high. And the video data cannot be recovered after the database is damaged.
By splicing structured data and protection parameters, the spliced index data is obtained and stored in the data disk, instead of storing the structured data and protection parameters in the database separately, which reduces the IO operations of the database and stores the index data Store to mechanical hard drive to reduce costs.
It improves the storage and playback processing performance of video data, reduces the occupation of database index disk space and construction costs, improves data security, and avoids the loss of video data caused by database damage.
Smart Images

Figure CN118410203B
Abstract
Description
Technical Field
[0001] The present application relates to the field of data storage, and in particular to a method, device and equipment for storing and replaying video data. Background Art
[0002] The storage device can obtain video data from front-end devices (such as IPC (Internet Protocol Camera, network camera) and analog cameras) and store the video data. In addition to storing video data, the parameters corresponding to the video data need to be stored in the database. In this way, during the video data playback process, the parameters corresponding to the video data can be read from the database and the video data can be played back based on the parameters.
[0003] However, since there are many types of parameters corresponding to video data, multiple types of parameters need to be stored in the database and multiple types of parameters need to be read from the database. Obviously, the storage and reading process of these parameters requires multiple IO operations on the database, and the processing performance is poor. Summary of the invention
[0004] The present application provides a method for storing video data, the method comprising:
[0005] Acquire a video sequence, wherein the video sequence includes a plurality of video frames;
[0006] Performing frame analysis on the video sequence to obtain structured data;
[0007] Acquire protection parameters corresponding to the video sequence, and concatenate the structured data and the protection parameters to obtain concatenated index data, wherein the protection parameters are used to protect the video sequence; wherein the index data is used to parse the index data during video playback to obtain the structured data and the protection parameters, acquire the video sequence based on the structured data, and use the protection parameters to perform a protection operation on the acquired video sequence;
[0008] The index data is stored.
[0009] The present application provides a video playback method, the method comprising:
[0010] Get video playback request from the client;
[0011] Obtaining index data, and parsing the index data to obtain structured data and protection parameters;
[0012] A video sequence corresponding to the video playback request is obtained based on the structured data, a protection operation is performed on the video sequence using the protection parameter, and the video sequence after the protection operation is returned to the client.
[0013] The present application provides a video data storage device, the device comprising:
[0014] An acquisition module, used for acquiring a video sequence, wherein the video sequence includes a plurality of video frames;
[0015] A processing module, configured to perform frame analysis on the video sequence to obtain structured data; obtain protection parameters corresponding to the video sequence, and splice the structured data and the protection parameters to obtain spliced index data, wherein the protection parameters are used to protect the video sequence; wherein the index data is used to parse the index data during video playback to obtain the structured data and the protection parameters, obtain the video sequence based on the structured data, and use the protection parameters to perform a protection operation on the obtained video sequence;
[0016] A storage module is used to store the index data.
[0017] The present application provides a video playback device, the device comprising:
[0018] The acquisition module is used to obtain a video playback request from the client;
[0019] A processing module, configured to obtain index data, parse the index data to obtain structured data and protection parameters; obtain a video sequence corresponding to the video playback request based on the structured data, and perform a protection operation on the video sequence using the protection parameters;
[0020] The sending module is used to return the video sequence after the protection operation to the client.
[0021] The present application provides an electronic device, comprising: a processor and a machine-readable storage medium, wherein the machine-readable storage medium stores machine-executable instructions that can be executed by the processor; the processor is used to execute the machine-executable instructions to implement the video data storage method of the above-mentioned example of the present application; or, the processor is used to execute the machine-executable instructions to implement the video playback method of the above-mentioned example of the present application.
[0022] The present application provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the method for storing video data of the above-mentioned example of the present application is implemented; or, the method for replaying the video of the above-mentioned example of the present application is implemented.
[0023] The present application provides a computer program product, including a computer program. When the computer program is executed by a processor, it implements the video data storage method of the above example of the present application; or, when the computer program is executed by a processor, it implements the video playback method of the above example of the present application.
[0024] It can be seen from the above technical solution that in the embodiment of the present application, by splicing the structured data and the protection parameters to obtain the spliced index data and storing the index data, instead of storing the structured data and the protection parameters separately in the database, a large number of database IO operations can be reduced and processing performance can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1A It is a flowchart of a method for storing video data in one embodiment of the present application;
[0026] Figure 1B It is a flowchart of a video playback method in one embodiment of the present application;
[0027] Figure 2 It is a flowchart of a method for storing video data in one embodiment of the present application;
[0028] Figure 3 is a schematic diagram of a method for storing video data in one embodiment of the present application;
[0029] Figure 4 is a schematic diagram of a method for reading video data in one embodiment of the present application;
[0030] Figure 5 is a schematic diagram of a method for storing video data in one embodiment of the present application;
[0031] Figure 6 is a schematic diagram of a method for reading video data in one embodiment of the present application;
[0032] Fig. 7A is a schematic diagram of the structure of a storage device for video data in one embodiment of the present application;
[0033] Figure 7B is a schematic structural diagram of a video playback device in one embodiment of the present application;
[0034] Figure 8 It is a hardware structure diagram of an electronic device in one embodiment of the present application. DETAILED DESCRIPTION
[0035] In the embodiment of the present application, a method for storing video data is proposed, which can be applied to electronic devices, such as storage devices, etc. Figure 1A FIG. 4 is a flow chart of the method, which may include:
[0036] Step 101: Acquire a video sequence, where the video sequence includes multiple video frames.
[0037] Step 102: Analyze the video sequence frames to obtain structured data. The structured data may include but is not limited to: the start time of the video sequence, the end time of the video sequence, and the offset address of the video sequence, and the offset address indicates the storage location corresponding to the video sequence in the data disk.
[0038] Step 103: Obtain protection parameters corresponding to the video sequence, splice the structured data and the protection parameters to obtain spliced index data, and the protection parameters are used to protect the video sequence. The index data is used to parse the index data during video playback to obtain structured data and protection parameters, obtain the video sequence based on the structured data, and use the protection parameters to perform protection operations on the obtained video sequence.
[0039] Step 104: Store the index data. For example, store the index data in a data disk.
[0040] Exemplarily, the protection parameter is a parameter related to the video sequence, which is used to protect the video sequence, and the protection parameter is a parameter that needs to be stored. There is no limitation on the protection parameter, as long as it is a parameter related to the video sequence that needs to be stored. For example, the protection parameter may include but is not limited to encryption key information (such as an encryption key or a unique identifier of an encryption key) and / or an integrity signature value. Of course, the encryption key information and the integrity signature value are just two examples, and the protection parameter may also include other parameters.
[0041] Exemplarily, the protection parameter may include encryption key information, and the encryption key information may include an encryption key or a unique identifier of the encryption key, the encryption key is used to encrypt the video sequence to obtain an encrypted video sequence. The method further includes: storing the encrypted video sequence.
[0042] For example, after obtaining the video sequence, an encryption key is obtained, the video sequence is encrypted using the encryption key to obtain an encrypted video sequence, and the encrypted video sequence is stored in a data disk.
[0043] After obtaining the encryption key, the encryption key itself can be determined as the encryption key information, or the unique identifier of the encryption key can be determined as the encryption key information. Further, when the encryption key information is used as the unique identifier of the encryption key, then: if the mapping relationship between the unique identifier of the encryption key and the encryption key is not currently stored, the mapping relationship between the unique identifier of the encryption key and the encryption key can be stored on the data disk. If the mapping relationship between the unique identifier of the encryption key and the encryption key is currently stored, the mapping relationship between the unique identifier of the encryption key and the encryption key is no longer stored on the data disk.
[0044] If the protection parameter includes encryption key information, when the structured data and the encryption key information are concatenated, the structured data is preceded by the first identifier, and the encryption key information is preceded by the second identifier.
[0045] For example, after the index data is obtained by splicing, the index data includes the first identifier, structured data, the second identifier and encryption key information in sequence. Based on this, after the first identifier and the second identifier are parsed from the index data, the content between the first identifier and the second identifier is determined as structured data, and the content after the second identifier is determined as encryption key information.
[0046] Alternatively, after the index data is obtained by concatenation, the index data includes the second identifier, the encryption key information, the first identifier and the structured data in sequence. Based on this, after the second identifier and the first identifier are parsed from the index data, the content between the second identifier and the first identifier is determined as the encryption key information, and the content after the first identifier is determined as the structured data.
[0047] Exemplarily, the protection parameters may include an integrity signature value; obtaining the protection parameters corresponding to the video sequence may include, but is not limited to: after obtaining the encrypted video sequence (the video sequence is encrypted using an encryption key to obtain the encrypted video sequence), calculating the integrity signature value corresponding to the encrypted video sequence.
[0048] If the protection parameters include an integrity signature value, when the structured data, encryption key information and integrity signature value are concatenated, the structured data may be preceded by a first identifier, the encryption key information may be preceded by a second identifier, and the integrity signature value may be preceded by a third identifier.
[0049] The positional relationship among structured data, encryption key information, and integrity signature value is not limited in this embodiment, and the positional relationship among structured data, encryption key information, and integrity signature value can be arbitrarily configured. For example, structured data can be located before encryption key information, and encryption key information can also be located before structured data. Structured data can be located before integrity signature value, and integrity signature value can also be located before structured data. Encryption key information can be located before integrity signature value, and integrity signature value can also be located before encryption key information.
[0050] For example, after the index data is obtained by concatenation, the index data includes the first identifier, structured data, the second identifier, encryption key information, the third identifier and the integrity signature value in sequence. Based on this, after the first identifier, the second identifier and the third identifier are parsed from the index data, the content between the first identifier and the second identifier is determined as the structured data, the content between the second identifier and the third identifier is determined as the encryption key information, and the content after the third identifier is determined as the integrity signature value.
[0051] Alternatively, after the index data is obtained by concatenation, the index data includes the second identifier, encryption key information, the first identifier, structured data, the third identifier and the integrity signature value in sequence. Based on this, after the second identifier, the first identifier and the third identifier are parsed from the index data, the content between the second identifier and the first identifier is determined as the encryption key information, the content between the first identifier and the third identifier is determined as the structured data, and the content after the third identifier is determined as the integrity signature value.
[0052] Of course, the above are just two examples, and there is no limitation on this positional relationship.
[0053] In a preferred embodiment, after the structured data, the encryption key information and the integrity signature value are concatenated to obtain the index data, the index data includes the first identifier, the structured data, the third identifier, the integrity signature value, the second identifier and the encryption key information in sequence. Based on this, after the first identifier, the third identifier and the second identifier are parsed from the index data, the content between the first identifier and the third identifier is determined as the structured data, the content between the third identifier and the second identifier is determined as the integrity signature value, and the content after the second identifier is determined as the encryption key information.
[0054] Exemplarily, storing index data (such as storing index data on a data disk) may include, but is not limited to: obtaining the data security corresponding to the video sequence; wherein the data security may be a high-security storage requirement, a medium-security storage requirement, or a low-security storage requirement; generating N copies of index data based on the index data, where N may be a positive integer greater than 1. Based on this, if the data security is a high-security storage requirement, the N copies of index data may be stored in the data disks of N storage nodes respectively; or, if the data security is a medium-security storage requirement, the N copies of index data may be stored in the N data disks of a storage node respectively; or, if the data security is a low-security storage requirement, the N copies of index data may be stored in the N data partitions of a data disk of a storage node respectively.
[0055] Exemplarily, when the index data is stored in a data disk, the data disk includes but is not limited to a mechanical hard disk (Hard Disk Drive, HDD). When the encrypted video sequence is stored in a data disk, the data disk includes but is not limited to a mechanical hard disk or a solid state disk (SSD). When the unique identifier of the encryption key and the encryption key are stored in the data disk, the data disk includes but is not limited to a mechanical hard disk.
[0056] It can be seen from the above technical solutions that in the embodiment of the present application, protection parameters are used to protect the video sequence, and the protected video sequence is stored in the data disk. In this way, even if the attacker obtains the stored video sequence from the storage device, the video sequence cannot be decrypted, thereby avoiding the leakage of private information or sensitive information and improving data security. By splicing the structured data and the protection parameters to obtain the spliced index data, and storing the index data in the data disk, instead of storing the structured data and the protection parameters separately in the database, a large number of database IO operations can be reduced and processing performance can be improved. By storing the index data in the data disk, there is no need to occupy the additional index disk space of the database (the index disk space of the database occupies the space of the solid-state hard disk). Obviously, the data disk occupies the space of the mechanical hard disk, and the cost of the mechanical hard disk is greatly reduced relative to the cost of the solid-state hard disk.
[0057] In the embodiment of the present application, a video playback method is proposed, which can be applied to electronic devices, such as storage devices, etc. Figure 1B FIG. 4 is a flow chart of the video playback method, which may include:
[0058] Step 111: Obtain a video playback request from the client.
[0059] Step 112: Obtain index data (such as obtaining the index data from a data disk), and parse the index data to obtain structured data and protection parameters.
[0060] Step 113: obtaining a video sequence corresponding to the video playback request based on the structured data, performing a protection operation on the video sequence using the protection parameter, and returning the video sequence after the protection operation to the client.
[0061] Exemplarily, obtaining a video sequence (such as an encrypted video sequence) corresponding to a video playback request based on the structured data may include, but is not limited to: determining a first time interval based on a start time and an end time in the structured data, and determining a second time interval based on a playback start time and a playback end time in the video playback request; if there is overlapping time between the first time interval and the second time interval, then based on an offset address in the structured data, obtaining the encrypted video sequence corresponding to the offset address from a data disk.
[0062] Exemplarily, the protection parameter may include encryption key information, and the encryption key information includes the encryption key or the unique identifier of the encryption key. Based on this, the protection operation of the video sequence using the protection parameter may include but is not limited to: if the video sequence is an encrypted video sequence, the encryption key corresponding to the encryption key information is used to decrypt the encrypted video sequence to obtain a decrypted video sequence.
[0063] Before using the encryption key corresponding to the encryption key information to decrypt the encrypted video sequence, the encryption key corresponding to the encryption key information can also be obtained. For example, if the encryption key information is a unique identifier of the encryption key, the encryption key corresponding to the unique identifier is obtained from the data disk; if the encryption key information is the encryption key itself, the encryption key information is used as the encryption key.
[0064] If the protection parameter includes encryption key information, when the index data is parsed to obtain structured data and encryption key information, when the first identifier is parsed from the index data, the content after the first identifier can be determined as structured data; when the second identifier is parsed from the index data, the content after the second identifier can be determined as encryption key information. For example, if the index data includes the first identifier, structured data, the second identifier, and encryption key information in sequence, the content between the first identifier and the second identifier is determined as structured data, and the content after the second identifier is determined as encryption key information.
[0065] Exemplarily, the protection parameters may include an integrity signature value, based on which the protection parameters are used to perform protection operations on the video sequence, which may include but are not limited to: using the integrity signature value to perform an integrity check on the encrypted video sequence; if the integrity check is successful, then performing an operation of decrypting the encrypted video sequence using the encryption key corresponding to the encryption key information to obtain a decrypted video sequence; if the integrity check fails, then the encrypted video sequence may be discarded and no longer decrypted.
[0066] If the protection parameters include an integrity signature value, when the index data is parsed to obtain structured data, encryption key information and an integrity signature value, when a first identifier is parsed from the index data, the content following the first identifier can be determined as structured data; when a second identifier is parsed from the index data, the content following the second identifier can be determined as encryption key information; when a third identifier is parsed from the index data, the content following the third identifier can be determined as the integrity signature value.
[0067] For example, if the index data includes a first identifier, structured data, a third identifier, an integrity signature value, a second identifier and encryption key information in sequence, the content between the first identifier and the third identifier is determined as structured data, the content between the third identifier and the second identifier is determined as the integrity signature value, and the content after the second identifier is determined as encryption key information.
[0068] It can be seen from the above technical solutions that in the embodiment of the present application, protection parameters are used to protect the video sequence, and the protected video sequence is stored in the data disk. In this way, even if the attacker obtains the stored video sequence from the storage device, the video sequence cannot be decrypted, thereby avoiding the leakage of private information or sensitive information and improving data security. By splicing the structured data and the protection parameters to obtain the spliced index data, and storing the index data in the data disk, instead of storing the structured data and the protection parameters separately in the database, a large number of database IO operations can be reduced and processing performance can be improved. By storing the index data in the data disk, there is no need to occupy the additional index disk space of the database (the index disk space of the database occupies the space of the solid-state hard disk). Obviously, the data disk occupies the space of the mechanical hard disk, and the cost of the mechanical hard disk is greatly reduced relative to the cost of the solid-state hard disk.
[0069] In the embodiment of the present application, a method for storing video data is proposed, which can be applied to electronic devices, such as storage devices, etc. Figure 2 FIG. 4 is a flow chart of the method, which may include:
[0070] Step 201: Acquire a video sequence, where the video sequence includes multiple video frames.
[0071] Step 202: Frame analysis is performed on the video sequence to obtain structured data, wherein the structured data may include but is not limited to: the start time of the video sequence, the end time of the video sequence, and the offset address of the video sequence, and the offset address indicates the storage location corresponding to the video sequence in the data disk.
[0072] Step 203: Obtain an encryption key, use the encryption key to encrypt the video sequence to obtain an encrypted video sequence, and store the encrypted video sequence in a second data disk.
[0073] Step 204: Calculate the integrity signature value corresponding to the encrypted video sequence.
[0074] Step 205: Obtain encryption key information. For example, the encryption key may be determined as the encryption key information, or the unique identifier of the encryption key may be determined as the encryption key information.
[0075] Step 206: Concatenate the encryption key information, the structured data, and the integrity signature value to obtain concatenated index data, and store the index data in the first data disk.
[0076] Exemplarily, when the encryption key information is a unique identifier of an encryption key, if the mapping relationship between the unique identifier of the encryption key and the encryption key is not stored, the mapping relationship between the unique identifier of the encryption key and the encryption key is stored in the third data disk. If the mapping relationship between the unique identifier of the encryption key and the encryption key is stored, the mapping relationship between the unique identifier of the encryption key and the encryption key is not stored in the third data disk.
[0077] Exemplarily, after the encryption key information, the structured data and the integrity signature value are concatenated to obtain the concatenated index data, the index data may include the first identifier, the structured data, the third identifier, the integrity signature value, the second identifier and the encryption key information in sequence. After the first identifier, the third identifier and the second identifier are parsed from the index data, the content between the first identifier and the third identifier may be determined as the structured data, the content between the third identifier and the second identifier may be determined as the integrity signature value, and the content after the second identifier may be determined as the encryption key information.
[0078] Of course, the above is only an example of the positional relationship among the encryption key information, structured data, and integrity signature value. The encryption key information may also be located in front of the structured data, the encryption key information may also be located in front of the integrity signature value, and the integrity signature value may also be located in front of the structured data. There is no restriction on this. As long as the first identifier is located in front of the structured data, the third identifier is located in front of the integrity signature value, and the second identifier is located in front of the encryption key information, there is no restriction on this positional relationship.
[0079] Based on the above-mentioned video data storage method, a video playback method is also proposed in an embodiment of the present application. The video playback method may include: obtaining a video playback request from a client, obtaining index data from a first data disk (such as obtaining multiple index data from the first data disk), and parsing the index data to obtain structured data, integrity signature value and encryption key information.
[0080] For each index data, if the start time and end time in the structured data of the index data do not match the time information in the video playback request, continue to traverse the next index data until all index data are traversed, or, find the index data that matches the time information in the video playback request. If the start time and end time in the structured data of the index data match the time information in the video playback request, then based on the offset address in the structured data, obtain the encrypted video sequence corresponding to the offset address from the second data disk, and continue to traverse the next index data until all index data are traversed, or, find all index data that match the time information in the video playback request.
[0081] For example, the first time interval can be determined based on the start time and the end time in the structured data, and the second time interval can be determined based on the playback start time and the playback end time in the video playback request. If the first time interval and the second time interval have overlapping time, the structured data matches the video playback request, otherwise, if there is no overlapping time, the structured data does not match the video playback request.
[0082] After obtaining the encrypted video sequence corresponding to the offset address from the second data disk, the integrity signature value in the index data can be used to perform an integrity check on the encrypted video sequence. If the integrity check fails, the encrypted video sequence can be discarded. If the integrity check succeeds, the encryption key corresponding to the encryption key information in the index data can be obtained, and the encryption key can be used to decrypt the encrypted video sequence to obtain an unencrypted video sequence. If the encryption key information is a unique identifier of the encryption key, the encryption key corresponding to the unique identifier can be obtained from the third data disk; if the encryption key information is the encryption key itself, the encryption key information can be used as the encryption key.
[0083] It can be seen from the above technical solution that in the embodiment of the present application, by splicing the encryption key information, structured data and integrity signature value to obtain the spliced index data, the index data is stored in the first data disk, instead of storing the encryption key information, structured data and integrity signature value in the database separately, it is possible to reduce a large number of database IO operations and improve processing performance. By storing the index data in the first data disk, there is no need to occupy the additional index disk space of the database (the space of the solid-state hard disk), the first data disk occupies the space of the mechanical hard disk, and the cost of the mechanical hard disk is lower than that of the solid-state hard disk.
[0084] The technical solution of the embodiment of the present application is described below in conjunction with specific application scenarios.
[0085] In one possible implementation, see Figure 3FIG. 1 is a schematic diagram of a method for storing video data. The method can be applied to a storage device. The method can include the following steps:
[0086] Step 1: The storage device obtains the video stream from the front-end device (such as IPC). For example, after the front-end device is connected to the storage device, the video access module of the storage device can obtain the video stream from the front-end device.
[0087] Step 2: The storage device generates a video sequence based on the video stream, where the video sequence includes multiple video frames.
[0088] Exemplarily, the video sequence may be a GOP (Group Of Picture) sequence or other video frame sets, which is not limited. A GOP sequence is taken as an example. A GOP sequence represents a video frame set within a short period of time. For example, assuming that the frame rate is 25 and the I frame interval is 50, a GOP sequence represents a video frame set of 2 seconds, and the GOP sequence may include 50 video frames.
[0089] After obtaining the video stream (i.e., streaming video data), the storage device can reorganize the video stream to obtain a GOP sequence, where the GOP sequence includes a group of video frames between two adjacent I frames, i.e., the first frame of the GOP sequence is an I frame, and the GOP sequence includes all P frames following the I frame.
[0090] Step 3: The storage device performs frame analysis on the video sequence to obtain structured data. The structured data is used to locate (retrieve) the video sequence during video playback. The process will be described in the subsequent embodiments.
[0091] Exemplarily, the structured data may include the start time of the video sequence, the end time of the video sequence, and the offset address of the video sequence. Of course, in addition to the above information, the structured data may also include I frame size, GOP size, GOP sequence number, etc., and there is no limitation on this structured data.
[0092] Step 4: The storage device calls an encryption card (such as a hardware encryption card), obtains an encryption key through the encryption card, and uses the encryption key to encrypt the video sequence to obtain an encrypted video sequence.
[0093] Exemplarily, the video sequence is video plaintext data, and the encryption card can use the encryption key to encrypt the video sequence to obtain an encrypted video sequence, and the encrypted video sequence is video ciphertext data. When the encryption key is used to encrypt the video sequence, a symmetric encryption algorithm (such as SM4 algorithm, etc.) can be used to encrypt the video sequence, and other algorithms can also be used to encrypt the video sequence, and there is no restriction on this.
[0094] Exemplarily, when the encryption card obtains the encryption key, it can periodically update the encryption key. For example, for the video sequence from 0 to 2, encryption key a1 can be used, for the video sequence from 2 to 4, encryption key a2 can be used, for the video sequence from 4 to 6, encryption key a3 can be used, and so on.
[0095] Step 5: The storage device calculates the integrity signature value corresponding to the encrypted video sequence.
[0096] Exemplarily, an integrity protection algorithm can be used to calculate the integrity signature value corresponding to the encrypted video sequence. If the integrity protection algorithm is a hash algorithm (such as SM3 algorithm, etc.), a hash operation can be performed on the encrypted video sequence, and the hash operation result is used as the integrity signature value corresponding to the encrypted video sequence.
[0097] For example, the storage device calls an encryption card (such as a hardware encryption card), and performs a hash operation on the encrypted video sequence through the encryption card to obtain an integrity signature value corresponding to the encrypted video sequence.
[0098] Step 6: The storage device stores the structured data in the database.
[0099] Step 7: The storage device stores the encryption key in the database.
[0100] Exemplarily, the encryption key is stored in the database each time the encryption key is updated, and when the encryption key is not updated, the encryption key does not need to be stored in the database. For example, when the encryption key is updated to encryption key a1, encryption key a1 is stored in the database, and encryption key a1 corresponds to 0-2, indicating that all video sequences at 0-2 correspond to encryption key a1. When the encryption key is updated to encryption key a2, encryption key a2 is stored in the database, and so on.
[0101] Step 8: The storage device stores the integrity signature value in the database.
[0102] Step 9: The storage device stores the encrypted video sequence in a data disk.
[0103] Exemplarily, when storing the encrypted video sequence in the data disk, the storage location corresponding to the encrypted video sequence in the data disk (i.e., the offset address of the video sequence) can be determined first, and the above structured data will also include the offset address of the video sequence. On this basis, based on the offset address of the video sequence, the encrypted video sequence can be stored in the data disk at a location corresponding to the offset address.
[0104] The offset address may include a start address and a data length, or the offset address may include a start address and an end address, and there is no limitation to this, as long as it can indicate the storage location of the video sequence.
[0105] In one possible implementation, see Figure 4 FIG. 1 is a schematic diagram of a method for reading video data (i.e., video playback). The method can be applied to a storage device. The method may include:
[0106] Step 1: The storage device obtains a video playback request from the client. The video playback request may include an IPC identifier, a playback start time, and a playback end time, indicating that the video data collected by the IPC corresponding to the IPC identifier needs to be retrieved, and the video data between the playback start time and the playback end time needs to be retrieved.
[0107] For example, the video playback module of the storage device may obtain a video playback request from the client.
[0108] Step 2: The storage device queries the database for structured data corresponding to the video playback request.
[0109] For example, for each structured data in the database, the structured data includes the start time of the video sequence and the end time of the video sequence, and the time interval 1 (i.e., from the start time to the end time) corresponding to the structured data can be determined, and the time interval 2 (i.e., from the playback start time to the playback end time) corresponding to the video playback request can be determined. If time interval 1 and time interval 2 have overlapping time, then the structured data is the structured data corresponding to the video playback request. If time interval 1 and time interval 2 do not have overlapping time, then the structured data is not the structured data corresponding to the video playback request.
[0110] For example, if the video playback request includes IPC identifier 1, all structured data corresponding to IPC identifier 1 are queried from the database. For each structured data corresponding to IPC identifier 1, if the time interval corresponding to the structured data overlaps with time interval 2, the structured data is the structured data corresponding to the video playback request. If the time interval corresponding to the structured data does not overlap with time interval 2, the structured data is not the structured data corresponding to the video playback request.
[0111] For example, the structured data may also include an IPC identifier, indicating that the structured data corresponds to the video data collected by the IPC corresponding to the IPC identifier. Based on this, since the structured data includes the IPC identifier, all structured data corresponding to the IPC identifier 1 can be queried from the database.
[0112] Step 3: The storage device obtains the offset address (such as the starting address and data length) in the structured data.
[0113] For example, since the structured data includes an offset address, after obtaining the structured data corresponding to the video playback request, the offset address can be obtained from the structured data.
[0114] Step 4: The storage device obtains the encrypted video sequence corresponding to the offset address from the data disk.
[0115] Step 5: The storage device reads the integrity signature value of the encrypted video sequence from the database.
[0116] For example, when the storage device stores the integrity signature value in the database, the unique identifier of the video sequence (i.e., the data unique identifier, such as the GOP number, etc.) and the integrity signature value can be stored in the database together. When the storage device stores structured data in the database, the structured data can also include the unique identifier of the video sequence. In this way, after obtaining the structured data corresponding to the video playback request, based on the unique identifier in the structured data, the integrity signature value corresponding to the unique identifier can be read from the database.
[0117] Step 6: The storage device uses the integrity signature value to perform integrity verification on the encrypted video sequence.
[0118] For example, the storage device calculates the integrity signature value A corresponding to the encrypted video sequence. For example, if the integrity protection algorithm is used to calculate the integrity signature value A corresponding to the encrypted video sequence, and the integrity protection algorithm is a hash algorithm (such as the SM3 algorithm, etc.), the encrypted video sequence can be hashed, and the hash operation result is used as the integrity signature value A. For example, the storage device calls an encryption card (such as a hardware encryption card), and the encryption card performs a hash operation on the encrypted video sequence to obtain the integrity signature value A.
[0119] Assuming that the integrity signature value B is read from the database, if the integrity signature value A is the same as the integrity signature value B, the integrity check succeeds, indicating that the encrypted video sequence has not been tampered with and the encrypted video sequence is complete, and step 7 is executed at this time. If the integrity signature value A is different from the integrity signature value B, the integrity check fails, indicating that the encrypted video sequence has been tampered with, and step 7 is not executed at this time.
[0120] Step 7: The storage device reads the encryption key of the encrypted video sequence from the database.
[0121] For example, when the storage device stores the encryption key in the database, the time interval (such as 0-2 o'clock, 2-4 o'clock, etc.) and the encryption key can be stored in the database together. Based on this, after obtaining the structured data corresponding to the video playback request, based on the start time to the end time in the structured data, the time interval corresponding to the structured data can be determined (that is, the start time and the end time both belong to the time interval), so that the storage device can read the encryption key corresponding to the time interval from the database.
[0122] Step 8: The storage device uses the encryption key to decrypt the encrypted video sequence (ie, the video ciphertext data) to obtain an unencrypted video sequence (ie, the video plaintext data).
[0123] For example, the storage device calls an encryption card (such as a hardware encryption card), and the encryption card can use the encryption key to decrypt the encrypted video sequence to obtain an unencrypted video sequence. When the encryption key is used to decrypt the encrypted video sequence, a symmetric encryption algorithm (such as the SM4 algorithm, etc.) can be used to decrypt the encrypted video sequence, or other algorithms can be used to decrypt the encrypted video sequence.
[0124] After obtaining the unencrypted video sequence, the storage device may also return the video sequence to the client, and the client plays the video sequence, and no restriction is imposed on the processing process of the client.
[0125] In the above process, by encrypting and storing the video sequence, it can be ensured that private information or sensitive information will not be leaked after the video data is lost, thereby improving data security. By protecting the integrity of the video sequence, it is possible to detect whether the video sequence has been tampered with, further improving data security.
[0126] In the above process, for the storage process of video data, it is necessary to store structured data in the database, store encryption keys in the database, and store integrity signature values in the database. For the reading process of video data, it is necessary to read structured data from the database, read encryption keys from the database, and read integrity signature values from the database. The above operations will lead to the following problems:
[0127] 1: The database has a lot of read and write IO, which affects performance. When writing video data, the encryption key, integrity signature value, and structured data need to be stored in the database. When playing back video data, this information also needs to be read from the database. A lot of database IO will lead to software performance bottlenecks. For example, when the frequency of storage devices accessing the database increases, the overall performance of the software will be affected to a certain extent.
[0128] Taking 4 Mbps bitrate, 25 frame rate, 50 I-frame interval, and 1 hour of writing as an example, the frequency of writing to the database is as follows: the number of times structured data is written is 1 hour * 60 minutes * 60 seconds / 2 sec per GOP = 1800 times, and the number of times the integrity signature value is written is 4 Mbps * 1 hour * 60 minutes * 60 seconds / 2MB = 900 times.
[0129] 2: A large amount of database index disk space is required. Since the database index disk space is implemented based on solid-state drives, and the cost of solid-state drives is relatively high, the cost of a large amount of database index disk space is relatively high.
[0130] Each structured data includes: start time, end time, offset address, I frame size, GOP size, GOP sequence number, etc., which occupy about 56 bytes. Taking 4Mbps bit rate, frame rate of 25, I frame interval of 50, and writing for 1 hour as an example, the number of video sequences (GOP sequences) is 1 hour * 60 minutes * 60 seconds / 2 sec per GOP = 1800, and the space occupied is 1800 * 56 bytes = 100KB. The space occupied by an IPC in 1 day is 100KB * 24 hours, that is, the space occupied is about 2.5MB. Each integrity signature value is 96 bytes. Taking 4Mbps bit rate, frame rate of 25, I frame interval of 50, and writing for 1 hour as an example, the number of integrity signature values is 4Mbps * 1 hour * 60 minutes * 60 seconds / 2MB = 900, and the space occupied is 900 * 96 bytes = 86KB. The space occupied by an IPC in 1 day is 100KB * 24 hours, about 2MB.
[0131] Taking the example of a storage device connected to 500 IPCs, the storage period of video data is 30 days, and the storage device needs to add an additional database space of 500 * 30 days * (2MB + 2.5MB), which is about 67GB.
[0132] 3: Video data cannot be restored after the database is damaged. If the database is damaged, the encryption key, integrity signature value, and structured data will be lost. Obviously, after the encryption key is lost, the video data cannot be decrypted and the video data cannot be viewed. After the integrity signature value is lost, the data integrity protection function will fail. After the structured data is lost, the video data cannot be located and played back.
[0133] In one possible implementation, see Figure 5 FIG. 1 is a schematic diagram of a method for storing video data. The method can be applied to a storage device. The storage device can be a cloud storage device or other storage device. There is no limitation on the type of the storage device. The method can include:
[0134] Step 1: The storage device obtains the video stream from the front-end device (such as IPC). For example, after the front-end device is connected to the storage device, the video access module of the storage device can obtain the video stream from the front-end device.
[0135] Step 2: The storage device generates a video sequence based on the video stream, where the video sequence includes multiple video frames.
[0136] Exemplarily, the video sequence may be a GOP sequence or other video frame set, and the GOP sequence represents a video frame set within a short period of time. After obtaining the video stream, the storage device may reorganize the video stream to obtain a GOP sequence, and the GOP sequence includes a group of video frames between two adjacent I frames.
[0137] Step 3: The storage device performs frame analysis on the video sequence to obtain structured data, where the structured data may include the start time of the video sequence, the end time of the video sequence, and the offset address of the video sequence.
[0138] Step 4: The storage device obtains an encryption key, and uses the encryption key to encrypt the video sequence to obtain an encrypted video sequence. For example, the storage device calls an encryption card (such as a hardware encryption card), obtains an encryption key through the encryption card, and uses the encryption key to encrypt the video sequence to obtain an encrypted video sequence.
[0139] Exemplarily, when the encryption card obtains the encryption key, it can periodically update the encryption key. For example, for the video sequence from 0 to 2, encryption key a1 can be used, for the video sequence from 2 to 4, encryption key a2 can be used, for the video sequence from 4 to 6, encryption key a3 can be used, and so on.
[0140] Step 5: The storage device calculates the integrity signature value corresponding to the encrypted video sequence. For example, the storage device calls an encryption card (such as a hardware encryption card), performs a hash operation on the encrypted video sequence through the encryption card, and obtains the integrity signature value corresponding to the encrypted video sequence (i.e., the hash operation result).
[0141] Step 6: The storage device concatenates the encryption key information, the structured data, and the integrity signature value to obtain concatenated index data (index), which is the concatenated data structure.
[0142] Exemplarily, the encryption key can be used as encryption key information. In this case, even if all video sequences within a certain time interval (such as 0-2 hours) use the same encryption key, then for each video sequence, the encryption key used by the video sequence can be spliced into the index data.
[0143] Exemplarily, the unique identifier of the encryption key can be used as encryption key information. In this case, when all video sequences within a certain time interval (such as 0-2 hours) use the same encryption key, then for each video sequence, only the unique identifier of the encryption key can be spliced into the index data.
[0144] In addition, in order to find the encryption key corresponding to the unique identifier, the mapping relationship between the unique identifier of the encryption key and the encryption key may be stored in a third data disk, and the third data disk may be a mechanical hard disk.
[0145] For example, for the first video sequence in the time interval, the mapping relationship between the unique identifier of the encryption key and the encryption key has not been stored, so the mapping relationship between the unique identifier of the encryption key and the encryption key is stored in the third data disk. For non-first video sequences in the time interval, the mapping relationship between the unique identifier of the encryption key and the encryption key has been stored, and it is no longer necessary to store this mapping relationship.
[0146] Exemplarily, when the encryption key information, the structured data and the integrity signature value are concatenated, a first identifier can be set for the structured data (indicating that the first identifier is followed by the structured data), a second identifier can be set for the integrity signature value (indicating that the second identifier is followed by the integrity signature value), and a third identifier can be set for the encryption key information (indicating that the third identifier is followed by the encryption key information).
[0147] The order of the encryption key information, structured data, and integrity signature value in the index data is not limited in this embodiment. For example, the encryption key information can be located in front of the structured data, or the encryption key information can be located behind the structured data. The encryption key information can be located in front of the integrity signature value, or the encryption key information can be located behind the integrity signature value. The structured data can be located in front of the integrity signature value, or the structured data can be located behind the integrity signature value.
[0148] For example, considering that during video playback, it is necessary to use structured data first, then the integrity signature value, and then the encryption key information, therefore, the structured data can be located in the signature of the integrity signature value, and the integrity signature value can be located in front of the encryption key information. Based on this, the index data can include a first identifier, structured data, a second identifier, an integrity signature value, a third identifier, and encryption key information in sequence. During video playback, after parsing the first identifier, the second identifier, and the third identifier from the index data, the content between the first identifier and the second identifier can be determined as structured data, the content between the second identifier and the third identifier can be determined as the integrity signature value, and the content after the third identifier can be determined as encryption key information.
[0149] Step 7: The storage device stores multiple copies of the index data in the first data disk. When the index data is stored in the first data disk, the index data may be persistently stored in the first data disk.
[0150] Exemplarily, the storage device stores the index data in a data disk instead of in a database. Since the data disk can be a mechanical hard disk instead of a solid-state disk, the index data can be stored in the mechanical hard disk. In addition, multiple copies of the index data can be copied and stored in multiple data disks, thereby avoiding the loss of index data due to a data disk failure.
[0151] Exemplarily, the data security corresponding to the video sequence can be obtained, and the data security can be a high security storage requirement, a medium security storage requirement, or a low security storage requirement. For example, the user can configure the data security corresponding to the video sequence according to actual needs, such as the user configures all video sequences in time interval 1 to correspond to high security storage requirements, configures all video sequences in time interval 2 to correspond to medium security storage requirements, and so on. Of course, other methods can also be used to obtain data security.
[0152] N copies of index data may be generated based on the index data, where N may be a positive integer greater than 1. For example, the index data may be copied to obtain a total of N copies of index data.
[0153] If the data security is a high-security storage requirement, N copies of index data can be stored in the data disks of N storage nodes. For example, the storage system can deploy multiple storage nodes in a distributed manner, and N storage nodes can be selected from multiple storage nodes, and the N copies of index data can be stored in the data disks of the N storage nodes, that is, each storage node's data disk stores one copy of index data.
[0154] If the data security is a medium security storage requirement, N copies of index data can be stored in N data disks of a storage node. For example, the storage system can deploy multiple storage nodes in a distributed manner, and a storage node can be selected from multiple storage nodes, and the storage node can include multiple data disks, and N data disks can be selected from multiple data disks, and the N copies of index data can be stored in the N data disks of the storage node, that is, each data disk stores one copy of index data.
[0155] If the data security is a low security storage requirement, N copies of index data can be stored in N data partitions of a data disk of a storage node. For example, the storage system can deploy multiple storage nodes in a distributed manner, select a storage node from multiple storage nodes, select a data disk from multiple data disks of the storage node, and store N copies of index data in N data partitions of the data disk, that is, each data partition stores one copy of index data.
[0156] Exemplarily, when the mapping relationship between the unique identifier of the encryption key and the encryption key is stored on the third data disk, multiple copies of the mapping relationship can also be stored on the third data disk (the third data disk can be a mechanical hard disk), so as to avoid the loss of the mapping relationship due to the failure of a data disk. For example, N copies of the mapping relationship can be generated based on the mapping relationship. If the data security is a high-security storage requirement, the N copies of the mapping relationship can be stored in the data disks of N storage nodes respectively. Alternatively, if the data security is a medium-security storage requirement, the N copies of the mapping relationship can be stored in the N data disks of a storage node respectively. Alternatively, if the data security is a low-security storage requirement, the N copies of the mapping relationship can be stored in the N data partitions of a data disk of a storage node respectively.
[0157] Step 8: The storage device stores the encrypted video sequence in a second data disk.
[0158] Exemplarily, when storing the encrypted video sequence in the data disk, the storage location corresponding to the encrypted video sequence in the data disk (i.e., the offset address of the video sequence) can be determined first, and the above structured data will also include the offset address of the video sequence. On this basis, based on the offset address of the video sequence, the encrypted video sequence can be stored in the data disk at a location corresponding to the offset address.
[0159] The offset address may include a start address and a data length, or the offset address may include a start address and an end address, and there is no limitation to this, as long as it can indicate the storage location of the video sequence.
[0160] Exemplarily, the second data disk may include but is not limited to a mechanical hard disk or a solid state disk, that is, the encrypted video sequence may be stored via a mechanical hard disk or a solid state disk.
[0161] In one possible implementation, see Figure 6 FIG. 1 is a schematic diagram of a method for reading video data (i.e., video playback). The method can be applied to a storage device. The method may include:
[0162] Step 1: The storage device obtains a video playback request from the client. The video playback request may include an IPC identifier, a playback start time, and a playback end time, indicating that the video data collected by the IPC corresponding to the IPC identifier needs to be retrieved, and the video data between the playback start time and the playback end time needs to be retrieved.
[0163] For example, the video playback module of the storage device may obtain a video playback request from the client.
[0164] Step 2: The storage device reads index data from the first data disk.
[0165] Exemplarily, since the first data disk includes multiple index data, each index data can be traversed in sequence from the first data disk. It should be noted that since the index data is stored in multiple copies, when a data disk fails, the index data can also be traversed from other data disks.
[0166] Step 3: For each index data, the storage device parses the index data to obtain structured data.
[0167] For example, if the index data includes a first identifier, structured data, a second identifier, an integrity signature value, a third identifier and encryption key information in sequence, then after parsing the first identifier and the second identifier from the index data, the content between the first identifier and the second identifier is determined as structured data.
[0168] Step 4: If the structured data matches the video playback request, the storage device obtains an offset address in the structured data, where the offset address may include a start address and a data length.
[0169] Exemplarily, for each index data, if the structured data in the index data matches the video playback request, the subsequent steps are performed based on the index data. If the structured data in the index data does not match the video playback request, the subsequent steps are not performed based on the index data.
[0170] Exemplarily, the first time interval can be determined based on the start time and the end time in the structured data, and the second time interval can be determined based on the playback start time and the playback end time in the video playback request. If there is an overlap between the first time interval and the second time interval, the structured data matches the video playback request, otherwise, if there is no overlap, the structured data does not match the video playback request.
[0171] For example, if the video playback request also includes an IPC identifier, and the structured data also includes an IPC identifier, then if the IPC identifier in the structured data is different from the IPC identifier in the video playback request, the structured data does not match the video playback request. If the IPC identifier in the structured data is the same as the IPC identifier in the video playback request, the first time interval and the second time interval are compared to see if there is any overlapping time.
[0172] Step 5: Based on the offset address in the structured data, the storage device obtains the encrypted video sequence corresponding to the offset address from the second data disk. For example, starting from the start address of the second data disk, the video data corresponding to the data length is read, and the read video data is the encrypted video sequence.
[0173] Step 6: The storage device parses the index data to obtain the integrity signature value of the encrypted video sequence.
[0174] For example, if the index data includes a first identifier, structured data, a second identifier, an integrity signature value, a third identifier and encryption key information in sequence, then after parsing the second identifier and the third identifier from the index data, the content between the second identifier and the third identifier is determined as the integrity signature value.
[0175] Step 7: The storage device uses the integrity signature value to perform integrity verification on the encrypted video sequence.
[0176] For example, the storage device calculates the integrity signature value A corresponding to the encrypted video sequence. If the storage device calls an encryption card (such as a hardware encryption card), the encryption card uses a hash algorithm (such as the SM3 algorithm, etc.) to perform a hash operation on the encrypted video sequence to obtain the integrity signature value A (i.e., the hash operation result).
[0177] Assuming that the integrity signature value B is obtained by parsing the index data, if the integrity signature value A is the same as the integrity signature value B, the integrity check succeeds, indicating that the encrypted video sequence has not been tampered with and the encrypted video sequence is complete, and step 8 is executed at this time. If the integrity signature value A is different from the integrity signature value B, the integrity check fails, indicating that the encrypted video sequence has been tampered with, and step 8 is not executed at this time.
[0178] Step 8: The storage device parses the index data to obtain encryption key information of the encrypted video sequence.
[0179] For example, if the index data includes a first identifier, structured data, a second identifier, an integrity signature value, a third identifier and encryption key information in sequence, then after parsing the third identifier from the index data, the content following the third identifier can be determined as the encryption key information.
[0180] After obtaining the encryption key information, the encryption key corresponding to the encryption key information can also be obtained. For example, if the encryption key information is a unique identifier of the encryption key, the encryption key corresponding to the unique identifier of the encryption key can be obtained from the third data disk. Alternatively, if the encryption key information is the encryption key itself, the encryption key information can be directly used as the encryption key.
[0181] Step 9: The storage device uses the encryption key to decrypt the encrypted video sequence (video ciphertext data) to obtain an unencrypted video sequence (video plaintext data). For example, the storage device calls an encryption card (such as a hardware encryption card), and the encryption card uses the encryption key to decrypt the encrypted video sequence to obtain an unencrypted video sequence, such as using a symmetric encryption algorithm to decrypt the encrypted video sequence.
[0182] After obtaining the unencrypted video sequence, the storage device may also return the video sequence to the client, and the client plays the video sequence, and no restriction is imposed on the processing process of the client.
[0183] In the above process, for the storage process of video data, it is necessary to splice the structured data, encryption key information and integrity signature value to obtain index data, and store the index data on the data disk instead of storing it in the database. For the reading process of video data, it is necessary to read the index data from the data disk, parse the index data to obtain the structured data, encryption key information and integrity signature value, instead of reading the index data from the database. The above operation will produce the following technical effects:
[0184] 1: Reduce database IO operations and improve performance. For example, when writing video data, replace the database write operations of structured data, encryption keys, and integrity signature values with data disk write operations, thereby greatly reducing database IO operations and improving performance. When playing back video data, replace the database read operations of structured data, encryption keys, and integrity signature values with data disk read operations, thereby greatly reducing database IO operations and improving performance.
[0185] 2: It does not occupy additional database index disk space, saving construction costs. For example, since structured data, encryption keys, and integrity signature values are all stored in the index data, and the index data is stored on the data disk, it does not occupy the database index disk space. Since the database index disk space is based on a solid-state drive, and the data disk is implemented on a mechanical hard disk, and the cost of a mechanical hard disk is lower than that of a solid-state drive, therefore, by storing structured data, encryption keys, and integrity signature values on the data disk, construction costs are saved.
[0186] 3: Improve video data security. For example, by storing structured data, encryption keys, and integrity signature values in multiple copies on the data disk, the security of video data is increased. Even if the index data on one data disk is damaged, the index data can be read from other copies without affecting video playback.
[0187] Based on the same application concept as the above method, a video data storage device is proposed in the embodiment of the present application, see Fig. 7A FIG. 1 is a schematic diagram of the structure of the device, and the device may include:
[0188] An acquisition module 71 is used to acquire a video sequence, wherein the video sequence includes multiple video frames; a processing module 72 is used to perform frame analysis on the video sequence to obtain structured data; acquire protection parameters corresponding to the video sequence, and splice the structured data and the protection parameters to obtain spliced index data, wherein the protection parameters are used to protect the video sequence; wherein the index data is used to parse the index data during video playback to obtain the structured data and the protection parameters, acquire the video sequence based on the structured data, and use the protection parameters to perform protection operations on the acquired video sequence; a storage module 73 is used to store the index data.
[0189] Exemplarily, when storing the index data, the storage module 73 is specifically used to: store the index data in a data disk.
[0190] Exemplarily, the protection parameter includes encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; the encryption key is used to encrypt the video sequence to obtain an encrypted video sequence; the storage module 73 is further used to: store the encrypted video sequence;
[0191] When the processing module 72 concatenates the structured data and the encryption key information, the structured data is preceded by a first identifier, and the encryption key information is preceded by a second identifier.
[0192] Exemplarily, the protection parameters include an integrity signature value; when the processing module 72 obtains the protection parameters corresponding to the video sequence, it is specifically used to: calculate the integrity signature value corresponding to the encrypted video sequence; wherein, when the processing module 72 concatenates the structured data, the encryption key information and the integrity signature value, the structured data is preceded by a first identifier, the encryption key information is preceded by a second identifier, and the integrity signature value is preceded by a third identifier.
[0193] After the processing module 72 concatenates the structured data, the encryption key information and the integrity signature value to obtain the concatenated index data, the index data sequentially includes the first identifier, the structured data, the third identifier, the integrity signature value, the second identifier and the encryption key information; wherein, after parsing the first identifier, the third identifier and the second identifier from the index data, the content between the first identifier and the third identifier is determined as the structured data, the content between the third identifier and the second identifier is determined as the integrity signature value, and the content after the second identifier is determined as the encryption key information.
[0194] Exemplarily, when storing the index data, the storage module 73 is specifically used to: obtain the data security corresponding to the video sequence; wherein the data security is a high-security storage requirement, a medium-security storage requirement, or a low-security storage requirement; generate N copies of index data based on the index data, where N is a positive integer greater than 1; if the data security is a high-security storage requirement, then the N copies of index data are respectively stored in the data disks of N storage nodes; or, if the data security is a medium-security storage requirement, then the N copies of index data are respectively stored in the N data disks of a storage node; or, if the data security is a low-security storage requirement, then the N copies of index data are respectively stored in N data partitions of a data disk of a storage node.
[0195] Based on the same application concept as the above method, a video playback device is proposed in the embodiment of the present application, see Figure 7B FIG. 1 is a schematic diagram of the structure of the device, and the device may include:
[0196] An acquisition module 74 is used to acquire a video playback request from a client;
[0197] The processing module 75 is used to obtain index data, parse the index data to obtain structured data and protection parameters; obtain the video sequence corresponding to the video playback request based on the structured data, and perform a protection operation on the video sequence using the protection parameters;
[0198] The sending module 76 is used to return the video sequence after the protection operation to the client.
[0199] Exemplarily, the protection parameters include encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; when the processing module 75 uses the protection parameters to perform a protection operation on the video sequence, it is specifically used for: if the video sequence is an encrypted video sequence, then the encryption key corresponding to the encryption key information is used to decrypt the encrypted video sequence to obtain a decrypted video sequence; wherein, when the index data is parsed to obtain the structured data and the encryption key information, when a first identifier is parsed from the index data, the content following the first identifier is determined as the structured data; when a second identifier is parsed from the index data, the content following the second identifier is determined as the encryption key information.
[0200] Exemplarily, the protection parameters include an integrity signature value; when the processing module 75 uses the protection parameters to perform a protection operation on the video sequence, it is specifically used to: use the integrity signature value to perform an integrity check on the encrypted video sequence; if the check is successful, perform an operation of decrypting the encrypted video sequence using the encryption key corresponding to the encryption key information to obtain a decrypted video sequence; if the check fails, discard the encrypted video sequence; wherein, when the index data is parsed to obtain the structured data, the encryption key information and the integrity signature value, when a first identifier is parsed from the index data, the content following the first identifier is determined as the structured data; when a second identifier is parsed from the index data, the content following the second identifier is determined as the encryption key information; when a third identifier is parsed from the index data, the content following the third identifier is determined as the integrity signature value.
[0201] Based on the same application concept as the above method, an electronic device is proposed in the embodiment of the present application, see Figure 8 As shown, the electronic device includes: a processor 81 and a machine-readable storage medium 82, wherein the machine-readable storage medium 82 stores machine-executable instructions that can be executed by the processor 81; the processor 81 is used to execute the machine-executable instructions to implement the video data storage method disclosed in the above example of this application, or to implement the video playback method disclosed in the above example of this application.
[0202] Based on the same application concept as the above method, an embodiment of the present application also provides a machine-readable storage medium, on which a number of computer instructions are stored. When the computer instructions are executed by a processor, the video data storage method disclosed in the above example of the present application can be implemented, or the video playback method disclosed in the above example of the present application can be implemented.
[0203] The above-mentioned machine-readable storage medium may be any electronic, magnetic, optical or other physical storage device, which may contain or store information, such as executable instructions, data, etc. For example, the machine-readable storage medium may be: RAM (Radom Access Memory), volatile memory, non-volatile memory, flash memory, storage drive (such as hard disk drive), solid state drive, any type of storage disk (such as optical disk, DVD, etc.), or similar storage medium, or a combination thereof.
[0204] Based on the same application concept as the above method, a computer program product is proposed in an embodiment of the present application, including a computer program. When the computer program is executed by a processor, it implements the video data storage method disclosed in the above example of the present application, or implements the video playback method disclosed in the above example of the present application.
[0205] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments of the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0206] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A method for storing video data, characterized in that: The method comprises: Acquire a video sequence, wherein the video sequence includes a plurality of video frames; Performing frame analysis on the video sequence to obtain structured data; Acquire protection parameters corresponding to the video sequence, and concatenate the structured data and the protection parameters to obtain concatenated index data, wherein the protection parameters are used to protect the video sequence; wherein the index data is used to parse the index data during video playback to obtain the structured data and the protection parameters, acquire the video sequence based on the structured data, and use the protection parameters to perform a protection operation on the acquired video sequence; storing the index data; Among them, the protection parameters include encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; the encryption key is used to encrypt the video sequence to obtain an encrypted video sequence; the method also includes: storing the encrypted video sequence.
2. The method according to claim 1, characterized in that The storing the index data includes: storing the index data in a data disk.
3. The method according to claim 1, characterized in that When the structured data and the encryption key information are concatenated, the structured data is preceded by a first identifier, and the encryption key information is preceded by a second identifier.
4. The method according to claim 3, characterized in that The protection parameter includes an integrity signature value; and obtaining the protection parameter corresponding to the video sequence includes: Calculating the integrity signature value corresponding to the encrypted video sequence; Among them, when the structured data, the encryption key information and the integrity signature value are spliced, the structured data is preceded by a first identifier, the encryption key information is preceded by a second identifier, and the integrity signature value is preceded by a third identifier.
5. The method according to claim 4, characterized in that After the structured data, the encryption key information and the integrity signature value are concatenated to obtain the concatenated index data, the index data sequentially includes the first identifier, the structured data, the third identifier, the integrity signature value, the second identifier and the encryption key information; Among them, after parsing the first identifier, the third identifier and the second identifier from the index data, the content between the first identifier and the third identifier is determined as the structured data, the content between the third identifier and the second identifier is determined as the integrity signature value, and the content after the second identifier is determined as the encryption key information.
6. The method according to claim 1 or 2, characterized in that: The storing of the index data comprises: Acquire data security corresponding to the video sequence; wherein the data security is a high security storage requirement, a medium security storage requirement, or a low security storage requirement; Generate N copies of index data based on the index data, where N is a positive integer greater than 1; If the data security is a high-security storage requirement, the N copies of index data are stored in the data disks of N storage nodes respectively; or, If the data security requirement is medium security storage requirement, the N copies of index data are stored in N data disks of a storage node respectively; or, If the data security requirement is low security storage, the N copies of index data are respectively stored in N data partitions of a data disk of a storage node.
7. A video playback method, characterized in that: The method comprises: Get video playback request from the client; Obtaining index data, and parsing the index data to obtain structured data and protection parameters; Acquire a video sequence corresponding to the video playback request based on the structured data, perform a protection operation on the video sequence using the protection parameter, and return the video sequence after the protection operation to the client; Wherein, the protection parameter includes encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; The using the protection parameter to perform a protection operation on the video sequence includes: If the video sequence is an encrypted video sequence, the encrypted video sequence is decrypted using the encryption key corresponding to the encryption key information to obtain a decrypted video sequence.
8. The method according to claim 7, characterized in that When the index data is parsed to obtain the structured data and the encryption key information, when a first identifier is parsed from the index data, content following the first identifier is determined as the structured data; When the second identifier is parsed from the index data, the content following the second identifier is determined as the encryption key information.
9. The method according to claim 8, characterized in that The protection parameters include an integrity signature value; The using the protection parameter to perform a protection operation on the video sequence includes: Performing integrity check on the encrypted video sequence using the integrity signature value; If the verification is successful, an operation of decrypting the encrypted video sequence using the encryption key corresponding to the encryption key information to obtain a decrypted video sequence is performed; If the verification fails, discarding the encrypted video sequence; Among them, when the index data is parsed to obtain the structured data, the encryption key information and the integrity signature value, when a first identifier is parsed from the index data, the content following the first identifier is determined as the structured data; when a second identifier is parsed from the index data, the content following the second identifier is determined as the encryption key information; when a third identifier is parsed from the index data, the content following the third identifier is determined as the integrity signature value.
10. A video data storage device, characterized in that: The device comprises: An acquisition module, used for acquiring a video sequence, wherein the video sequence includes a plurality of video frames; A processing module, configured to perform frame analysis on the video sequence to obtain structured data; obtain protection parameters corresponding to the video sequence, and splice the structured data and the protection parameters to obtain spliced index data, wherein the protection parameters are used to protect the video sequence; wherein the index data is used to parse the index data during video playback to obtain the structured data and the protection parameters, obtain the video sequence based on the structured data, and use the protection parameters to perform a protection operation on the obtained video sequence; A storage module, used for storing the index data; Among them, the protection parameters include encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; the encryption key is used to encrypt the video sequence to obtain an encrypted video sequence; the storage module is also used to: store the encrypted video sequence.
11. A video playback device, characterized in that: The device comprises: The acquisition module is used to obtain a video playback request from the client; A processing module, configured to obtain index data, parse the index data to obtain structured data and protection parameters; obtain a video sequence corresponding to the video playback request based on the structured data, and perform a protection operation on the video sequence using the protection parameters; A sending module, used for returning the video sequence after the protection operation to the client; Among them, the protection parameters include encryption key information; the encryption key information includes an encryption key or a unique identifier of an encryption key; when the processing module uses the protection parameters to perform a protection operation on the video sequence, it is specifically used for: if the video sequence is an encrypted video sequence, then the encryption key corresponding to the encryption key information is used to decrypt the encrypted video sequence to obtain a decrypted video sequence.
12. An electronic device, characterized in that: include: a processor and a machine-readable storage medium storing machine-executable instructions executable by the processor; The processor is used to execute machine-executable instructions to implement the method described in any one of claims 1-6, or the processor is used to execute machine-executable instructions to implement the method described in any one of claims 7-9.
13. A machine-readable storage medium, characterized in that: The machine-readable storage medium stores a plurality of computer instructions, and when the computer instructions are executed by a processor, the method described in any one of claims 1 to 6 is implemented, or the method described in any one of claims 7 to 9 is implemented.
14. A computer program product, characterized in that The method comprises a computer program, which, when executed by a processor, implements the method described in any one of claims 1 to 6, or, when executed by a processor, implements the method described in any one of claims 7 to 9.
