Media data storage method, reading method, solid state disk and network video recorder
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- ZHEJIANG UNIVIEW TECH CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-29
AI Technical Summary
In existing technologies, the execution of underlying storage media management logic by the NVR host increases the host's complexity, resulting in limited performance and causing excessive equipment load under heavy workloads, which is not conducive to business expansion.
Media data storage and underlying storage logic management functions are migrated to the main control unit of the solid-state drive. Logical storage space is divided by category tags, and data is decomposed in the cache area and mapped to the physical storage space in real time, reducing host complexity and load.
It reduces the hardware cost and complexity of the host, improves the scalability of the device, reduces the risk of data loss, and optimizes data access efficiency and storage management.
Smart Images

Figure CN122111307A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of hard disk storage technology, and in particular to a media data storage method, a reading method, a solid-state hard disk, and a network video recorder. Background Technology
[0002] As security products become increasingly popular in the consumer market, 1-bay / 2-bay Network Video Recorders (NVRs) (i.e., small-bay NVRs) are finding wider application in homes and small retail stores. Meanwhile, solid-state drives (SSDs) are also becoming a popular choice for video surveillance storage due to their rapid updates, excellent shock resistance, and high read / write speeds.
[0003] SSDs use flash memory to replace traditional hard disk drives (HDDs) for data storage. A dedicated controller replaces the read / write heads in HDDs to read, write, and manage the flash memory. Because SSDs lack the mechanical structure of HDDs, the read / write speeds of data stored in different locations on an SSD are essentially the same. They offer better random read / write performance and sequential read / write performance that is about ten times faster than HDDs. Theoretically, they can replace HDDs in small-bay NVRs.
[0004] New technologies such as Zoned Namespaces (ZNS), OpenChannel, and Multi-Streams primarily utilize the NVR host to execute low-level storage media management logic, which increases the complexity of the NVR host. Furthermore, small-bay NVRs, for the sake of low power consumption, mostly use embedded chips, which have limited performance. In situations with heavy workloads, they also have to execute too much low-level storage media management logic simultaneously, leading to an excessive load on the overall NVR device and hindering NVR service expansion. Summary of the Invention
[0005] This invention provides a media data storage method, a reading method, a solid-state drive, and a network video recorder to address the deficiencies in related technologies.
[0006] This invention provides a media data storage method applied to the main control unit of a solid-state drive, comprising: The system receives media data from a network camera sent by a host. The media data carries category tags, and based on the category tags, it determines the logical storage space allocated for the media data in the solid-state drive. The media data is written into the cache area of the logical storage space, and the media data is read from the cache area and disassembled to obtain the disassembly result. The disassembly result is then written into the data area of the logical storage space. The data stored in the cache area and the data area are mapped from the logical storage space to the physical storage space of the solid-state drive in real time.
[0007] According to a media data storage method provided by the present invention, the data area stores metadata of the disassembly result; The step of mapping the data written to the cache area and the data area from the logical storage space to the physical storage space of the solid-state drive in real time includes: The media data, the metadata, and the disassembly results are mapped from the logical storage space to different storage blocks in the physical storage space.
[0008] According to a media data storage method provided by the present invention, the step of reading the media data from the buffer and disassembling it to obtain the disassembly result includes: Based on the amount of media data, determine the size of the metadata of the disassembly result; When the size of the metadata is equal to the capacity of a single storage block in the physical storage space, the media data is read from the cache and disassembled to obtain the disassembly result.
[0009] According to a media data storage method provided by the present invention, the step of receiving media data from a network camera includes: The host receives a storage space request from the network camera; the storage space request is determined by the host based on the service type of the network camera. Based on the storage space application, logical storage space is allocated for the media data.
[0010] According to a media data storage method provided by the present invention, the step of allocating logical storage space for the media data based on the storage space application includes: Send the request feedback information to the host; The application feedback information includes the internal distribution information of the logical storage space.
[0011] This invention also provides a media data reading method, applied to the main control unit of a solid-state drive, comprising: Receive media data read instructions sent by the host; Based on the media data reading instruction, the target media data is located in the logical storage space of the solid-state drive, and based on the mapping relationship between the logical storage space and the physical storage space of the solid-state drive, the target media data is read from the physical storage space and fed back to the host. The target media data is stored in the physical storage space based on the media data storage method described above.
[0012] According to a media data reading method provided by the present invention, the step of feeding back the target media data to the host includes: The target media data is packaged and sent to the host. Alternatively, the target media data and status information can be sent to the host. The host is used to package the target media data based on the status information.
[0013] The present invention also provides a solid-state drive, comprising: a main control unit, a logical storage space, and a physical storage space, wherein there is a mapping relationship between the logical storage space and the physical storage space; the main control unit is used to execute the above-described media data storage method, or to execute the above-described media data reading method; The logical storage space includes a cache area and a data area; The cache area is used to store media data from the network camera; The data area is used to store the disassembly results of the media data.
[0014] According to a solid-state drive provided by the present invention, the cache area is configured in SLC working mode.
[0015] The present invention also provides a network video recorder, comprising: a host and the aforementioned solid-state hard drive; The host is used to receive media data from the network camera, label the media data to obtain category tags for the media data, and send the media data carrying the category tags to the solid-state drive; The solid-state drive is used to store the received media data.
[0016] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement a media data storage method or a media data reading method as described above.
[0017] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a media data storage method or a media data reading method as described above.
[0018] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements a media data storage method or a media data reading method as described above.
[0019] The media data storage method, reading method, solid-state drive (SSD), and network video recorder provided by this invention only require the host computer to have the function of labeling and classifying media data. Data fragmentation and underlying storage logic management are all migrated to the SSD's main control unit, thus reducing the host computer's complexity. Implementing data fragmentation and underlying storage logic management on the host computer requires a sufficiently large amount of Dynamic Random Access Memory (DRAM) space, leading to a significant increase in hardware costs. Implementing these functions on an SSD can greatly reduce costs. Moreover, even under heavy workloads, the host computer does not need to perform excessive operations; instead, operations are performed directly through the SSD's main control unit, thereby reducing the host computer's load and facilitating service expansion. Furthermore, since SSDs have a cache area in their logical storage space, which is directly mapped to the storage blocks in the underlying flash memory, and taking advantage of the fact that flash data is not lost when power is off, multiple media data can be written to the cache area first when the media data is out of order. After a certain amount of data has accumulated, it can be sorted out. This avoids the risk of data loss when the data to be cached is placed in DRAM during out-of-order sorting on the NVR host, which would result in data loss if the NVR is temporarily powered off. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating the media data storage method provided by the present invention.
[0022] Figure 2 This is a network diagram of the NVR in the media data storage method provided by the present invention.
[0023] Figure 3This is a schematic diagram of the logical storage space allocated by the SSD's main control unit to the IPC in the media data storage method provided by this invention.
[0024] Figure 4 This is one of the data flow diagrams in the media data storage method provided by the present invention.
[0025] Figure 5 This is the second schematic diagram of the data flow in the media data storage method provided by the present invention.
[0026] Figure 6 This is a schematic diagram of the structure of the SSD master control unit in the media data storage method provided by the present invention.
[0027] Figure 7 This is the third schematic diagram of the data flow in the media data storage method provided by this invention.
[0028] Figure 8 This is a flowchart illustrating the media data reading method provided by the present invention.
[0029] Figure 9 This is a schematic diagram of the data flow in the media data reading method provided by the present invention.
[0030] Figure 10 This is a schematic diagram of the solid-state drive provided by the present invention.
[0031] Figure 11 This is a schematic diagram of the network video recorder provided by the present invention.
[0032] Figure 12 This is a schematic diagram of the structure of the media data storage device provided by the present invention.
[0033] Figure 13 This is a schematic diagram of the media data reading device provided by the present invention.
[0034] Figure 14 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0035] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0036] Because existing NVRs utilize the NVR host to execute underlying storage media management logic, this not only increases the complexity of the NVR host but also limits its performance due to the embedded chip nature of the NVR host. Furthermore, under heavy workloads, this can lead to excessive load on the overall NVR device, hindering NVR service expansion. Therefore, this invention provides a media data storage method.
[0037] Figure 1 This is a flowchart illustrating a media data storage method provided in an embodiment of the present invention, such as... Figure 1 As shown, this method is applied to the controller unit of a solid-state drive, including: S11, Receive media data from the network camera sent by the host, wherein the media data carries a category tag, and determine the logical storage space allocated for the media data in the solid-state drive based on the category tag; S12, write the media data into the cache area of the logical storage space, read the media data from the cache area and disassemble it to obtain the disassembly result, and write the disassembly result into the data area of the logical storage space; S13, the data stored in the cache area and the data area are mapped from the logical storage space to the physical storage space of the solid-state drive in real time.
[0038] Specifically, the media data storage method provided in this embodiment of the invention uses an SSD main control unit as its execution entity, which can be configured within an electronic device. This electronic device can be an NVR, using the SSD as a storage medium to store media data from a network camera (IP Camera, IPC).
[0039] An SSD can include a controller unit and storage space. The storage space can include logical storage space and physical storage space. Logical storage space is a contiguous, linear storage address space that the SSD presents to the NVR host. It hides the complex physical structure and data management methods inside the SSD, allowing the NVR host to access the SSD seamlessly, just like accessing a traditional hard drive.
[0040] Logical storage space can include multiple logical blocks, which are the smallest addressable units that the SSD presents to the NVR host. The size of a logical block can be configured according to the SSD's design.
[0041] Physical storage space can include a flash memory array consisting of multiple flash memory modules, each of which comprises multiple storage blocks. Each storage block is used to store the data that has been written to it.
[0042] The following example uses an NVR (Network Video Recorder). This NVR can connect to one or more IPCs (Internet Protocol Cameras). Each IPC can acquire media data and send it to the SSD's main control unit. The media data acquired by each IPC can be monitoring data. The specific categories of this media data can be audio, video, images, etc. The media data acquired by different IPCs can be the same or different, depending on the type of service processed by the IPC.
[0043] After receiving media data from an IPC, the NVR host can label the media data to obtain a category tag. This category tag can include the IPC to which the media data belongs, the specific category of the media data, and the data stream category. The data stream category can be a main stream or a secondary stream. The main stream rate can be 2Mbps, and the secondary stream rate can be 512Kbps.
[0044] Figure 2 This is a network topology diagram for an NVR. Figure 2 In this setup, the NVR can connect to two IPCs, designated IPC-A and IPC-B. Media data acquired by both IPCs is transmitted as media streams via the network link to the NVR host, and then from the NVR host to the SSD via a data cable. Stream A is the media stream from IPC-A, and Stream B is the media stream from IPC-B. Figure 2 The image only shows the structure of an SSD, which includes one controller unit and nine flash memory modules, and is not intended to limit the structure of an SSD.
[0045] Subsequently, the NVR host can send media data carrying category tags to the SSD, and the SSD's main control unit executes step S11 to receive the media data carrying category tags from the IPC sent by the host. It should be noted that the host is not limited to the NVR host, but can also be the host of other electronic devices configured with SSDs; no specific limitation is made here.
[0046] Subsequently, the main control unit uses category tags to determine the logical storage space allocated for media data within the SSD based on the data storage requirements corresponding to those category tags. For example, IPC-A and IPC-B each need to store 7 days and 15 days of recordings, respectively. IPC-A needs to store both the main stream (2Mbps) and the secondary stream (512Kbps), while IPC-B needs to store both the main stream (1Mbps) and alarm snapshot images.
[0047] like Figure 3As shown, the SSD controller can allocate logical storage space A and logical storage space B to the main stream and secondary stream of IPC-A, respectively. The storage capacity of logical storage space A can be 140G, and the storage capacity of logical storage space B can be 35G. Logical storage space C and logical storage space D are allocated to the main stream and images of IPC-B, respectively. The storage capacity of logical storage space C can be 140G, and the storage capacity of logical storage space D can be 10G.
[0048] Each logical storage space includes a cache and a data area, which occupy different logical blocks. The cache can be configured in SLC mode according to actual business needs. Compared with TLC or QLC mode, the available capacity of the cache is smaller, but the read and write speed and lifespan are improved.
[0049] The data area consists of one or more fixed-size vectors, each of which can correspond to one or more logical blocks. The buffer area can be used to store received media data, and the vectors can be used to store the decomposition results obtained from disassembling the media data. Figure 3 The diagram only shows the structure of each logical storage space, comprising one cache area and three data areas; it is not intended to define the structure of each logical storage space. Furthermore, Figure 3 The example shown only illustrates the case where each data area includes a container area.
[0050] Subsequently, the main control unit executes step S12, writing the media data into the buffer of the logical storage space. The buffer can be a first-in, first-out queue. For example... Figure 4 As shown, the media data acquired by IPC-A can include mainstream and secondary streams. These are labeled by the NVR host, resulting in media data carrying category tags that can include both IPC-A audio / video mainstream and IPC-A audio / video secondary streams. The main control unit can write the IPC-A audio / video mainstream into the buffer of logical storage space A, and write the IPC-A audio / video secondary stream into the buffer of logical storage space B.
[0051] Understandably, the main control unit uses the category tags of media data to determine the logical storage space allocated for media data within the SSD, and writes different categories of media data into the cache of different logical storage spaces. This allows for more convenient management and organization of different categories of media data according to different business needs, resolution requirements, and storage cycle requirements. For example, mainstream IPC-A audio and video streams and secondary IPC-A audio and video streams may have different importance, access frequencies, or storage requirements. Storing them separately can optimize SSD utilization and improve the efficiency of media data access.
[0052] Furthermore, storing different categories of media data separately helps the control unit better optimize data access paths, reduce data access latency, and improve SSD performance. In multi-user or multi-tasking environments, it may be necessary to access different types of media data simultaneously. By storing data separately in different logical storage spaces, concurrent access can be supported, reducing data access conflicts and waiting times, and improving SSD response speed and throughput. When deleting media data, it can avoid physical storage fragmentation problems caused by storing different categories of media data in the same logical storage space.
[0053] Furthermore, storing different categories of media data separately can improve data security and reliability. For example, if a logical storage space fails or is attacked, only the data stored in that logical storage space will be affected, while data stored in other logical storage spaces will remain safe. This reduces the risk of data loss or corruption and protects data integrity.
[0054] Storing different categories of media data separately also facilitates data backup and recovery. If it is necessary to recover a specific category of media data, only the corresponding logical storage space can be recovered, without having to recover the entire SSD, thus saving time and resources.
[0055] During the process of writing media data to the buffer, the media data can be read from the buffer and disassembled to obtain the disassembly results.
[0056] Media data can be transmitted in the form of data packets; therefore, the process of disassembling media data can be considered as disassembling data packets. The disassembly result can include the individual data units obtained from breaking down the media data.
[0057] For example, if the media data is video, the breakdown result can include multiple video frame groups, each video frame group being a data unit, which can include core frames (intra-coded frames, I-frames), predicted frames (P-frames), and bidirectional predicted frames (B-frames). If the media data is audio, the breakdown result can be multiple audio segments, each audio segment being a data unit. If the media data is images, the breakdown result can be individual images, each image being a data unit, which can be equivalent to an I-frame, a P-frame, or a B-frame in a video frame group.
[0058] Afterward, the disassembly results can be written to the data area of the logical storage space. Within the SSD's logical storage space, each data unit from the disassembly results can occupy a different container area within the data area. Therefore, before writing the disassembly results to the data area of the logical storage space, each data unit needs to be packaged separately according to a private container format, and the packaged results are written to the corresponding container area within the data area of the logical storage space. For example... Figure 5 As shown, taking video as an example of media data, the decomposition result is multiple video frame groups consisting of I-frames, P-frames and B-frames. The main control unit packages each video frame group according to a private container format and writes it into a container area.
[0059] Finally, step S13 is executed. Logical storage space is an abstract concept relative to physical storage space; it refers to a logical structure created by the SSD for storing media data. Data stored in the cache and data areas of the logical storage space is organized into files or records and stored in specific directories or tables for easier and more efficient data management and access. However, the physical storage space of the SSD is the actual space where data is stored.
[0060] Therefore, it is necessary to map the data stored in the cache and data areas from the logical storage space to the physical storage space of the SSD in real time. The SSD's controller unit can be pre-configured with the mapping relationship between the SSD's logical storage space and physical storage space. Through this mapping relationship, the data stored in the cache and data areas can be mapped to the physical storage space for storage in real time.
[0061] Data stored in the cache and data areas can be mapped to the same storage block in the physical storage space, or they can be mapped to different storage blocks in the physical storage space, which makes it easier to manage different types of data.
[0062] It is understandable that, such as Figure 6 As shown, the SSD's main control unit may include a media data processing engine and a flash array management unit. The media data processing engine can perform operations such as sorting, disassembling, reassembling, and packaging media data.
[0063] Since the physical storage space includes a flash array composed of multiple flashes, the flash array management unit can use the data storage requirements corresponding to the category tags of the media data to evenly map the logical storage space to each flash, thereby realizing operations such as dividing the logical storage space of the SSD and mapping between the logical storage space and the physical storage space of the SSD.
[0064] Therefore, in this embodiment of the invention, the main function of the NVR host is to receive corresponding media data from different IPCs, then assign different category tags to the media data of each IPC, and finally transmit the media data carrying the category tags to the SSD. The NVR host does not need to perform many decoding or packaging operations into proprietary container formats.
[0065] The main function of the SSD's control unit is to break down the media data transmitted from the NVR host, distinguish the media data according to different category tags, and save it to the corresponding logical and physical storage spaces for subsequent processing by the NVR host or itself. The SSD's control unit integrates the ability to process audio, video, and image media data in monitoring services, such as data reordering, packet assembly, and packaging into proprietary container formats.
[0066] The media data storage method provided in this embodiment of the invention is applied to the main control unit of a solid-state drive (SSD). First, it receives media data from a network camera sent by a host. The media data carries category tags, and based on these tags, a logical storage space is determined within the SSD for the media data. Then, the media data is written to the cache area of the logical storage space, and the media data is read from the cache area and disassembled to obtain the disassembly results, which are then written to the data area of the logical storage space. Finally, the data stored in the cache area and the data area is mapped from the logical storage space to the physical storage space of the SSD in real time. This method only requires the host to have the function of labeling and determining category tags for the media data, while migrating functions such as data disassembly and underlying storage logic management to the main control unit of the SSD, thus reducing the complexity of the host. Implementing data disassembly and underlying storage logic management on the host requires a sufficiently large amount of Dynamic Random Access Memory (DRAM) memory, which significantly increases hardware costs. Implementing these functions on an SSD can greatly reduce costs. Moreover, even under heavy workloads, the host doesn't need to perform excessive operations; instead, it operates directly through the SSD's controller unit, reducing the host's load and facilitating business expansion. Furthermore, since SSDs have cache areas within their logical storage space, directly mapped to the underlying flash memory blocks, leveraging the data retention advantage of flash memory, multiple media data points can be written to the cache even when out-of-order data is present. Once a certain amount of data has accumulated, it can be reorganized. This avoids the risk of data loss due to data being stored in DRAM during out-of-order reorganization on the NVR host, especially in the event of a temporary power outage.
[0067] Due to the characteristics of flash memory, data stored within a single memory block cannot be modified in situ; it must be erased before being written. Currently, the erase / write cycle life of a 3-bit memory cell (trinary-level cell, TLC) is approximately 3000 cycles, and that of a 4-bit memory cell (quad-level cell, QLC) is approximately 1500 cycles.
[0068] Every write operation to an SSD reduces the lifespan of its internal storage blocks. Furthermore, when a single storage block is not full, any subsequent modifications or appends to the data stored in that block require reading the data from that block, modifying it, and then rewriting it. This leads to write amplification factor (WAF), meaning that the amount of data actually written to the storage block is greater than the amount of data written by the host.
[0069] In NVR media data writing scenarios, since small-bay NVRs typically connect 4 to 8 network cameras with bitrates of 1 to 2 Mbps, assuming a single NVR simultaneously connects 8 network cameras with a bitrate of 2 Mbps, the amount of data generated per second is 8 * 2 Mbps / 8 = 2 MB. This amount of data is insufficient to fill a single solid-state drive (SSD) block (a single QLC block is typically tens to hundreds of MB). Furthermore, monitoring applications require data to be written to the storage block in real-time to prevent data loss. This process leads to repeated modifications and writes to a single SSD block before it is full, resulting in a significantly shorter lifespan compared to a scenario where the block is filled in one go. The SSD may fail before the warranty expires, causing losses.
[0070] Therefore, based on the above embodiments, the data area stores metadata of the disassembly results; the step of mapping the data written in the cache area and the data area from the logical storage space to the physical storage space of the solid-state drive in real time includes: The media data, the metadata, and the disassembly results are mapped from the logical storage space to different storage blocks in the physical storage space.
[0071] Specifically, when writing the disassembly results to the data area of the SSD's logical storage space, metadata for the disassembly results is automatically generated. This metadata can include the metadata of each data unit, and the metadata of each data unit is appended to the beginning of the data unit and stored together with it. Here, the metadata of each data unit can include the size of each type of data within that data unit, its specific location within the corresponding container area, etc.
[0072] Therefore, the data stored in the logical storage space includes media data written to the cache, disassembly results written to each container area in the data area, and their metadata. The media data written to the cache and the metadata of the disassembly results are both frequently updated "hot" data, while the disassembly results written to each container area are "cold" data with a lower update frequency. Therefore, the SSD's controller unit can separate hot and cold data in the logical storage space, mapping media data, metadata, and disassembly results from the logical storage space to different storage blocks in the physical storage space. These different storage blocks in the physical storage space store the media data, metadata, and disassembly results separately, thus achieving separate storage of hot and cold data. This facilitates the management of different types of data and provides a physical structure to reduce write amplification.
[0073] like Figure 7 As shown, the media data written to the buffer area is mapped to storage block 1 in the physical storage space for storage, the metadata written to each container area in the data area is written to storage block 2 for storage, and the disassembly results written to each container area in the data area are written to storage block 3 for storage.
[0074] Based on the above embodiments, the step of reading the media data from the cache and disassembling it to obtain the disassembly result includes: Based on the amount of media data, determine the size of the metadata of the disassembly result; When the size of the metadata is equal to the capacity of a single storage block in the physical storage space, the media data is read from the cache and disassembled to obtain the disassembly result.
[0075] Specifically, in this embodiment of the invention, during the process of writing media data into the buffer area of the logical storage space, the media data can be read from the end of the buffer area in real time for disassembly to obtain the disassembly result, and the disassembly result can be written into the data area of the logical storage space. Alternatively, the size of the metadata of the disassembly result can be determined first using the amount of media data. The amount of media data can be represented by the number of data units in the media data. For example, if the media data is video and each data unit in the media data is a group of video frames, then the amount of media data can be represented by the amount of data in the group of video frames in the media data.
[0076] Since the metadata of the disassembly result includes the metadata of each data unit, the size of the metadata of the disassembly result can be the sum of the metadata sizes of each data unit. Therefore, by using the number of each data unit in the media data, the sum of the metadata sizes of each data unit can be determined, i.e., the size of the metadata of the disassembly result.
[0077] Subsequently, it can be determined whether the metadata size of the disassembly result is equal to the capacity of a single storage block in the physical storage space. As media data is continuously written into the buffer, the metadata size of the disassembly result continues to increase. When the metadata size of the disassembly result is equal to the capacity of a single storage block in the physical storage space, media data can be read from the end of the buffer for disassembly to obtain the disassembly result.
[0078] Afterwards, the disassembly results can be written to the data area of the logical storage space, and the metadata and disassembly results stored in the cache area and data area can be mapped from the logical storage space to different storage blocks in the physical storage space of the SSD in real time.
[0079] Understandably, before hot and cold data separation, after each data unit was written, its metadata needed to be determined. However, the characteristics of flash memory dictate that a single storage block can only be erased before being written, which would trigger the synchronous migration of other non-metadata items on the same storage block, leading to write amplification. After hot and cold data separation, and once the accumulated data units in the cache reach the capacity of a single storage block, the media data in the cache is read and broken down. Based on the breakdown results, the storage block storing metadata in the physical storage space is updated, thereby reducing write amplification and extending the lifespan of the storage blocks.
[0080] Based on the above embodiments, the step of receiving media data from the network camera includes: The host receives a storage space request from the network camera; the storage space request is determined by the host based on the service type of the network camera. Based on the storage space application, logical storage space is allocated for the media data.
[0081] Specifically, the process by which the SSD's master control unit allocates logical storage space for the media data of each IPC is a configuration process. Before receiving the media data from the IPC, the NVR host can send a storage space request to the SSD's master control unit.
[0082] The storage space request can be determined by the NVR host based on the service type of the IPC that acquires media data. There can be multiple service types for each IPC, each corresponding to a category label. For example, IPC-A's service type includes acquiring mainstream audio / video streams and secondary audio / video streams, while IPC-B's service type includes acquiring mainstream audio / video streams and images. Therefore, the storage space request can correspond to the IPC and its service type, and the number of storage space requests can be the sum of the number of IPCs and the number of service types for each IPC.
[0083] The storage space request may include the required storage capacity. For example, the main audio and video stream of IPC-A requires 140G of storage capacity, the auxiliary audio and video stream of IPC-A requires 35G of storage capacity, the main audio and video stream of IPC-B requires 140G of storage capacity, and the images of IPC-B require 10G of storage capacity.
[0084] Subsequently, the control unit can utilize storage space allocation to divide different logical storage spaces for media data carrying different category tags. This not only allows for the management and organization of different categories of media data according to varying business needs, media data resolution requirements, and storage cycle requirements, but also helps the control unit better optimize data access paths, reduce data access latency, and improve SSD performance. Furthermore, when deleting media data, it avoids the physical storage fragmentation problem caused by storing different categories of media data in the same logical storage space.
[0085] Based on the above embodiments, the step of allocating logical storage space for the media data based on the storage space application includes: Send the request feedback information to the host; The application feedback information includes the internal distribution information of the logical storage space.
[0086] Specifically, after the main control unit partitions the logical storage space, it can send a request feedback information to the host. This request feedback information may include the internal distribution information of the logical storage space, which may include information such as the cache area, cache area size and location, and each container area in the data area, as well as the size and location of each container area.
[0087] After receiving the request feedback information, the NVR host becomes visible to the internal distribution information of the SSD's logical storage space, allowing the NVR host to promptly determine the storage location of media data within the SSD. Consequently, when the client needs to read data, the NVR host can directly read the fragmented data from the data area without utilizing the SSD's main control unit's data reading and packaging capabilities. It can then package the data according to the client's required data format and send it to the client, improving data reading efficiency and reducing the resources consumed during data reading.
[0088] Based on the above embodiments, such as Figure 8 As shown, this embodiment of the invention also provides a media data reading method, which is applied to the main control unit of a solid-state drive, including: S21, Receive media data reading command sent by host; S22, based on the media data reading instruction, locate the target media data in the logical storage space of the solid-state drive, and based on the mapping relationship between the logical storage space and the physical storage space of the solid-state drive, read the target media data from the physical storage space, and feed the target media data back to the host; The target media data is stored in the physical storage space based on the media data storage methods provided in the above embodiments.
[0089] Specifically, the media data reading method provided in this embodiment of the invention uses an SSD master control unit as the execution entity, which can be configured within an electronic device. This electronic device can be an NVR, using the SSD as a storage medium to read media data from IPCs stored therein. The NVR host can receive read requests sent by clients, and upon receiving the read request, the NVR host sends a media data read instruction to the SSD master control unit.
[0090] First, the main control unit executes step S21, receiving a media data read instruction sent by the host. This media data instruction may carry read conditions, and the format of these read conditions may be IPC-A: audio / video:mainstream:start time:end time.
[0091] Subsequently, the main control unit executes step S22, using media data read instructions to locate the target media data in the logical storage space of the SSD. Based on the mapping relationship between the logical and physical storage spaces of the SSD, it reads the target media data from the physical storage space and packages the target media data to send back to the NVR host. After receiving the target media data, the NVR host can perform simple processing on the target media data or send it directly to the client via network protocol without processing.
[0092] like Figure 9 As shown, the client sends a read request for the IPC-A audio and video main stream to the NVR host. After receiving the read request, the NVR host sends a media data read instruction to the SSD's main control unit. After receiving the media data read instruction, the main control unit reads the IPC-A audio and video main stream packets from logical storage space A and forwards them to the client through the host.
[0093] In this embodiment of the invention, the target media data read from the physical storage space is stored using the media data storage methods provided in the above embodiments. Therefore, the SSD's main control unit can read the media data, reducing the strong dependence on host functions when reading media data.
[0094] Based on the above embodiments, the step of feeding back the target media data to the host includes: The target media data is packaged and sent to the host. Alternatively, the target media data and status information can be sent to the host. The host is used to package the target media data based on the status information.
[0095] Specifically, when the SSD's main control unit feeds back the target media data to the host, it can either package the target media data and send it to the NVR host according to its own functions, or, if the data processing pressure is too high or data packaging cannot be achieved, directly send the target media data and status information to the NVR host. Subsequently, after receiving the target media data and status information, the NVR host packages the target media data according to its own status and sends it to the client. Here, the status information received by the NVR host is used to instruct the NVR host to package the target media data, and the NVR host's own status is used to determine whether the NVR host has the capability to package the target media data.
[0096] In this embodiment of the invention, when the SSD's main control unit is capable, the target media data is packaged first through the SSD's main control unit. When the SSD's main control unit is not capable, the target media data and status information can be directly sent to the NVR host, and the target media data can be packaged through the NVR host. This can minimize the pressure on the NVR host.
[0097] Based on the above embodiments, such as Figure 10 As shown, this embodiment of the invention also provides a solid-state drive, including: a main control unit 101, a logical storage space 102 and a physical storage space 103, wherein there is a mapping relationship between the logical storage space 102 and the physical storage space 103; the main control unit 101 is used to execute the media data storage method provided in the above embodiments, or to execute the media data reading method provided in the above embodiments.
[0098] Logical storage space 102 includes a cache area and a data area; The buffer is used to store media data from the network camera; The data area is used to store the disassembly results of the media data.
[0099] The SSD provided in this embodiment of the invention is deeply adapted to monitoring business scenarios compared to traditional SSDs. It can not only distribute the business processing pressure of the NVR host, but also, because it integrates the data understanding capabilities of monitoring business, it can place the data in the underlying flash array more reasonably according to the characteristics of different network cameras and different data types, effectively improving the usable life of the SSD.
[0100] Based on the above embodiments, the cache is configured in SLC working mode. Compared with TLC or QLC working mode, the available capacity of the cache is smaller, but the read and write speed and lifespan are improved.
[0101] Based on the above embodiments, such as Figure 11 As shown, this embodiment of the invention also provides a network video recorder, including: a host 111, and a solid-state drive 112 provided in the above embodiments.
[0102] Host 111 receives media data from network cameras, labels the media data to obtain category tags, and sends the media data carrying category tags to solid-state drive 112. Solid-state drive 112 is used to store the received media data.
[0103] The NVR provided in this embodiment of the invention uses an SSD as a storage medium to store media data read from the IPC. Due to the special internal structure of the SSD, it has a long service life, thereby extending the usage time of the NVR and improving its battery life.
[0104] like Figure 12 As shown, based on the above embodiments, this embodiment of the invention provides a media data storage device applied to the main control unit of a solid-state drive, comprising: The space determination module 121 is used to receive media data from the network camera sent by the host, wherein the media data carries a category tag, and determines the logical storage space allocated in the solid-state drive for the media data based on the category tag; Data processing module 122 is used to write the media data into the cache area of the logical storage space, read the media data from the cache area and disassemble it to obtain the disassembly result, and write the disassembly result into the data area of the logical storage space; The data mapping module 123 is used to map the data stored in the cache area and the data area from the logical storage space to the physical storage space of the solid-state drive in real time.
[0105] Based on the above embodiments, the data area stores the metadata of the disassembly results; The data mapping module is specifically used for: The media data, the metadata, and the disassembly results are mapped from the logical storage space to different storage blocks in the physical storage space.
[0106] Based on the above embodiments, the data processing module is specifically used for: Based on the amount of media data, determine the size of the metadata of the disassembly result; When the size of the metadata is equal to the capacity of a single storage block in the physical storage space, the media data is read from the cache and disassembled to obtain the disassembly result.
[0107] Based on the above embodiments, a space partitioning module is also included, used for: The host receives a storage space request from the network camera; the storage space request is determined by the host based on the service type of the network camera. Based on the storage space application, logical storage space is allocated for the media data.
[0108] Based on the above embodiments, a feedback module is also included, used for: Send the request feedback information to the host; The application feedback information includes the internal distribution information of the logical storage space.
[0109] Specifically, the functions of each module in the media data storage device provided in this embodiment of the invention correspond one-to-one with the operation flow of each step in the above method-like embodiments, and the achieved effects are also the same. For details, please refer to the above embodiments, and this will not be repeated in this embodiment of the invention.
[0110] like Figure 13 As shown, based on the above embodiments, this embodiment of the invention provides a media data reading device applied to the main control unit of a solid-state drive, comprising: The instruction receiving module 131 is used to receive media data reading instructions sent by the host; The data reading module 132 is used to locate target media data in the logical storage space of the solid-state drive based on the media data reading instruction, and read the target media data from the physical storage space based on the mapping relationship between the logical storage space and the physical storage space of the solid-state drive, and feed the target media data back to the host. The target media data is stored in the physical storage space based on the media data storage methods provided in the above embodiments.
[0111] Based on the above embodiments, the step of feeding back the target media data to the host includes: The target media data is packaged and sent to the host. Alternatively, the target media data and status information can be sent to the host. The host is used to package the target media data based on the status information.
[0112] Specifically, the functions of each module in the media data reading device provided in this embodiment of the invention correspond one-to-one with the operation flow of each step in the above method-like embodiments, and the achieved effects are also the same. For details, please refer to the above embodiments, and this will not be repeated in this embodiment of the invention.
[0113] Figure 14 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 14 As shown, the electronic device may include a processor 1410, a communications interface 1420, a memory 1430, and a communication bus 1440, wherein the processor 1410, the communications interface 1420, and the memory 1430 communicate with each other via the communication bus 1440. The processor 1410 may call logical instructions in the memory 1430 to execute the media data storage method or the media data reading method provided in the above embodiments.
[0114] Furthermore, the logical instructions in the aforementioned memory 1430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to related technologies, or a portion of the 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 to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0115] On the other hand, the present invention also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the media data storage method or the media data reading method provided in the above embodiments.
[0116] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the media data storage method or the media data reading method provided in the above embodiments.
[0117] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0118] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the parts that contribute to the related technology, can be embodied in the form of software products. This 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 to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0119] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions 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 media data storage method, characterized in that, The controller unit used in solid-state drives includes: The system receives media data from a network camera sent by a host. The media data carries category tags, and based on the category tags, it determines the logical storage space allocated for the media data in the solid-state drive. The media data is written into the cache area of the logical storage space, and the media data is read from the cache area and disassembled to obtain the disassembly result. The disassembly result is then written into the data area of the logical storage space. The data stored in the cache area and the data area are mapped from the logical storage space to the physical storage space of the solid-state drive in real time.
2. The media data storage method according to claim 1, characterized in that, The data area stores the metadata of the disassembly results; The step of mapping the data written to the cache area and the data area from the logical storage space to the physical storage space of the solid-state drive in real time includes: The media data, the metadata, and the disassembly results are mapped from the logical storage space to different storage blocks in the physical storage space.
3. The media data storage method according to claim 1, characterized in that, The step of reading the media data from the cache and disassembling it to obtain the disassembly result includes: Based on the amount of media data, determine the size of the metadata of the disassembly result; When the size of the metadata is equal to the capacity of a single storage block in the physical storage space, the media data is read from the cache and disassembled to obtain the disassembly result.
4. The media data storage method according to any one of claims 1-3, characterized in that, The media data from the network camera sent by the receiving host previously included: The host receives a storage space request from the network camera; the storage space request is determined by the host based on the service type of the network camera. Based on the storage space application, logical storage space is allocated for the media data.
5. The media data storage method according to claim 4, characterized in that, The process of allocating logical storage space for the media data based on the storage space application includes: Send the request feedback information to the host; The application feedback information includes the internal distribution information of the logical storage space.
6. A method for reading media data, characterized in that, The controller unit used in solid-state drives includes: Receive media data read instructions sent by the host; Based on the media data reading instruction, the target media data is located in the logical storage space of the solid-state drive, and based on the mapping relationship between the logical storage space and the physical storage space of the solid-state drive, the target media data is read from the physical storage space and fed back to the host. The target media data is stored in the physical storage space based on the media data storage method as described in any one of claims 1-5.
7. A solid-state drive, characterized in that, include: The main control unit, logical storage space, and physical storage space have a mapping relationship between the logical storage space and the physical storage space. The main control unit is used to execute the media data storage method as described in any one of claims 1-5, or to execute the media data reading method as described in claim 6; The logical storage space includes a cache area and a data area; The cache area is used to store media data from the network camera; The data area is used to store the disassembly results of the media data.
8. A network video recorder, characterized in that, Includes: a host computer, and a solid-state drive as described in claim 7; The host is used to receive media data from the network camera, label the media data to obtain category tags for the media data, and send the media data carrying the category tags to the solid-state drive; The solid-state drive is used to store the received media data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the media data storage method as described in any one of claims 1-5, or the media data reading method as described in claim 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the media data storage method as described in any one of claims 1-5, or the media data reading method as described in claim 6.