Video data storage method, device and system and electronic equipment
By determining the second shared storage space in the shared storage pool, the video recording data in the monitoring video system is stored remotely, and the problem of low security of video recording data storage is solved, and higher data security and reliability are achieved.
Patent Information
- Application Number
- CN202311676186.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-07
- Publication Date
- 2025-06-10
AI Technical Summary
In existing surveillance video systems, the storage security of recorded data is low, and data loss is easily caused by hard disk damage, theft or failure.
By determining the second shared storage space matching the storage space in the shared storage pool, the recording data of the first video recording device is stored in the storage medium of the second video recording device, and the storage security is improved.
The probability of video recording data is reduced, and the security of storage is improved, ensuring that the video recording data is not lost even if the hard disk is damaged or other failures occur in the first video recording device.
Smart Images

Figure CN120128668A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of information processing, and particularly relates to a method, device, system and electronic device for storing video data. Background Art
[0002] With the development of monitoring technology, the recording of monitoring videos through network cameras and network digital video recorders is becoming more and more widely used in daily life. The monitoring videos and their related data information can all be video data, and users have higher and higher requirements for the security of video data storage.
[0003] Generally, a video monitoring system includes a network digital video recorder and multiple network cameras. Through each network camera, the monitoring images of the monitoring area can be obtained. Each network camera transmits the monitoring images to the network digital video recorder. The network digital video recorder records the monitoring images as the monitoring videos corresponding to each network camera respectively, and stores each monitoring video on the hard disk in the network digital video recorder.
[0004] The video data stored on the hard disk of the network digital video recorder may be lost due to reasons such as the hard disk being deliberately damaged, stolen or hard disk failure. Therefore, the low security of video data storage has become an urgent problem to be solved. Summary of the Invention
[0005] The present invention provides a method, device, system and electronic device for storing video data, so as to solve the defect of low security of video data storage and achieve the purpose of improving the security of video data storage.
[0006] The present invention provides a method for storing video data, including:
[0007] Receiving a space allocation request sent by a first video device; the space allocation request includes the requested storage space;
[0008] When it is determined that the storage space is smaller than the first shared storage space of the first video device in the shared storage pool, determining a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device;
[0009] Sending the identifier of the second video device corresponding to the second shared storage space to the first video device, and updating the storage space state of the second shared storage space of the second video device to an occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device.
[0010] According to the video data storage method provided by the present invention, determining a second shared storage space matching the storage space in the shared storage pool includes:
[0011] Determining at least one candidate storage space with an idle storage space state in the shared storage pool;
[0012] Determining a second shared storage space matching the storage space from the at least one candidate storage space.
[0013] According to the video data storage method provided by the present invention, after updating the storage space state of the second shared storage space of the second video device to an occupied state, the method further includes:
[0014] Updating the first shared storage space in the shared storage pool based on the difference between the first shared storage space and the second shared storage space.
[0015] According to the video data storage method provided by the present invention, the method further includes:
[0016] When receiving a termination storage request sent by the first video device, updating the storage space state of the second shared storage space to an idle state, and restoring the updated first shared storage space in the shared storage pool to the first shared storage space.
[0017] According to the video data storage method provided by the present invention, the method further includes:
[0018] Obtaining the online duration of the first video device within a preset time period, the storage bandwidth of the first video device, and the transmission bandwidth of the first video device;
[0019] Determining a third shared storage space of the first video device based on the online duration, the storage bandwidth, the transmission bandwidth, and the initial shared storage space of the first video device in the shared storage pool, and updating the first shared storage space in the shared storage pool based on the third shared storage space.
[0020] According to the video data storage method provided by the present invention, the method further includes:
[0021] When determining that the first video device fails to store video data of other video devices, prohibiting the storage of the video data of the first video device into the second shared storage space of the second video device.
[0022] The present invention also provides a video data storage device, including:
[0023] A receiving module, configured to receive a space allocation request sent by a first video recording device; the space allocation request includes the requested storage space.
[0024] A determining module, configured to determine a second shared storage space matching the storage space in the shared storage pool when it is determined that the storage space is smaller than the first shared storage space of the first video recording device in the shared storage pool; the shared storage pool includes the shared storage spaces of each video recording device.
[0025] A storage module, configured to send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to an occupied state, where the identifier of the second video recording device is used to indicate storing the video data of the first video recording device in the second shared storage space of the second video recording device.
[0026] The present invention further provides a video data storage system, including a server and at least two video recording devices connected to the server; the at least two video recording devices include a first video recording device.
[0027] The first video recording device is configured to send a space allocation request to the server; the space allocation request includes the requested storage space.
[0028] The server is configured to determine a second shared storage space matching the storage space in the shared storage pool when it is determined that the storage space is smaller than the first shared storage space of the first video recording device in the shared storage pool; the shared storage pool includes the shared storage spaces of each video recording device.
[0029] The server is further configured to send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to an occupied state.
[0030] The first video recording device is further configured to send the video data of the first video recording device to the second video recording device based on the identifier of the second video recording device.
[0031] The second video recording device is configured to store the video data of the first video recording device in the second shared storage space of the second video recording device.
[0032] According to the video data storage system provided by the present invention, the first video device is specifically configured to store the video data of the first video device locally when detecting that the network connection with the second video device is disconnected, and send the video data stored locally to the second video device based on the identifier of the second video device when detecting that the network connection with the second video device is restored.
[0033] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, the video data storage method described in any one of the above is implemented.
[0034] The present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the video data storage method described in any one of the above is implemented.
[0035] The present invention also provides a computer program product, including a computer program. When the computer program is executed by a processor, the video data storage method described in any one of the above is implemented.
[0036] The video data storage method, device, system and electronic device provided by the present invention, the method is to receive a space allocation request sent by a first video device; the space allocation request includes the requested storage space; when it is determined that the storage space is less than the first shared storage space of the first video device in the shared storage pool, determine a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device; send the identifier of the second video device corresponding to the second shared storage space to the first video device, and update the storage space status of the second shared storage space of the second video device to an occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device. Based on the shared storage pool, the first video device can store its video data in the second video device, achieving the purpose of off-site storage. Even when the storage medium such as the hard disk of the first video device is deliberately damaged, stolen or fails, its video data will not be lost, reducing the probability of video data loss and improving the security of video data storage of the first video device to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0038] Figure 1 is a schematic flowchart of the video data storage method provided by an embodiment of the present invention;
[0039] Figure 2 is a schematic structural diagram of the video data storage device provided by an embodiment of the present invention;
[0040] Figure 3 is a schematic structural diagram of the video data storage system provided by an embodiment of the present invention;
[0041] Figure 4 is a schematic physical structure diagram of the electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0042] To make the objectives, technical solutions and advantages of the present invention clearer, the technical solutions in the present invention will be clearly and completely described below with reference to the accompanying drawings in the present invention. Apparently, the described embodiments are some but not all of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present invention without creative efforts shall fall within the protection scope of the present invention.
[0043] It should be noted that the serial numbers assigned to the objects described in the present invention itself, such as "first", "second", etc., are only used to distinguish the described objects and do not have any sequential or technical meaning.
[0044] In a common video surveillance system, the current storage method for video data is mostly local storage. When storing video data locally, the video data recorded by a video recording device is stored in a storage medium such as a hard disk, a memory card or a USB flash drive of the video recording device. The security of local storage of video data is relatively low. For example, the storage medium of a surveillance video recording device may be deliberately damaged or stolen, or a malfunction may occur. Therefore, when storing video data locally, the probability of video data loss is relatively high and the storage security is relatively low.
[0045] In view of the above problems, the present invention provides a method for storing video data. The method is to receive a space allocation request sent by a first video device; the space allocation request includes the requested storage space; in the case where it is determined that the storage space is smaller than the first shared storage space of the first video device in the shared storage pool, determine a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device; send the identifier of the second video device corresponding to the second shared storage space to the first video device, and update the storage space status of the second shared storage space of the second video device to the occupied state, and the identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device. Based on this, at least two video devices can be used to form a shared storage pool, and through the shared storage pool, the video data of the first video device can be stored in the storage medium of the second video device, achieving the purpose of off-site storage of video data, thereby overcoming the defect of relatively low storage security brought by local storage, reducing the probability of video data loss, and improving the storage security to a certain extent.
[0046] The execution subject of the video data storage method provided by the embodiment of the present invention can be an electronic device such as a computer or a server, or a specially designed intelligent device, or a video data storage device provided in the electronic device or the intelligent device, and the video data storage device can be implemented by software, hardware or a combination of both.
[0047] The method of the present invention can be applied to the video data storage requirements in a variety of application scenarios. For example, it can be applied to a scenario where there are multiple network video recorders, and the multiple network video recorders are located in different positions. This solution is not limited to multiple devices of one user, and can also be that the devices of different users utilize the hard disk space for off-site storage with each other. For example, in scenarios such as large chain convenience stores, gas stations, shopping malls, hospitals or schools, at least two network video recorders form a shared storage pool to achieve off-site storage. It should be understood that any device that can implement video data storage can become the storage medium in the shared storage pool, not limited to network video recorders.
[0048] Next, taking the execution subject as a server as an example, in combination with Figure 1 the video data storage method provided by the embodiment of the present invention will be described. Figure 1 It is a schematic flowchart of the video data storage method provided by the embodiment of the present invention. As Figure 1 shown, the video data storage method includes steps 110 to 130.
[0049] Step 110, receive a space allocation request sent by a first video device; the space allocation request includes the requested storage space.
[0050] Specifically, the video recording device can be a device with the ability to store video recording data, such as a network digital video recorder, a hard disk, or a memory card and other storage media. The first video recording device can be the video recording device that initiates the video recording data storage request. The first video recording device is communicatively connected to the server. When the first video recording device needs to store video recording data, the first video recording device sends a space allocation request to the server, and the space allocation request includes the requested storage space, that is, the storage space value required for storing the video recording data.
[0051] Step 120, in the case where it is determined that the storage space is less than the first shared storage space of the first video recording device in the shared storage pool, determine a second shared storage space that matches the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video recording device.
[0052] Specifically, the shared storage pool can be a set including the shared storage spaces of at least two video recording devices. The first shared storage space of the first video recording device can be the maximum storage space value indicating that the first video recording device can store video recording data on other video recording devices in the shared storage pool.
[0053] Optionally, the first shared storage space can be determined by the first video recording device providing the maximum storage space value for storing the video recording data of other video recording devices to the shared storage pool. For example, at the current moment, the first video recording device provides 1000G of storage space for storing the video recording data of other video recording devices in the shared storage pool, then the value of the first shared storage space of the first video recording device can be determined to be 1000G. The value of the first shared storage space can also be represented by points. For example, providing 1G of storage space can obtain 1 point, then providing 1000G of storage space for the first shared storage space can obtain 1000 points.
[0054] After receiving the space allocation request sent by the first video recording device, the server can determine the space allocation request. For example, determine the specific value of the storage space requested in the space allocation request. After determining the specific value of the storage space requested in the space allocation request, it can be compared with the first shared storage space of the first video recording device based on this specific value. In the case where it is determined that the storage space is less than the first shared storage space of the first video recording device in the shared storage pool, then a second shared storage space matching the storage space is determined in the shared storage pool. The second shared storage space can be the storage space provided by other video recording devices in the shared storage pool except the first video recording device, and the second shared storage space is the storage space determined in the shared storage pool for storing the video data of the first video recording device. The storage space size of the second shared storage space can match the size of the requested storage space. For example, the value of the storage space of the second shared storage space is greater than or equal to the value of the requested storage space. The server can obtain the values of the storage spaces of each video recording device in the shared storage pool and discriminate the values of the storage spaces of each video recording device to determine at least one second shared storage space.
[0055] Step 130, send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to the occupied state. The identifier of the second video recording device is used to indicate that the video data of the first video recording device is to be stored in the second shared storage space of the second video recording device.
[0056] Specifically, the identifier of the second video recording device may include the device name, device connection information, storage space address, etc. of the second video recording device. For example, the server can record the read / write addresses of the storage spaces of each video recording device in the shared storage pool, that is, the storage space address, for other devices to perform read / write operations on the storage space.
[0057] After the server determines the second shared storage space, it can update the storage space status of the second shared storage space of the second video recording device to the occupied state to mark that this storage space is used to store the video data of the first video recording device, avoiding misusing this second shared storage space when determining the corresponding shared storage space for other video recording devices; at the same time, updating to the occupied state can also avoid repeatedly determining each shared storage space and improve the determination efficiency when determining the second shared storage space.
[0058] Send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device. The first video recording device can then establish a communication connection with the second video recording device based on the identifier of the second video recording device. After the connection is successful, the first video recording device can store the video data it needs to store in the second shared storage space of the second video recording device.
[0059] Taking the first video device as device A and the second video device as device B as an example, device A needs to occupy storage space from the shared storage pool for video data storage. According to the score of device A, a suitable storage space is determined, that is, the storage space of device B is determined as the second shared storage space. The server sends the storage space address of device B to device A, and updates the status of the storage space corresponding to the storage space address of device B to the occupied state. Device A stores video data based on the storage space address.
[0060] Optionally, assume that the maximum storage space provided by device A for the shared storage pool is 1000G, and the score of device A is 1000. After device A occupies the storage space of device B from the shared storage pool for video data storage, the server can deduct the corresponding score of device A. For example, if device A occupies 200G of storage space, then 200 points of device A are deducted correspondingly. After storing the video data, the score of device A is updated to 800. At the same time, when the score of device A is 1000, device A can only occupy a storage space less than or equal to 1000G for storage.
[0061] Exemplarily, when device A starts writing video data to device B, the server simultaneously records video storage information, including the start time of the stored video, the end time of the video, the video storage address, etc. The recording format is shown in Table 1 below.
[0062] Table 1
[0063] Device Information Video Storage Address Video Start Time Video End Time Device A 0x12345678 Unix Timestamp Unix Timestamp Device B 0x98574123 Unix Timestamp Unix Timestamp
[0064] The video data storage method provided by the embodiment of the present invention is to receive a space allocation request sent by a first video device; the space allocation request includes the requested storage space; in the case where it is determined that the storage space is less than the first shared storage space of the first video device in the shared storage pool, a second shared storage space matching the storage space is determined in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device; the identifier of the second video device corresponding to the second shared storage space is sent to the first video device, and the storage space status of the second shared storage space of the second video device is updated to the occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device. Based on the shared storage pool, the first video device can store its video data in the second video device, achieving the purpose of off-site storage. Even when the storage medium such as the hard disk of the first video device is deliberately damaged, stolen or fails, its video data will not be lost, reducing the probability of video data loss and improving the security of video data storage of the first video device to a certain extent.
[0065] The shared storage space provided by multiple video recording devices can form a shared storage pool, and based on the shared storage pool, each video recording device participating in the shared storage pool can achieve the purpose of storing video data remotely. Compared with local storage, the shared storage method can improve the security of storing video data to a certain extent, and at the same time, the shared storage method also has the advantage of lower storage costs. If the video data is stored in the cloud storage server provided by the service provider to achieve remote storage, storage fees need to be paid regularly. When the amount of video data to be stored is small, the storage fees may not be high, but when the amount of video data to be stored is huge, the storage fees may be high, resulting in too high storage costs. When the first video recording device stores video data in other video recording devices in the shared storage pool, it is implemented based on the space allocation request sent by the first video recording device. The space allocation request includes the requested storage space and is carried out when it is determined that the requested storage space is less than the first shared storage space of the first video recording device in the shared storage pool. Based on this condition, it can be ensured that each video recording device can fairly use the shared storage space of other video recording devices in the shared storage pool, and fairness in storage services can be achieved. At the same time, compared with directly using the storage space provided by the cloud storage service, the storage cost can be effectively controlled. Therefore, when storing video data based on this method, the economy is relatively good and the security is relatively high, and the purpose of improving the storage security of video data can be achieved under the premise of controlling the storage cost.
[0066] In practical applications, the server may need to frequently find shared storage space for each video recording device that needs to store video data. Therefore, in order to improve the determination efficiency of the second shared storage space and shorten the time-consuming for storing video data, the search range can be narrowed by determining the candidate storage space to improve the efficiency and reduce the time-consuming.
[0067] In one embodiment, determining the second shared storage space matching the storage space in the shared storage pool can be specifically implemented in the following manner:
[0068] Determine at least one candidate storage space with an idle state in the shared storage pool; determine the second shared storage space matching the storage space from the at least one candidate storage space.
[0069] Specifically, when the storage space state is the idle state, it indicates that the storage space in the idle state can be used to store video data. The storage space in the idle state can be an empty storage space, or a storage space that can overwrite or delete the stored data, etc. Based on the storage space in the idle state, at least one candidate storage space can be determined from all the shared storage spaces in the shared storage pool.
[0070] Exemplarily, when determining a second shared storage space that matches the storage space in at least one candidate storage space, it can be to determine, among the candidate storage spaces, the candidate storage space whose storage space value is equal to the requested storage space as the second shared storage space; or it can be to determine, among the candidate storage spaces, the candidate storage space whose storage space value is greater than the requested storage space and the difference between the two is less than a preset threshold as the second shared storage space. Herein, the preset threshold can be a preset value for considering the value of the candidate storage space, so as to reasonably utilize each candidate storage space, avoid matching an overly large candidate storage space to the first video recording device, and improve the overall utilization efficiency of the shared storage pool.
[0071] In this embodiment, when determining a second shared storage space that matches the storage space in the shared storage pool, it is to determine at least one candidate storage space in the shared storage pool whose storage space status is the idle state; and determine a second shared storage space that matches the storage space among the at least one candidate storage space. In this way, by determining the candidate storage space, the search range for determining the second shared storage space can be narrowed, the efficiency of determining the second shared storage space can be effectively improved, and the overall time consumption for storing video data can be reduced to improve timeliness.
[0072] In practical applications, in order to balance the rationality of each video recording device using the shared storage space and avoid the situation of unequal resource utilization caused by some devices overusing the shared storage space, the first shared storage space can be updated in a timely manner to ensure that all parties reasonably utilize the shared storage resources.
[0073] In one embodiment, after updating the storage space status of the second shared storage space of the second video recording device to the occupied state, the method further includes: updating the first shared storage space in the shared storage pool based on the difference between the first shared storage space and the second shared storage space.
[0074] Specifically, when updating the first shared storage space in the shared storage pool based on the difference between the first shared storage space and the second shared storage space, it can be to subtract the second shared storage space from the first shared storage space, that is, subtract the value of the second shared storage space from the value of the first shared storage space to obtain the difference between the two, and determine the difference as the updated first shared storage space of the first video recording device.
[0075] Among them, the value of the second shared storage space can be the value of the second shared storage space when determining the second shared storage space, or the value of the second shared storage space actually occupied by the first video recording device. For example, if the first shared storage space of the first video recording device is 1000G, it can be expressed as 1000 points, and the requested storage space is 180G. The value of the second shared storage space determined by the server is 200G. If the first video recording device actually stores 180G of video data in the second shared storage space, then 180G of the actually occupied second shared storage space can be subtracted from the first shared storage space of 1000G. The updated first shared storage space is 820G. When expressed in points, it is 1000 points minus 180 points, and the updated points of the first video recording device are 820 points. Another example is that the first shared storage space of the first video recording device is 1000G, which can be expressed as 1000 points, and the requested storage space is 180G. The value of the second shared storage space determined by the server is 200G. If the first video recording device actually stores 180G of video data in the second shared storage space, then 200G of the second shared storage space requested for this space allocation can be subtracted from the first shared storage space of 1000G. The updated first shared storage space is 800G. When expressed in points, it is 1000 points minus 200 points, and the updated points of the first video recording device are 800 points. In this example, the 20G of unoccupied storage space for this time can be directly used when the first video recording device stores video data next time, so as to reduce the frequency of the first video recording device sending space allocation requests and improve the efficiency when storing video data.
[0076] In this embodiment, after updating the storage space state of the second shared storage space of the second video recording device to the occupied state, the first shared storage space in the shared storage pool can also be updated based on the difference between the first shared storage space and the second shared storage space. By updating the first shared storage space with the difference between the first shared storage space and the second shared storage space, it can be avoided that the first video recording device excessively occupies the shared storage space in the shared storage pool, so that each video recording device can normally use the shared storage space in the shared storage pool, and the balance when each video recording device occupies the shared storage resources can be improved.
[0077] In practical applications, video data has a certain validity period. Video data that exceeds the validity period can be cleared or overwritten; or according to the needs of the first video recording device, it may be necessary to delete the already stored video data in a timely manner; or there are other situations where storage needs to be terminated in a timely manner. In these cases, it is necessary to update the storage space state of the second shared storage space in a timely manner to restore the value of the first shared storage space, which is beneficial to the first video recording device to reasonably use the shared storage space.
[0078] In one embodiment, the method further includes: when receiving a termination storage request sent by a first video recording device, updating the storage space status of a second shared storage space to an idle state, and restoring the updated first shared storage space in the shared storage pool to the first shared storage space.
[0079] Specifically, termination of storage may mean that the stored video data corresponding to the termination storage request can be emptied or overwritten. When the server receives a termination storage request sent by the first video recording device, it can update the storage space status of the second shared storage space to an idle state. The second shared storage space updated to an idle state can be understood as a shared storage space capable of storing new video data.
[0080] The first video recording device sending a termination storage request may mean that the video data of the first video recording device stored in the second shared storage space can be emptied or overwritten. At this time, the second shared storage space can be used to store the video data of any video recording device. Therefore, the first shared storage space of the first video recording device can be restored.
[0081] Exemplarily, restoring the first shared storage space may be adding the storage space value of the second shared storage space updated to an idle state to the current first shared storage space. For example, after device A stops storing videos to device B, update the video end time in Table 1 above, and at the same time send the video end time and the termination storage request to the server. The server should return the points of device A and update the storage space corresponding to device B to an idle state, waiting for other video recording devices to occupy.
[0082] For example, before Device A stores video data in Device B, the score of Device A is 1000. When it occupies the second shared storage space of Device B to store video data, 800 points are deducted, so Device A has 200 points remaining. When Device A continues to store video data in the shared storage pool with only 200 points, it can occupy at most the shared storage space corresponding to 200 points. If the video data already stored by Device A in Device B does not need to be saved anymore, Device A can send a termination storage request to the server. After receiving the termination storage request, the server can update the status of the storage space where Device B has stored the video data of Device A to the idle state. At this time, new data can be written into this storage space to overwrite the previous video data or directly clear the previous video data. After receiving the termination storage request and updating the status of the corresponding storage space of Device B to the idle state, the server can return the points of Device A. Since 800 points were deducted for storing this video data, 800 points can be restored to Device A at this time. If the score of Device A is 200 when restoring, then adding the restored 800 points, the score of Device A can be updated to 1000 points. At this time, Device A can occupy at most the shared storage space corresponding to 1000 points in the shared storage pool.
[0083] In this embodiment, in the case of receiving a termination storage request sent by the first video device, the storage space status of the second shared storage space is updated to the idle state, and the updated first shared storage space in the shared storage pool is restored to the first shared storage space. Based on this, the first shared storage space of the first video device can be restored in a timely manner, and the video data stored in the second shared storage space can be reasonably released, effectively utilizing each shared storage space in the shared storage pool and improving the overall utilization efficiency of the storage resources.
[0084] Exemplarily, the states of the video devices in the shared storage pool are different. For example, some video devices have a longer online time and can continuously maintain a communication connection with the server. However, some video devices have a shorter online time, and the server cannot timely maintain a communication connection with them, and other video devices cannot store video data in the shared storage space provided by them. Therefore, based on the differences in the states of the video devices, it is necessary to update the first shared storage space of the first video device to determine the first shared storage space that conforms to the objective state.
[0085] In one embodiment, the method further includes: obtaining the online duration of the first video device within a preset time period, the storage bandwidth of the first video device, and the transmission bandwidth of the first video device; determining the third shared storage space of the first video device based on the online duration, storage bandwidth, transmission bandwidth, and the initial shared storage space of the first video device in the shared storage pool, and updating the first shared storage space in the shared storage pool based on the third shared storage space.
[0086] Specifically, the preset time period can be a periodic preset duration, such as 24 hours, one week, or one month, etc. The online duration can be the duration during which the first video recording device maintains a communication connection with the server or other video recording devices within the preset time period. The storage bandwidth of the first video recording device can be the value of the video recording data stored per second when the first video recording device stores the video recording data. The transmission bandwidth of the first video recording device can be the actual data size transmitted per second when storing the video recording data to the first video recording device. The server can record and count the status parameters of each video recording device to obtain the online duration of the first video recording device within the preset time period, the storage bandwidth of the first video recording device, and the transmission bandwidth of the first video recording device.
[0087] The initial shared storage space of the first video recording device in the shared storage pool can be understood as the value of the first shared storage space of the first video recording device determined when the first video recording device first joins the shared storage pool. For example, when device A first joins the shared storage pool and device A provides 1000G of storage space for the shared storage pool, the initial shared storage space of device A in the shared storage pool is 1000G. If 1G is 1 point, the initial shared storage space of device A in the shared storage pool can also be expressed as 1000 points.
[0088] Based on the online duration, storage bandwidth, transmission bandwidth, and the initial shared storage space of the first video recording device in the shared storage pool, the third shared storage space of the first video recording device can be determined. The third shared storage space can be the value of the shared storage space determined based on the online duration, storage bandwidth, transmission bandwidth, and the initial shared storage space.
[0089] Exemplarily, taking the preset time period as 24 hours as an example, when determining the third shared storage space of the first video recording device based on the online duration, storage bandwidth, transmission bandwidth, and the initial shared storage space of the first video recording device in the shared storage pool, it can be determined through an update formula. The update formula is: Third shared storage space = Initial shared storage space * (Online duration / 24 hours) * (Transmission bandwidth / Storage bandwidth). Updating the first shared storage space in the shared storage pool based on the third shared storage space can be to determine the calculated third shared storage space as the first shared storage space of the first video recording device in the current time period.
[0090] The above update formula can also be understood as the integral calculation formula for the shared storage space, that is, Integral = Hard disk capacity * (Online duration / 24 hours) * (Actual data size transmitted per second / Video size per second). During the storage process, the integral of the first video recording device is recalculated every 24 hours according to the integral calculation formula. If the integral decreases, the available shared storage space of the device decreases accordingly. If the integral increases, the available shared storage space allocated to the device increases accordingly.
[0091] For example, when device A initially joins the shared storage pool and provides 1000G of storage space for the shared storage pool, device A obtains an initial score of 1000. After 24 hours of storage, the online duration of the device is only 20 hours; the video recording size per second is 2M, and the actual data transmission per second is 1.5M; then the score of device A is adjusted based on the score calculation formula, specifically: 1000 * (20 / 24) * (1.5 / 2) = 625 points. Then, the third shared storage space of the first video recording device, device A, is 625 points, and the third shared storage space of 625 points can be determined as the first shared storage space of the updated first video recording device.
[0092] In this embodiment, the online duration of the first video recording device within a preset time period, the storage bandwidth of the first video recording device, and the transmission bandwidth of the first video recording device can be obtained; based on the online duration, storage bandwidth, transmission bandwidth, and the initial shared storage space of the first video recording device in the shared storage pool, the third shared storage space of the first video recording device is determined, and the first shared storage space in the shared storage pool is updated based on the third shared storage space. Based on this, the first shared storage space of the first video recording device can be re-determined according to parameters such as the online duration of the first video recording device within a preset time period, the storage bandwidth of the first video recording device, and the transmission bandwidth of the first video recording device, so that the updated first shared storage space better conforms to the objective state of the device. Then, each video recording device can use the shared storage pool more reasonably, achieving the maximized and reasonable utilization of shared storage resources.
[0093] In practical applications, due to factors such as device failures or network failures, the situation may occur where the video recording device cannot normally store the video data of other video recording devices. In this case, the video recording device should be prohibited from storing video data for other video recording devices to avoid over-occupying the storage resources in the shared storage pool when it cannot provide shared storage resources.
[0094] In one embodiment, the method further includes: when it is determined that the first video recording device fails to store the video data of other video recording devices, prohibiting the storage of the video data of the first video recording device in the second shared storage space of the second video recording device.
[0095] Specifically, the server can monitor the connection status of each video recording device. When it is determined that the first video recording device fails to store the video data of other video recording devices, that is, when other video recording devices cannot store the video data in the shared storage space of the first video recording device, the server can send a control instruction to the second video recording device to prohibit the storage of the video data of the first video recording device in the second shared storage space of the second video recording device.
[0096] For example, if there is a long - term communication interruption in device A, such as a network failure or a hard disk failure, etc., it is necessary to prohibit device A from storing video data to device B until device A resumes normal operation and then lift the restriction. Based on this, it can be avoided that when device A has a communication interruption, device A can store video data to other video devices while other video devices cannot store video data to device A, so that device A cannot occupy other shared storage spaces in the shared storage pool even when it cannot provide a shared storage space.
[0097] In this embodiment, when it is determined that the storage of video data of the first video device to other video devices fails, it is prohibited to store the video data of the first video device to the second shared storage space of the second video device. Based on this, the storage process of video data of each video device can be reasonably controlled. It can be avoided that some video devices over - occupy the storage resources in the shared storage pool when they cannot provide shared storage resources, so as to protect the interests of other parties in resource utilization.
[0098] The video data storage device provided by the embodiment of the present invention will be described below. The video data storage device described below can be mutually corresponding and referred to the video data storage method described above.
[0099] Figure 2 It is a schematic structural diagram of the video data storage device provided by the embodiment of the present invention. As Figure 2 shown, the video data storage device 200 includes:
[0100] A receiving module 210, configured to receive a space allocation request sent by the first video device; the space allocation request includes the requested storage space.
[0101] A determining module 220, configured to determine a second shared storage space matching the storage space in the shared storage pool when it is determined that the storage space is smaller than the first shared storage space of the first video device in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device.
[0102] A storage module 230, configured to send the identifier of the second video device corresponding to the second shared storage space to the first video device, and update the storage space state of the second shared storage space of the second video device to an occupied state. The identifier of the second video device is used to indicate storing the video data of the first video device to the second shared storage space of the second video device.
[0103] In an exemplary embodiment, the determining module 220 is specifically configured to:
[0104] Determine at least one candidate storage space with an idle storage space state in the shared storage pool;
[0105] Determine a second shared storage space that matches the storage space in at least one candidate storage space.
[0106] In one example embodiment, the video data storage device 200 further includes an update module;
[0107] The update module is configured to update the first shared storage space in the shared storage pool based on the difference between the first shared storage space and the second shared storage space.
[0108] In one example embodiment, the update module is further configured to:
[0109] When receiving a termination storage request sent by the first video device, update the storage space status of the second shared storage space to the idle state, and restore the updated first shared storage space in the shared storage pool to the first shared storage space.
[0110] In one example embodiment, the video data storage device 200 further includes an acquisition module;
[0111] The acquisition module is configured to acquire the online duration of the first video device within a preset time period, the storage bandwidth of the first video device, and the transmission bandwidth of the first video device;
[0112] The determination module is further configured to determine a third shared storage space of the first video device based on the online duration, the storage bandwidth, the transmission bandwidth, and the initial shared storage space of the first video device in the shared storage pool, and update the first shared storage space in the shared storage pool based on the third shared storage space.
[0113] In one example embodiment, the storage module 230 is further configured to:
[0114] When it is determined that the first video device fails to store the video data of other video devices, prohibit storing the video data of the first video device in the second shared storage space of the second video device.
[0115] The device in this embodiment can be used to execute the method in any one of the method embodiments of the video data storage method. The specific implementation process and technical effects are similar to those in the method embodiments of the video data storage method. For details, reference can be made to the detailed introduction in the method embodiments of the video data storage method, which will not be elaborated here.
[0116] Figure 3 It is a schematic structural diagram of a video data storage system provided by an embodiment of the present invention. As Figure 3 shown, the video data storage system 300 includes a server 310 and at least two video devices 320 connected to the server; the at least two video devices include a first video device;
[0117] A first video recording device, configured to send a space allocation request to a server; the space allocation request includes the requested storage space.
[0118] The server is configured to, when determining that the storage space is smaller than the first shared storage space of the first video recording device in the shared storage pool, determine a second shared storage space in the shared storage pool that matches the storage space; the shared storage pool includes the shared storage spaces of each video recording device.
[0119] The server is further configured to send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to an occupied state.
[0120] The first video recording device is further configured to send the video data of the first video recording device to the second video recording device based on the identifier of the second video recording device.
[0121] The second video recording device is configured to store the video data of the first video recording device in the second shared storage space of the second video recording device. The video data storage system provided by this solution is not limited to multiple video recording devices of one user, but can also be between video recording devices of different users to mutually utilize the hard disk space. It is equivalent to each user adding their own storage media such as hard disks to the storage sharing pool, and when storing video data, storing the video data in the shared storage spaces of other video recording devices in the shared storage pool. Based on this, the video data can be stored on other hard disks or storage media in different locations, which improves the security of video storage to a certain extent. Compared with cloud storage, while realizing off-site storage of video data, it utilizes the hard disk space of other video recording devices, which can reduce the cost of off-site storage.
[0122] In an exemplary embodiment, the first video recording device is specifically configured to, when detecting a network disconnection from the second video recording device, store the video data of the first video recording device locally, and when detecting a network recovery from the second video recording device, send the video data stored locally to the second video recording device based on the identifier of the second video recording device.
[0123] Exemplarily, the first video recording device may first store the video data in the local storage space during the process of connecting to the storage space address, and after the connection to the storage space address is successful, synchronize the locally stored video data to the storage space corresponding to the storage space address. Based on this, it is possible to avoid the loss of video data before it is normally stored in the shared storage pool in the case of a poor network environment, thereby improving the security of video data storage.
[0124] Exemplarily, during the process of storing video data, if there are situations such as the failure of pushing video data or the offline of the second video device for storing video data, the first video device can store the video data in the local storage space and regularly connect to the storage space address of the second video device. After the connection is successful or the network improves, the locally stored video data is synchronized to the storage space corresponding to the storage space address. Based on this, the disconnection and retransmission mechanism can effectively store video data when the network environment is abnormal and then store the video data when the network is normal. Compared with the cloud storage of video data, it effectively solves the problem of video data loss during network anomalies and can improve the security of video data storage.
[0125] In the system provided in this embodiment, the server can be used to execute the method of any one of the method embodiments of video data storage. The specific implementation process and technical effects are similar to those in the method embodiments of video data storage. For details, reference can be made to the detailed introduction in the method embodiments of video data storage, which will not be elaborated here.
[0126] Figure 4 It is a schematic diagram of the physical structure of the electronic device provided by the embodiment of the present invention. As Figure 4 shown, the electronic device may include: a processor 410, a communication interface 420, a memory 430, and a communication bus 440. Among them, the processor 410, the communication interface 420, and the memory 430 complete mutual communication through the communication bus 440. The processor 410 can call the logical instructions in the memory 430 to execute the above-mentioned video data storage method, which includes: receiving a space allocation request sent by the first video device; the space allocation request includes the requested storage space; when it is determined that the storage space is smaller than the first shared storage space of the first video device in the shared storage pool, determining a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device; sending the identifier of the second video device corresponding to the second shared storage space to the first video device, and updating the storage space status of the second shared storage space of the second video device to the occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device.
[0127] In addition, when the logical instructions in the above-mentioned memory 430 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs.
[0128] On the other hand, the present invention also provides a computer program product. The computer program product includes a computer program that can be stored on a computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the above-mentioned video data storage method, which includes: receiving a space allocation request sent by a first video device; the space allocation request includes the requested storage space; in the case where it is determined that the storage space is less than the first shared storage space of the first video device in the shared storage pool, determining a second shared storage space in the shared storage pool that matches the storage space; the shared storage pool includes the shared storage spaces of each video device; sending the identifier of the second video device corresponding to the second shared storage space to the first video device, and updating the storage space status of the second shared storage space of the second video device to an occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device.
[0129] In yet another aspect, the present invention also provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, it is implemented to execute the video data storage method provided by the above-mentioned various methods. The method includes: receiving a space allocation request sent by a first video device; the space allocation request includes the requested storage space; in the case where it is determined that the storage space is less than the first shared storage space of the first video device in the shared storage pool, determining a second shared storage space in the shared storage pool that matches the storage space; the shared storage pool includes the shared storage spaces of each video device; sending the identifier of the second video device corresponding to the second shared storage space to the first video device, and updating the storage space status of the second shared storage space of the second video device to an occupied state. The identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device.
[0130] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated. The components shown as units may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative work.
[0131] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them. Although the present invention 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 described in the foregoing embodiments or equivalently replace some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for storing video data, characterized in that, comprising: receiving a space allocation request sent by a first video device; the space allocation request includes the requested storage space; when it is determined that the storage space is less than the first shared storage space of the first video device in the shared storage pool, determining a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video device; sending the identifier of the second video device corresponding to the second shared storage space to the first video device, and updating the storage space status of the second shared storage space of the second video device to an occupied state, and the identifier of the second video device is used to indicate that the video data of the first video device is stored in the second shared storage space of the second video device.
2. The method for storing video data according to claim 1, characterized in that, determining a second shared storage space matching the storage space in the shared storage pool includes: determining at least one candidate storage space with an idle storage space status in the shared storage pool; determining a second shared storage space matching the storage space from the at least one candidate storage space.
3. The method for storing video data according to claim 1, characterized in that, after updating the storage space status of the second shared storage space of the second video device to an occupied state, the method further includes: updating the first shared storage space in the shared storage pool based on the difference between the first shared storage space and the second shared storage space.
4. The method for storing video data according to claim 3, characterized in that, the method further includes: when receiving a termination storage request sent by the first video device, updating the storage space status of the second shared storage space to an idle state, and restoring the updated first shared storage space in the shared storage pool to the first shared storage space.
5. The method for storing video data according to any one of claims 1-4, characterized in that, the method further includes: acquiring the online duration of the first video device within a preset time period, the storage bandwidth of the first video device, and the transmission bandwidth of the first video device; determining a third shared storage space of the first video device based on the online duration, the storage bandwidth, the transmission bandwidth, and the initial shared storage space of the first video device in the shared storage pool, and updating the first shared storage space in the shared storage pool based on the third shared storage space.
6. The method for storing video data according to any one of claims 1-4, characterized in that, the method further includes: when it is determined that the first video device fails to store the video data of other video devices, prohibiting the storage of the video data of the first video device in the second shared storage space of the second video device.
7. A video data storage device, characterized in that, comprising: a receiving module, configured to receive a space allocation request sent by a first video device; The space allocation request includes the requested storage space. A determination module, configured to determine, when it is determined that the storage space is smaller than the first shared storage space of the first video recording device in the shared storage pool, a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video recording device. A storage module, configured to send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to an occupied state, where the identifier of the second video recording device is used to indicate that the video recording data of the first video recording device is stored in the second shared storage space of the second video recording device.
8. A video recording data storage system Characterized in that It includes a server and at least two video recording devices connected to the server; the at least two video recording devices include a first video recording device. The first video recording device is configured to send a space allocation request to the server; the space allocation request includes the requested storage space. The server is configured to determine, when it is determined that the storage space is smaller than the first shared storage space of the first video recording device in the shared storage pool, a second shared storage space matching the storage space in the shared storage pool; the shared storage pool includes the shared storage spaces of each video recording device. The server is further configured to send the identifier of the second video recording device corresponding to the second shared storage space to the first video recording device, and update the storage space status of the second shared storage space of the second video recording device to an occupied state. The first video recording device is further configured to send the video recording data of the first video recording device to the second video recording device based on the identifier of the second video recording device. The second video recording device is configured to store the video recording data of the first video recording device in the second shared storage space of the second video recording device.
9. The video recording data storage system according to claim 8 Characterized in that The first video recording device is specifically configured to store the video recording data of the first video recording device locally when detecting a network disconnection from the second video recording device, and send the video recording data stored locally to the second video recording device based on the identifier of the second video recording device when detecting a network recovery from the second video recording device.
10. An electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor Characterized in that When the processor executes the computer program, it implements the video recording data storage method according to any one of claims 1 to 6.