Storage system, cache scheduling method and device, and video parameter adjusting method and device
By employing a multi-level caching and dynamic video parameter adjustment scheme, the problem of interrupted video recording by the camera was solved, enabling reliable data storage and real-time backup, and improving system stability and throughput performance.
Patent Information
- Application Number
- CN202511308268.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-12
- Publication Date
- 2025-11-21
- Estimated Expiration
- 2045-09-12
AI Technical Summary
Existing cameras are prone to video recording interruptions due to low-quality memory cards and fixed cache designs, which affects the user experience and threatens data security.
It adopts a multi-level caching structure, including a first-level caching unit, a second-level caching unit, and a cloud caching unit. The scheduling unit dynamically allocates video frames to available caching units and monitors the write time of the memory in real time, dynamically adjusting video parameters to adapt to storage pressure.
It effectively alleviates the problem of frame loss and recording interruption caused by instantaneous high concurrency and network fluctuations, realizes reliable data storage and real-time backup, and improves the stability and throughput performance of the system.
Smart Images

Figure CN120812200B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer, in particular to the field of video stream processing, which can be applied to the application scenario of video acquisition, and specifically relates to a storage system, a cache scheduling method and device, and a video parameter adjusting method and device. BACKGROUND
[0002] In modern life, cameras have become an important tool for recording beautiful moments and are widely used in family gatherings, travel expeditions, and work meetings. However, low-quality data storage cards often cannot guarantee stability, and their broken recording problems often cause video recording to be interrupted, which may result in important video loss or data security risks, affecting the user experience and threatening data security. SUMMARY
[0003] The present disclosure provides a storage system, a cache scheduling method and device, and a video parameter adjusting method and device.
[0004] According to a first aspect of the present disclosure, a storage system is provided, comprising a video acquisition unit, a scheduling unit, a cache array, a storage writing unit, and a storage; the cache array comprises a first-level cache unit, a second-level cache unit, and a cloud cache unit; the video acquisition unit is in communication connection with the scheduling unit, the first-level cache unit, the second-level cache unit, and the cloud cache unit, respectively, and is configured to: acquire a current video frame according to a video parameter sent by the scheduling unit; sequentially traverse the first-level cache unit, the second-level cache unit, and the cloud cache unit according to the current video frame to determine an available cache unit; send the current video frame to the available cache unit and send corresponding information of the available cache unit and a time sequence number of the current video frame to the scheduling unit; the storage writing unit is in communication connection with the first-level cache unit, the second-level cache unit, the cloud cache unit, the scheduling unit, and the storage, respectively, and is configured to: determine a time sequence number of a video frame to be written; send a cache unit search request to the scheduling unit according to the time sequence number of the video frame to be written; receive cache unit indication information sent by the scheduling unit to determine a cache unit corresponding to the time sequence number of the video frame to be written; send a video frame pulling request to the cache unit corresponding to the time sequence number of the video frame to be written; write the video frame returned by the cache unit corresponding to the time sequence number of the video frame to be written into the storage; the scheduling unit is configured to: send the video parameter to the video acquisition unit; receive the corresponding information sent by the video acquisition unit; determine the cache unit corresponding to the time sequence number of the video frame to be written from the corresponding information according to the cache unit search request sent by the storage writing unit, and send the address of the cache unit as the cache unit indication information to the storage writing unit.
[0005] According to a second aspect of the present disclosure, a cache scheduling method is provided, applied to the storage system of the first aspect, the method comprising: determining a required space according to a current video frame; judging whether a first cache unit meets the requirement according to the required space; when the first cache unit meets the requirement, taking the first cache unit as an available cache unit; when the first cache unit does not meet the requirement, judging whether a second cache unit meets the requirement according to the required space; when the second cache unit meets the requirement, taking the second cache unit as the available cache unit; when the second cache unit does not meet the requirement, taking a cloud cache unit as the available cache unit; sending the current video frame to the available cache unit, and generating corresponding information of a time sequence number of the current video frame and the available cache unit.
[0006] According to a third aspect of the present disclosure, a video parameter adjusting method is provided, applied to the storage system of the first aspect, the method comprising: obtaining a real-time write time consumption of the storage; determining an average write time consumption in a preset time period according to the real-time write time consumption; determining a first time consumption threshold and a second time consumption threshold according to a current video parameter; obtaining a current frame rate and a current code rate according to the current video parameter; when the average write time consumption is greater than the second time consumption threshold, reducing the current frame rate according to a preset frame rate reduction, until the average write time consumption is greater than the first time consumption threshold and less than the second time consumption threshold; when the average write time consumption is greater than the first time consumption threshold and less than the second time consumption threshold, reducing the current code rate according to a preset code rate reduction, until the average write time consumption is less than the first time consumption threshold; when the average write time consumption is less than the first time consumption threshold, updating the video parameter according to the current frame rate and the current code rate.
[0007] According to a fourth aspect of the present disclosure, a cache scheduling device is provided, applied to the storage system of the first aspect, the device comprising: a space calculation module configured to determine a required space according to a current video frame; a first cache judgment module configured to judge whether a first cache unit meets the requirement according to the required space; a first cache determination module configured to take the first cache unit as an available cache unit when the first cache unit meets the requirement; a second cache judgment module configured to judge whether a second cache unit meets the requirement according to the required space when the first cache unit does not meet the requirement; a second cache determination module configured to take the second cache unit as the available cache unit when the second cache unit meets the requirement; a cloud cache determination module configured to take a cloud cache unit as the available cache unit when the second cache unit does not meet the requirement; and a corresponding sending module configured to send the current video frame to the available cache unit, and generate corresponding information of a time sequence number of the current video frame and the available cache unit.
[0008] According to a fifth aspect of the present disclosure, a video parameter adjusting device is provided, which is applied to the storage system of the first aspect, and the device comprises: a time consumption monitoring module configured to obtain a real-time write time consumption of the storage; an average calculation module configured to determine an average write time consumption in a preset period according to the real-time write time consumption; a threshold determination module configured to determine a first time consumption threshold and a second time consumption threshold according to a current video parameter; a parameter initialization module configured to obtain a current frame rate and a current code rate according to the current video parameter, and take a preset highest frame rate as the current frame rate and take a preset highest code rate as the current code rate; a frame reduction module configured to reduce the current frame rate at a preset frame reduction rate when the average write time consumption is greater than the second time consumption threshold, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; a code reduction module configured to take the current frame rate as the frame rate and reduce the current code rate at a preset code reduction rate when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, until the average write time consumption is less than or equal to the first time consumption threshold; and a parameter updating module configured to update the video parameter by taking the current frame rate as the frame rate and taking the current code rate as the code rate according to the current frame rate and the current code rate when the average write time consumption is less than or equal to the first time consumption threshold.
[0009] By adopting the scheme of the present disclosure, the write pressure caused by instantaneous high concurrency can be relieved, and the frame loss and recording break caused by single storage node failure or response lag and network fluctuation can be avoided.
[0010] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor is it used to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0011] The accompanying drawings are used to better understand the present scheme and do not constitute a limitation on the present disclosure. Among them:
[0012] Figure 1 is a video storage scene diagram according to an embodiment of the present disclosure;
[0013] Figure 2 is a principle block diagram of a storage system according to an embodiment of the present disclosure;
[0014] Figure 3 is a flowchart of a cache scheduling method according to an embodiment of the present disclosure;
[0015] Figure 4 is a cache layout structure diagram according to an embodiment of the present disclosure;
[0016] Figure 5 is a flowchart of a video parameter adjusting method according to an embodiment of the present disclosure;
[0017] Figure 6 is a flowchart of a video storage method according to an embodiment of the present disclosure;
[0018] Figure 7 is a structural diagram of a cache scheduling apparatus according to an embodiment of the present disclosure;
[0019] Figure 8 is a structural diagram of a video parameter adjustment apparatus according to an embodiment of the present disclosure;
[0020] Figure 9 is a scenario diagram of a cache scheduling method according to an embodiment of the present disclosure;
[0021] Figure 10 is a scenario diagram of a video parameter adjustment method according to an embodiment of the present disclosure;
[0022] Figure 11 is a structural diagram of an electronic device for implementing a cache scheduling method and / or a video parameter adjustment method according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0023] Exemplary embodiments of the present disclosure are described herein with reference to the accompanying drawings, in which various details are set forth to facilitate an understanding of the embodiments of the present disclosure. However, it will be apparent to those of ordinary skill in the art that various changes in the embodiments of the present disclosure can be made without departing from the scope of the present disclosure. Also, descriptions of well-known functions and constructions are omitted for clarity and conciseness.
[0024] The term "and / or" herein is merely used to describe an associated relationship, indicating that there can be three relationships, for example, A and / or B can mean that A exists alone, A and B exist together, and B exists alone. The term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, and C can mean including any one or more elements selected from a set consisting of A, B, and C. The terms "first" and "second" herein mean to refer to and distinguish a plurality of similar technical terms, and do not mean to limit the order or mean to limit to only two, for example, a first feature and a second feature mean to refer to two categories / two features, and the first feature can be one or more, and the second feature can also be one or more.
[0025] In addition, in order to better illustrate the present disclosure, numerous specific details are given in the following detailed description. Those skilled in the art will understand that the present disclosure can be implemented without certain specific details. In some examples, methods, means, elements and circuits well known to those skilled in the art are not described in detail in order to highlight the main idea of the present disclosure.
[0026] Before the technical solutions of the embodiments of the present disclosure are introduced, the technical terms that can be used in the present disclosure are further described:
[0027] Secure Digital (SD) card: a super-small removable storage medium based on non-volatile flash memory technology, which is standardized and promoted by the SD Association. The card body integrates a flash memory array and a dedicated controller, and exchanges data with the host device at high speed through a bus protocol via metal contacts, and supports multiple speed levels to meet the different needs of continuous write bandwidth and random read-write performance in scenarios such as video recording, mobile computing, and vehicle-mounted systems.
[0028] In the related art, when the current market camera records a video, it first stores real-time picture data in the memory cache, and then writes it into the SD card step by step, so the design of its memory cache mechanism directly affects the stability of video recording. Most cameras use a fixed-size memory heap space to cache video data. Although this design simplifies the software structure, it also has obvious defects. Specifically, when the SD card has an abnormal area that causes the write speed to slow down, the data in the cache cannot be saved in time, which may cause video loss. In addition, the performance differences and compatibility problems of different brands of SD cards, as well as the limitations of the fixed cache design of the camera (such as the risk of insufficient memory caused by the compromise solution of memory allocation), further exacerbate the recording interruption phenomenon. The traditional camera only applies for a fixed memory space (such as 1MB), which can cache about 4 seconds of video data on average. Once the SD card write speed decreases and the cache is not enough to support continuous recording, the recording interruption problem will occur.
[0029] Figure 1 A video storage scenario diagram is shown as Figure 1 As shown in the figure, when the camera is working, it will save the recorded video to the local SD card in real time; then, when the user needs to view the video of the camera, he can initiate a request to the cloud server through the application (APP) on the mobile phone to obtain the video data on the SD card; after the cloud receives the user's request, it is forwarded to the camera, and the camera uploads the video data on the SD card to the cloud, and the cloud transmits the video to the user's mobile phone APP; finally, the user can view the video content stored on the SD card in real time on the mobile phone APP. This process relies on the stable storage of the SD card. If the SD card has a recording interruption or data loss, the user cannot obtain the required video in full when accessing remotely through the APP, which affects the experience and safety.
[0030] The present disclosure proposes a storage system which can alleviate the write pressure caused by instantaneous high concurrency and avoid frame loss caused by single storage node failure or response delay and network fluctuation by adopting multi-level cache.
[0031] The present disclosure provides a storage system, which can include a video acquisition unit 201, a scheduling unit 202, a cache array 203, a storage writing unit 204 and a storage 205. Figure 2 As shown in the figure, the system can include a video acquisition unit 201, a scheduling unit 202, a cache array 203, a storage writing unit 204 and a storage 205. The cache array 203 includes a first-level cache unit 2031, a second-level cache unit 2032 and a cloud cache unit 2033. The video acquisition unit 201 is communicatively connected with the scheduling unit 202, the first-level cache unit 2031, the second-level cache unit 2032 and the cloud cache unit 2033, and is configured to: acquire a current video frame according to a video parameter sent by the scheduling unit 202; sequentially traverse the first-level cache unit 2031, the second-level cache unit 2032 and the cloud cache unit 2033 according to the current video frame, and determine an available cache unit; send the current video frame to the available cache unit, and send corresponding information of the time sequence number of the current video frame and the available cache unit to the scheduling unit 202. The storage writing unit 204 is communicatively connected with the first-level cache unit 2031, the second-level cache unit 2032, the cloud cache unit 2033, the scheduling unit 202 and the storage 205, and is configured to: determine a time sequence number of a video frame to be written; send a cache unit search request to the scheduling unit 202 according to the time sequence number of the video frame to be written; receive cache unit indication information sent by the scheduling unit 202, and determine a cache unit corresponding to the time sequence number of the video frame to be written; send a video frame pulling request to the cache unit corresponding to the time sequence number of the video frame to be written; and write the video frame returned by the cache unit corresponding to the time sequence number of the video frame to be written into the storage 205. The scheduling unit 202 is configured to: send a video parameter to the video acquisition unit 201; receive corresponding information sent by the video acquisition unit 201; determine a cache unit corresponding to the time sequence number of the video frame to be written from the corresponding information according to the cache unit search request sent by the storage writing unit 204, and send the address of the cache unit as the cache unit indication information to the storage writing unit 204.
[0032] Here, the video acquisition unit refers to a front-end data acquisition device, which can be a camera or a video source device, etc. The scheduling unit refers to a core coordination and management unit, which can be responsible for scheduling the entire video frame flow process. The cache array refers to a collection of multiple cache units for temporarily storing video frames collected by the video acquisition unit. The storage write unit refers to a module responsible for writing video frames in the cache to the final storage device. The storage refers to a back-end storage device for long-term and stable storage of video data. In the embodiments of the present disclosure, the storage can be an SD card.
[0033] Here, the first-level cache unit refers to the first layer of cache in the cache array, which usually has the highest speed and the lowest delay. The second-level cache unit refers to the second layer of cache in the cache array. The cloud cache unit refers to the cache in the cache array with a cloud server as the carrier, which has the largest capacity and can be remotely accessed, but the speed and delay are affected by the network.
[0034] In the embodiments of the present disclosure, a hierarchical structure can be used to design the system architecture. Exemplarily, the hierarchical structure can include an acquisition layer, a processing layer and a storage layer. The acquisition layer can include a video acquisition unit; the processing layer can include a scheduling unit and a cache array; and the storage layer can include a storage write unit and a storage. In particular, the requests and responses between the units can be decoupled by using a message queue or an event bus. The above is only an exemplary description, and is not limited as all possible cases of building a storage system. Here, an exhaustive enumeration is not made.
[0035] Here, the video parameter refers to the working parameter of the video acquisition unit, such as resolution, code rate, frame rate, etc. In the embodiments of the present disclosure, the video parameter can determine the quality and size of the video.
[0036] Here, the current video frame refers to the image data collected at the current time. In the embodiments of the present disclosure, in the storage system, the video frame is the smallest processing unit.
[0037] Here, the available cache unit refers to a cache unit that has enough space and is normal to be written. In the embodiments of the present disclosure, the available cache unit can be one of the first-level cache unit, the second-level cache unit or the cloud cache unit.
[0038] Here, the time sequence number refers to a unique number assigned to each video frame. In the embodiments of the present disclosure, the time sequence number can ensure the subsequent search and sequence management of any video frame.
[0039] Here, the corresponding information refers to the mapping relationship between each time sequence number and the cache unit where the corresponding video frame data is located.
[0040] In the embodiments of the present disclosure, the video parameters can be first pushed by the scheduling unit, and the collection unit can initialize the collection process according to the video parameters, and configure the working parameters. Then, the video frame data can be acquired according to the set parameters, and the sampling can be performed in real time. Next, the real-time state of the first-level cache unit, the second-level cache unit and the cloud cache unit can be determined according to the video frame data acquired at the current time. In particular, the first-level cache unit can be selected preferentially, and if the first-level cache unit is full, the real-time state of the second-level cache unit or the cloud cache unit is determined. At the same time, a number can be automatically generated for each frame to ensure uniqueness and sequence. Finally, the number and the cache location information can be notified to the scheduling unit, which is convenient for subsequent searching. The above is only an exemplary description, and is not limited as all possible cases of the video collection unit, and the enumeration is not performed here.
[0041] Here, the cache unit search request is a request sent to the scheduling unit, indicating that the cache location of the video frame of a certain time sequence number needs to be searched. In the embodiments of the present disclosure, the time sequence number of the video frame to be written is included in the cache unit search request.
[0042] Here, the cache unit indication information is the specific cache unit address or identifier fed back by the scheduling unit.
[0043] Here, the video frame pulling request is a data request for a certain video frame from any cache unit.
[0044] In the embodiments of the present disclosure, the time sequence number of the video frame currently needed to be written into the memory can be first determined. Exemplarily, the time sequence number of the next video frame can be determined according to the time sequence number of the video frame already written into the memory by using time sequence sorting, or the time sequence number of the video frame currently needed to be written into the memory can be determined according to the indication of the system flow or the business logic. Then, the cache unit search request can be sent to the scheduling unit through a message or an interface. Next, after receiving the cache unit indication information returned by the scheduling unit, the video frame pulling request can be sent to the cache unit indicated by the cache unit indication information through the interface. Finally, after receiving the video frame, the write operation can be performed on the memory. The above is only an exemplary description, and is not limited as all possible cases of the storage writing unit, and the enumeration is not performed here.
[0045] In the embodiments of the present disclosure, the latest parameter configuration instruction can be issued to the video acquisition unit at initialization or after parameter adjustment. Moreover, the mapping correspondence between the time sequence number sent by the video acquisition unit and the cache unit can be received in real time, and the correspondence is saved in the database or the memory. Furthermore, after receiving the cache unit search request of the storage writing unit, the target cache unit is searched according to the correspondence, and the target cache unit is returned to the storage writing unit as the cache unit indication information. The above is only an exemplary description, and is not limited as the whole possible situation of the scheduling unit, but here is not exhaustive.
[0046] In the embodiments of the present disclosure, the first-level cache unit, the second-level cache unit and the cloud cache unit are configured to: store the current video frame sent by the video acquisition unit; and send the video frame to the storage writing unit in response to the video frame pulling request sent by the storage writing unit. In particular, each cache unit supports retrieving the video frame according to the time sequence number, and quickly returns the retrieved video frame after receiving the video frame pulling request. The above is only an exemplary description, and is not limited as the whole possible situation of the first-level cache unit, the second-level cache unit and the cloud cache unit, but here is not exhaustive.
[0047] The technical scheme of the embodiments of the present disclosure can alleviate the write pressure caused by instantaneous high concurrency, and can also avoid frame loss and recording interruption caused by single storage node failure, response delay or network fluctuation. At the same time, the cloud cache can implement remote backup for key video frames, so that data recoverability can still be realized in extreme situations such as local device damage or loss. In addition, the time sequence number is used to track each frame of data throughout the process, so that the missing segment can be quickly located and rolled back after an abnormality occurs. The cooperative design of multi-level cache and asynchronous writing decouples the acquisition and storage links, significantly improves the overall throughput and response performance, and is especially suitable for monitoring, vehicle-mounted and mobile camera scenes that need to be recorded continuously for a long time, and can realize multiple protection of important data through cloud disaster recovery strategy.
[0048] In some embodiments, the storage writing unit is further configured to: obtain the real-time write time consumption of the storage; determine the average write time consumption in a preset time period according to the real-time write time consumption; and send the average write time consumption to the scheduling unit. The scheduling unit is further configured to: receive the average write time consumption sent by the storage writing unit; determine a time consumption threshold according to the current video parameter; and update the video parameter according to the average write time consumption and the time consumption threshold.
[0049] Here, the actual write time consumption refers to the real time consumed by each time of writing the video frame data from the cache unit to the storage per unit data amount. In the embodiments of the present disclosure, the unit data amount can be 100 kilobytes, and the unit of the actual write time consumption can be milliseconds per 100 kilobytes.
[0050] Here, the average write time consumption refers to an average value of time consumptions of all write operations in a preset period, and is used to reflect the overall speed and state of storage writing. In the embodiments of the present disclosure, the preset period can be 1 minute, 5 minutes, etc.
[0051] In the embodiments of the present disclosure, the operation start time and the operation end time can be recorded when the storage write unit performs a write operation, and the difference between the two is the time consumption of one write operation. At the same time, the actual write time consumption is unified into a unit data amount according to the data amount of the write operation, and the actual write time consumption is obtained. Subsequently, the actual write time consumption of each time can be continuously recorded until the end of the preset period, the total time consumption of all write operations in the period is counted and divided by the total data amount of the write operation, and the average write time consumption is obtained. Finally, the storage write unit can send the average write time consumption to the scheduling unit. The above is only an exemplary description, and is not limited as the whole possible situation of the storage write unit, but here is not exhaustive.
[0052] Here, the time consumption threshold refers to an upper limit standard of the write time consumption of a unit data amount corresponding to the current video parameter. In the embodiments of the present disclosure, if the average write time consumption exceeds the time consumption threshold, it may cause risks such as data backlog and frame loss.
[0053] In the embodiments of the present disclosure, the average write time consumption data reported by the storage write unit can be periodically acquired. Subsequently, the optimal write time consumption threshold can be dynamically calculated or searched according to the current video acquisition parameter and the system configuration. Exemplarily, if it is found that the average write time consumption is higher than the threshold, it indicates that the write speed cannot keep up with the video acquisition speed, which may cause cache backlog. At this time, the scheduling unit issues new video parameters to adapt to the current storage state and avoid excessive system pressure. Further, if the average write time consumption is lower than the threshold, it indicates that the system is running normally, and the video parameters can be maintained or improved. The above is only an exemplary description, and is not limited as the whole possible situation of the scheduling unit, but here is not exhaustive.
[0054] In this way, by determining the actual write time consumption and the average write time consumption, the storage performance can be monitored in real time, the video acquisition parameter can be dynamically adjusted according to the actual write speed, and the adaptive capability can be improved. By determining the average write time consumption, the instantaneous error can be effectively filtered out and the noise interference can be inhibited. By threshold comparison, the acquisition rate and the parameter can be adjusted in time, and the problems such as cache overflow, frame loss and recording interruption caused by overload of the storage can be avoided, and the data integrity can be ensured. By flexibly adjusting the video quality according to the current storage performance, the storage resources can be maximized, the key data can be preferentially saved, and the system throughput and stability can be improved. When the storage pressure rises, the video parameter is automatically reduced to ensure uninterrupted recording; when the storage pressure decreases, the video quality is automatically improved to improve the picture effect, and balance is achieved.
[0055] In some embodiments, the time-consuming threshold is determined according to the current video parameter, including: determining a unit time data amount according to the current video parameter; and determining the time-consuming threshold according to the unit time data amount and a preset proportion coefficient.
[0056] Here, the unit time data amount refers to the total size of data collected by the video collection unit and required to be written into storage within a unit time. In the embodiments of the present disclosure, the unit time can be 1 second.
[0057] In the embodiments of the present disclosure, the current video parameter can be obtained first, and then the data amount per second required to be processed by the current video stream can be determined. In particular, the data amount per unit time can be calculated in real time according to the change of the video parameter. The above is only an exemplary description, and is not limited as all possible cases of determining the unit time data amount, but here is not exhaustive.
[0058] Here, the proportion coefficient refers to a preset adjustment factor for converting the theoretical upper limit of the writing time into an actually available time-consuming threshold. In the embodiments of the present disclosure, the proportion coefficient can reflect factors such as fault tolerance, buffering, performance redundancy of the system under normal load.
[0059] In the embodiments of the present disclosure, the preset proportion coefficient can be obtained first, and then the product of the proportion coefficient and the unit time data amount is taken as the writing speed threshold, and the writing speed threshold is converted into the time-consuming threshold. The above is only an exemplary description, and is not limited as all possible cases of determining the time-consuming threshold, but here is not exhaustive.
[0060] In this way, the unit time data amount is determined by using the video parameter, which can respond to the update of the video parameter in real time and accurately predict the writing pressure. The time-consuming threshold is determined by using the proportion coefficient, which can avoid complex storage performance calculation and quickly determine the real-time time-consuming threshold. At the same time, the proportion coefficient can provide a certain redundant space to tolerate the temporary performance fluctuation of the system or the memory, and reduce the instability caused by misjudgment and frequent adjustment.
[0061] In some embodiments, the time-consuming threshold includes a first time-consuming threshold and a second time-consuming threshold, and the first time-consuming threshold is smaller than the second time-consuming threshold; and the video parameter includes at least a frame rate and a code rate. The video parameter is updated according to the average writing time and the time-consuming threshold, including: obtaining a current frame rate and a current code rate according to the current video parameter; when the average writing time is greater than the second time-consuming threshold, reducing the current frame rate according to a preset frame rate reduction, until the average writing time is greater than the first time-consuming threshold and smaller than the second time-consuming threshold; when the average writing time is greater than the first time-consuming threshold and smaller than or equal to the second time-consuming threshold, reducing the current code rate according to a preset code rate reduction, until the average writing time is smaller than or equal to the first time-consuming threshold; and when the average writing time is smaller than or equal to the first time-consuming threshold, updating the video parameter according to the current frame rate and the current code rate.
[0062] Here, the first time-consuming threshold refers to a lower time-consuming critical value preset to represent the normal upper limit of the storage write pressure. In the embodiments of the present disclosure, the first time-consuming threshold corresponds to the first proportion coefficient, and the first time-consuming threshold can be determined by the product of the first proportion coefficient and the unit time data amount. Exemplarily, the calculation process of the first time-consuming threshold can be represented by the following formula (1):
[0063] (1)
[0064] In the formula, T 1 represents the first time-consuming threshold; a 1 represents the first proportion coefficient; and b 1 represents the unit time data amount.
[0065] Here, the second time-consuming threshold refers to a higher time-consuming critical value preset to represent the risk warning line of the storage write pressure. In the embodiments of the present disclosure, the second time-consuming threshold corresponds to the second proportion coefficient, and the second time-consuming threshold can be determined by the product of the second proportion coefficient and the unit time data amount. Exemplarily, the calculation process of the second time-consuming threshold can be represented by the following formula (2):
[0066] (2)
[0067] In the formula, T 2 represents the second time-consuming threshold; a 2 represents the second proportion coefficient; and b 2 represents the unit time data amount.
[0068] Here, the current frame rate refers to the number of frames per second of the video being collected and encoded by the current video collection unit. In the embodiments of the present disclosure, the higher the frame rate, the smoother the picture, but the larger the unit time data amount, and the greater the storage pressure.
[0069] Here, the current code rate refers to the data rate of the current video encoding output. In the embodiments of the present disclosure, the higher the code rate, the clearer the picture, but the larger the data amount, and the greater the storage and bandwidth pressure.
[0070] In the embodiments of the present disclosure, the current frame rate and code rate settings can be read from the current video parameters. The above is only an exemplary description, and is not limited as all possible cases of obtaining the current frame rate and the current code rate. Here, the exhaustive enumeration is not made.
[0071] Here, the frame rate reduction refers to a preset step for reducing the frame rate. In the embodiments of the present disclosure, the frame rate reduction can represent how many frames are reduced each time.
[0072] In the embodiments of the present disclosure, since the second time consumption threshold is higher than the first time consumption threshold, when the actual average write time consumption exceeds the second time consumption threshold, it indicates that the storage pressure is very large. At this time, the current frame rate can be gradually reduced according to the frame rate reduction (for example, 2 fps each time), and the average write time consumption is detected in real time until the average time consumption is less than or equal to the second threshold and greater than the first threshold, so as to preferentially sacrifice the fluency and quickly reduce the pressure. The above is only an exemplary description, and is not limited as all possible cases of reducing the current frame rate, but here is not exhaustive.
[0073] Here, the code rate reduction refers to a preset step length for reducing the code rate. In the embodiments of the present disclosure, the code rate reduction can represent how much data is reduced each time the adjustment is made.
[0074] In the embodiments of the present disclosure, when the actual average write time consumption exceeds the first time consumption threshold but is less than or equal to the second time consumption threshold, it indicates that the pressure is high but not seriously overloaded. At this time, the frame rate can be kept unchanged, the current code rate can be gradually reduced according to the code rate reduction (for example, 1000 bps each time), and the average write time consumption is detected in real time until it is less than or equal to the first time consumption threshold, so as to moderately reduce the definition and balance the quality and the pressure. The above is only an exemplary description, and is not limited as all possible cases of reducing the current code rate, but here is not exhaustive.
[0075] In the embodiments of the present disclosure, when the actual average write time consumption is less than the first time consumption threshold, it indicates that the write pressure is at a normal level, at this time, the video parameters can be updated according to the current frame rate and the code rate, so as to ensure that the picture quality and the fluency reach the best under the current conditions. The above is only an exemplary description, and is not limited as all possible cases of updating the video parameters, but here is not exhaustive.
[0076] In some embodiments, the process of determining the first time consumption threshold can also determine the critical write speed through the unit data amount, then determine the first speed threshold through a preset third proportional coefficient, and finally convert the first speed threshold into the first time consumption threshold. Specifically, the first time consumption threshold can also be represented by the following formula (3):
[0077] (3)
[0078] Here, The third proportional coefficient is represented by K3; The first speed threshold is represented by V1; The unit data amount is represented by D.
[0079] Similarly, the process of determining the second time consumption threshold can also determine the critical write speed through the unit data amount, then determine the second speed threshold through a preset fourth proportional coefficient, and finally convert the second speed threshold into the second time consumption threshold. Specifically, the second time consumption threshold can also be represented by the following formula (4):
[0080] (4)
[0081] Here, represents a fourth proportional coefficient; represents a second speed threshold value; represents a unit data amount.
[0082] Exemplarily, assuming that the code rate is 2,000,000 bps, the unit time data amount can be represented as 250,000 B / s after converting 8 bytes (b) into 1 bit (B) for conversion. Further, the unit time data amount can be converted into about 244 kB / s according to the conversion manner of 1 kB = 1024 B.
[0083] Further, the rate adopted when calculating T1 should be slightly lower than the continuous writing rate to tolerate small fluctuations. In the embodiment of the present disclosure, the third proportional coefficient can be set to 0.7, and then the first speed threshold value is obtained by multiplying the third proportional coefficient and the unit time data amount, i.e. 244 kB / s x 0.7, which is about 170 kB / s. Then, the first speed threshold value can be converted into ms / 100kB, i.e. converting kB / s into ms / 100kB, and the first time consumption threshold value can be calculated by (1000 ms x 100 kB) / 170 kB / s, which is 588 ms / 100kB.
[0084] Similarly, the rate adopted when calculating T2 should be much lower than the continuous writing rate to monitor large fluctuations. In the embodiment of the present disclosure, the fourth proportional coefficient can be set to 0.3, and then the second speed threshold value is obtained by multiplying the fourth proportional coefficient and the unit time data amount, i.e. 244 kB / s x 0.3, which is about 73 kB / s. Then, the second speed threshold value can be converted into ms / 100kB, i.e. converting kB / s into ms / 100kB, and the second time consumption threshold value can be calculated by (1000 ms x 100 kB) / 73 kB / s, which is 1369 ms / 100kB.
[0085] In this way, the frame rate is preferentially reduced to quickly reduce the pressure, so as to ensure that the system does not cause data loss due to too high pressure, and at the same time, when the pressure does not continuously increase, only the code rate is reduced to ensure the smoothness of the picture, and better balance the user experience and system safety. By setting the first time consumption threshold value and the second time consumption threshold value, risk grading is facilitated, and then different strategies are used to cope with different levels of pressure, so as to avoid repeated fluctuations of parameters. When the storage pressure is relieved, the parameters can be restored in real time to ensure the picture quality and smoothness, and the storage resources are fully utilized.
[0086] In some embodiments, for the frame rate and code rate reduction process, the average write time can also be compared with the first time threshold and the second time threshold in a period of time. If the average write time is greater than the first time threshold, the preset maximum frame rate is taken as the current frame rate, the preset maximum code rate is taken as the current code rate, and then the frame rate and the code rate are reduced according to the reduced frame rate and the reduced code rate, and the video parameters are updated according to the most suitable frame rate and code rate. In this way, the frame rate and the code rate are reduced from the maximum value each time, which can finely balance the video quality and the fluency.
[0087] In some embodiments, according to the average write time and the time threshold, updating the video parameters further includes: when the average write time continuously does not exceed the first time threshold and the continuous time length exceeds a preset stable time threshold, obtaining a current frame rate and a current code rate according to the current video parameters; increasing the current code rate according to a preset code rate increase until the preset maximum code rate is reached or the average write time exceeds the first time threshold; when the current code rate reaches the preset maximum code rate and the average write time is less than or equal to the first time threshold, increasing the current frame rate according to a preset frame rate increase until the preset maximum frame rate is reached or the average write time exceeds the first time threshold; and updating the video parameters according to the current frame rate and the current code rate.
[0088] Here, the stable time threshold refers to the minimum time length during which the average write time continuously remains below the first time threshold. In the embodiments of the present disclosure, if the time length exceeds the stable time threshold, it indicates that the storage system performance is relatively stable and has room for improving the video quality.
[0089] In the embodiments of the present disclosure, the average write time consumption in a period of time can be continuously counted. Specifically, at each time point, the write operation time consumption of each write operation in the period corresponding to the average write time consumption can be determined by backtracking, and then the average write time consumption at each time point can be obtained; or the average write time consumption in the period corresponding to the average write time consumption can be calculated, and the calculated result can be taken as the average write time consumption at each time point in the period. For example, when the period corresponding to the average write time consumption is 5 minutes, the average write time consumption calculated can be taken as the average write time consumption at each time point by backtracking 5 minutes at each time point of system running; or an average write time consumption can be calculated every 5 minutes from the time point of system running, and the value can be taken as the average write time consumption at each time point in the 5 minutes. Further, the average write time consumption at each time point can be compared with the first time consumption threshold, and when it is found that the average write time consumption continuously does not exceed the first time consumption threshold, and this state lasts for more than a preset stable time threshold, it is considered that the storage performance is stable, and the video quality can be considered to be improved. Specifically, the average write time consumption at each time point can be compared with the first time consumption threshold respectively, all time points less than or equal to the first time consumption threshold can be extracted, and the time points can be sorted according to time sequence, the duration of the period in which the average write time consumption is not greater than the first time consumption threshold can be determined, and the time duration can be compared with the preset stable time threshold, so as to determine whether the current state is a stable state of storage performance. If the current state is the stable state of storage performance, the current frame rate and the current code rate can be read from the current video parameters. The above is only an exemplary description, and is not limited as all possible cases of obtaining the current frame rate and the current code rate, which are not enumerated here.
[0090] Here, the code rate increasing step refers to a preset step for increasing the code rate. In the embodiments of the present disclosure, the code rate increasing step can represent how much data is increased each time the adjustment is made.
[0091] Here, the preset maximum code rate refers to the maximum allowed code rate set by video acquisition and encoding. In the embodiments of the present disclosure, the preset maximum code rate depends on the hardware parameters of the video acquisition unit.
[0092] In the embodiments of the present disclosure, the code rate is preferentially increased when the storage system is stable, and one code rate increasing step is increased each time. In particular, the average write time consumption can be monitored again after each increase until the preset maximum code rate is reached or the average write time consumption exceeds the second threshold. The above is only an exemplary description, and is not limited as all possible cases of increasing the current code rate, which are not enumerated here.
[0093] Here, the frame rate increasing step refers to a preset step for increasing the frame rate. In the embodiments of the present disclosure, the frame rate increasing step can represent how many frames are increased or decreased each time the adjustment is made.
[0094] Here, the preset maximum frame rate refers to the maximum allowed frame rate set by the video capturing and encoding. In the embodiments of the present disclosure, the preset maximum frame rate depends on the hardware parameters of the video capturing unit.
[0095] In the embodiments of the present disclosure, when the code rate has been increased to the preset maximum value and the average write time is still less than or equal to the first time threshold, it indicates that there is still room for write performance, and the video fluency can be further improved. The current frame rate is gradually increased according to the frame rate increasing, and the average write time is monitored again after each step of increasing, until the maximum frame rate is reached or the average write time exceeds the first threshold. The above is only an exemplary description, and is not limited as all possible cases of improving the current frame rate, but here is not exhaustively enumerated.
[0096] In the embodiments of the present disclosure, after each increase, the current frame rate and the code rate are used as new parameters to update the video configuration, so as to realize dynamic adaptive adjustment of the parameters. The above is only an exemplary description, and is not limited as all possible cases of updating the video parameters, but here is not exhaustively enumerated.
[0097] In this way, when the storage system is in a stable and low write pressure state, the code rate and the frame rate can be automatically increased to maximize the output of higher quality and fluency, and the user experience is improved. The parameter increase is linked to the time monitoring, so that the system can automatically adjust according to the actual storage performance, and the storage pressure will not be too large or data will not be lost due to blind increase of parameters. The storage performance is fully utilized to avoid performance waste, so that the system is always in an optimal or near-optimal state. Each step in the process of increasing the code rate and the frame rate is detected, and can be rolled back at any time, so as to ensure the stability of the system and the safety of data writing, and the performance bottleneck caused by the increase of parameters is avoided.
[0098] In some embodiments, according to the current video parameters, the current frame rate and the current code rate are obtained, including: determining whether there are corresponding values of the current frame rate and the current code rate in the current video parameters; when there are corresponding values, obtaining the current frame rate and the current code rate according to the current video parameters; and when there are no corresponding values, taking the preset maximum frame rate as the current frame rate and taking the preset maximum code rate as the current code rate.
[0099] In the embodiments of the present disclosure, it can be checked whether there are specific values of the frame rate and the code rate in the current video parameter configuration. Specifically, when the entire system is initialized, the video parameters have not been set at this time, which belongs to the state of no corresponding values of the current frame rate and the current code rate. Similarly, when the system has been running or the capturing process has been started, the video parameters have been set at this time, which belongs to the state of having corresponding values of the current frame rate and the current code rate. The above is only an exemplary description, and is not limited as all possible cases of determining whether there are corresponding values, but here is not exhaustively enumerated.
[0100] In the embodiments of the present disclosure, if there are corresponding values of the current frame rate and the current code rate, the values can be directly used as the current frame rate and the current code rate. The above is only an exemplary description, and is not a limitation on all possible cases of obtaining the current frame rate and the current code rate, but here is not an exhaustive enumeration.
[0101] In the embodiments of the present disclosure, in the case where there are no corresponding values of the current frame rate and the current code rate, the preset highest frame rate and the preset highest code rate can be respectively assigned to the current frame rate and the current code rate, and the two values are used as initial parameters for subsequent video recording, so as to ensure that the recording effect is the optimal starting point. The above is only an exemplary description, and is not a limitation on all possible cases of using the preset highest frame rate as the current frame rate and using the preset highest code rate as the current code rate, but here is not an exhaustive enumeration.
[0102] In this way, without waiting for the user to gradually adjust, the optimal parameters are used at the initialization time, and the recording picture is ensured to be clear and smooth. The starting parameters are uniform and reasonable, which is beneficial to subsequent dynamic adjustment and closed-loop control. Only the highest value is preset according to the hardware parameter, and the initialization parameter setting can be automatically completed, and the user experience is more friendly.
[0103] In some embodiments, according to the current video frame, the primary cache unit, the secondary cache unit and the cloud cache unit are sequentially traversed to determine the available cache unit, including: according to the current video frame, determining the required space; according to the required space, judging whether the primary cache unit meets the requirement; when the primary cache unit meets the requirement, the primary cache unit is used as the available cache unit; when the primary cache unit does not meet the requirement, according to the required space, judging whether the secondary cache unit meets the requirement; when the secondary cache unit meets the requirement, the secondary cache unit is used as the available cache unit; when the secondary cache unit does not meet the requirement, the cloud cache unit is used as the available cache unit.
[0104] Here, the required space refers to the cache storage capacity required by the current video frame. In the embodiments of the present disclosure, the required space can be calculated according to the encoding format, resolution and code rate of the video frame and the like.
[0105] In the embodiments of the present disclosure, the actual data size of the current video frame can be determined according to the attribute information of the frame. The above is only an exemplary description, and is not a limitation on all possible cases of determining the required space, but here is not an exhaustive enumeration.
[0106] In the embodiments of the present disclosure, the available capacity of the first-level cache unit can be queried first, and whether the available capacity is greater than or equal to the required space is compared. If the available capacity of the first-level cache unit is greater than or equal to the required space, it is determined that the first-level cache unit meets the requirement. Otherwise, if the available capacity of the first-level cache unit is less than the required space, it is determined that the first-level cache unit does not meet the requirement. If it is determined that the first-level cache unit meets the requirement, the first-level cache unit is preferentially selected. The above is only an exemplary description, and is not a limitation on all possible cases of determining whether the first-level cache unit meets the requirement, but here is not an exhaustive enumeration.
[0107] In the embodiments of the present disclosure, if the first-level cache unit does not meet the requirement, the available capacity of the second-level cache unit is queried, and whether the available capacity is greater than or equal to the required space is compared. If the available capacity of the second-level cache unit is greater than or equal to the required space, it is determined that the second-level cache unit meets the requirement. Otherwise, if the available capacity of the second-level cache unit is less than the required space, it is determined that the second-level cache unit does not meet the requirement. If it is determined that the second-level cache unit meets the requirement, the second-level cache unit is preferentially selected. The above is only an exemplary description, and is not a limitation on all possible cases of determining whether the second-level cache unit meets the requirement, but here is not an exhaustive enumeration.
[0108] In the embodiments of the present disclosure, if the first two levels of cache do not meet the requirement, the cloud cache unit is automatically selected. Specifically, the cloud cache unit can be a cloud server or a remote storage space, which generally has a large space and can meet most cases, but has a slower access speed than local storage. The above is only an exemplary description, and is not a limitation on all possible cases of using the cloud cache unit as a usable cache unit, but here is not an exhaustive enumeration.
[0109] In some embodiments, the system automatically traverses the cache units in sequence each time a storage operation is performed, to achieve dynamic and intelligent allocation. In particular, more levels of cache units can be expanded according to actual business requirements.
[0110] In this way, the first-level cache unit is preferentially used to ensure fast data writing and reading, reduce latency, and improve storage efficiency and response speed. When the first-level cache unit is insufficient in space, the next level of cache is automatically switched to, to ensure that data is not lost and improve system robustness. When the local cache unit is insufficient in capacity, data is automatically transferred to cloud storage to optimize overall resource utilization and achieve intelligent optimization and dynamic scheduling of storage resources. The multi-level cache ensures that even if a certain level of storage fails or is insufficient in space, data can still be landed on other cache units, reducing the risk of broken recording or frame loss due to insufficient space.
[0111] In some embodiments, the sending of the correspondence between the time sequence number of the current video frame and the available buffer unit to the scheduling unit comprises: determining the time sequence number of the video frame according to the time sequence of the video acquisition unit; generating the correspondence between the time sequence number of the current video frame and the available buffer unit according to the time sequence number of the current video frame and the available buffer unit; and sending the correspondence as the corresponding information to the scheduling unit.
[0112] Here, the time sequence refers to the time order identifier assigned to each frame by the video acquisition unit in the continuous recording process. In the embodiments of the present disclosure, the time sequence can include a timestamp, an incremental frame number, etc.
[0113] In the embodiments of the present disclosure, when the video acquisition unit acquires each frame, it will automatically assign a time sequence number to it. For example, the number can be an incremental integer, such as frame 1, frame 2; or a timestamp of the acquisition time, such as 23:45.12, indicating the 12th frame in the 23rd minute and 45 seconds of the video. Further, the number can be used as the time sequence number to identify the acquisition order and time position of each frame. The above is only an exemplary illustration and is not intended to limit all possible cases of determining the time sequence number of the video frame, but here we do not make an exhaustive enumeration.
[0114] In the embodiments of the present disclosure, after obtaining a video frame and its time sequence number, the time sequence number of the video frame can be mapped to the actually allocated available buffer unit to establish a correspondence. For example, the correspondence can be expressed in the form of a table, data structure, etc. for subsequent query and scheduling. The above is only an exemplary illustration and is not intended to limit all possible cases of generating the correspondence between the time sequence number and the available buffer unit, but here we do not make an exhaustive enumeration.
[0115] In the embodiments of the present disclosure, the correspondence between the time sequence number of each video frame and the buffer unit can be organized as structured information, and the information can be sent in real time to the scheduling unit through the internal communication mechanism of the system. Subsequently, after receiving the information, the scheduling unit can perform subsequent data management, playback, retrieval, etc. The above is only an exemplary illustration and is not intended to limit all possible cases of sending to the scheduling unit, but here we do not make an exhaustive enumeration.
[0116] In this way, by determining the time sequence number of each frame, subsequent video synchronization processing, time axis positioning, accurate playback, etc. are facilitated. By establishing the correspondence between the time sequence number of the video frame and the available buffer unit, each frame can be accurately associated with its storage location, and the scheduling unit can quickly locate the data source when performing various processing on the video frame data. The standardized numbering and mapping relationship structure is easy to extend, upgrade and maintain the system, and supports complex scenarios such as multi-level storage and distributed storage.
[0117] The embodiment of the present disclosure provides a cache scheduling method, Figure 3 is a flowchart of a cache scheduling method according to the embodiment of the present disclosure, which can be applied to a cache scheduling device. The cache scheduling device is located in an electronic device. The electronic device includes but is not limited to a fixed device and / or a mobile device. For example, the fixed device includes but is not limited to a server, which can be a cloud server or a general server. For example, the mobile device includes but is not limited to a video acquisition device, which can be a mobile phone, a tablet computer, a vehicle-mounted terminal, etc. In some possible implementation manners, the cache scheduling method can also be realized by a processor calling computer readable instructions stored in a memory. As Figure 3 indicated, the cache scheduling method includes:
[0118] S301, determining a required space according to a current video frame.
[0119] S302, judging whether a first cache unit meets the requirement according to the required space.
[0120] S303, when the first cache unit meets the requirement, taking the first cache unit as an available cache unit.
[0121] S304, when the first cache unit does not meet the requirement, judging whether a second cache unit meets the requirement according to the required space.
[0122] S305, when the second cache unit meets the requirement, taking the second cache unit as an available cache unit.
[0123] S306, when the second cache unit does not meet the requirement, taking a cloud cache unit as an available cache unit.
[0124] S307, sending the current video frame to the available cache unit, and generating corresponding information of a time sequence number of the current video frame and the available cache unit.
[0125] The technical solution of the embodiment of the present disclosure ensures that each frame of video data can be efficiently and reliably allocated storage space through hierarchical judgment and dynamic selection of available cache units, and realizes accurate management through the corresponding relationship between the time sequence number and the storage location. At the same time, the flexibility and robustness of the system under limited storage resources or sudden pressure are improved, the risk of data loss and recording interruption is effectively reduced, and clear data mapping basis is provided for subsequent data scheduling, retrieval and playback, thereby improving the safety, continuity and intelligent management ability of the storage system as a whole.
[0126] Figure 4 shows a cache layout structure schematic diagram of the embodiment of the present disclosure, as Figure 4As shown, the cache includes: a program static code segment (Program Static Code Segment) 401 for storing the static code part of the program; an initialized data segment (Initialized Data Segment) 402 for storing initialized global variables and static variables; an uninitialized data segment (Uninitialized Data Segment) 403 for storing uninitialized global variables and static variables; a memory heap area (Heap) 404 for the heap space applied by the function during program running, which is a dynamically allocated memory space; an unmapped memory (Unmapped Memory) 405, which refers to the memory area that is not used or allocated by the program temporarily; a stack area (Stack) 406 for storing temporary variables, return addresses, etc. during function calls, which is a space automatically allocated and released by the system; a kernel space (Kernel space) 407, which refers to the special memory area for the system kernel running, and the user program cannot access.
[0127] Among them, the memory heap area 404 can be set as a first cache unit, and a memory block of a fixed size is allocated to improve the allocation efficiency and management stability. The unmapped memory 405 can be set as a second cache unit, and the memory space is dynamically allocated and released to meet the storage needs of large-scale or indefinite-length data and improve flexibility. In particular, all the space of the unmapped memory 405 can be set as a second cache unit, or part of the space of the unmapped memory 405 can be reserved and the remaining space can be set as a second cache unit. Illustratively, in the case of using a cloud cache unit, during the uploading and downloading process, the network adapter may also occupy part of the cache space, therefore, after reserving the space required by the network adapter in the unmapped memory 405, the remaining space can be set as a second cache unit. In some embodiments, space can also be reserved for other software or hardware that may occupy cache space, and the remaining space can be set as a second cache unit.
[0128] In some embodiments, taking 64 MB total RAM as an example, the remaining memory of a 200-megapixel camera is generally 15-18 MB, and the minimum threshold is 10 MB; the remaining memory of a 300-megapixel camera is generally 14-17 MB, and the minimum memory threshold is generally 10 MB; the remaining memory of a 400-megapixel camera is generally 13-16 MB, and the minimum memory threshold is generally 10 MB; the remaining memory of a 500-megapixel camera is generally 11-14 MB, and the minimum memory threshold is generally 10 MB. At this time, the remaining space can be set as a secondary cache unit after reserving the minimum threshold in the remaining memory. That is, for a 200-megapixel camera, the secondary cache unit can be 5-8 MB; for a 300-megapixel camera, the secondary cache unit can be 4-7 MB; for a 400-megapixel camera, the secondary cache unit can be 3-6 MB; and for a 500-megapixel camera, the secondary cache unit can be 1-4 MB.
[0129] The video parameter adjusting method provided in the embodiments of the present disclosure, Figure 5 is a flowchart of a video parameter adjusting method according to the embodiments of the present disclosure, which can be applied to a video parameter adjusting device. The video parameter adjusting device is located in an electronic device. The electronic device includes but is not limited to a fixed device and / or a mobile device. For example, the fixed device includes but is not limited to a server, which can be a cloud server or a general server. For example, the mobile device includes but is not limited to a video acquisition device, which can be a mobile phone, a tablet computer, a vehicle-mounted terminal, etc. In some possible implementation manners, the video parameter adjusting method can also be realized by a processor calling computer readable instructions stored in a memory. As Figure 5 shown, the video parameter adjusting method includes:
[0130] S501, acquiring a real-time write time consumption of a memory.
[0131] S502, determining an average write time consumption in a preset time period according to the real-time write time consumption.
[0132] S503, determining a first time consumption threshold and a second time consumption threshold according to a current video parameter.
[0133] S504, acquiring a current frame rate and a current code rate according to the current video parameter.
[0134] S505, when the average write time consumption is greater than the second time consumption threshold, reducing the current frame rate according to a preset frame rate reduction, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold.
[0135] S506, when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, reducing the current code rate according to the preset code rate reduction, until the average write time consumption is less than or equal to the first time consumption threshold.
[0136] S507, when the average write time consumption is less than or equal to the first time consumption threshold, updating the video parameters according to the current frame rate and the current code rate.
[0137] The technical scheme of the embodiments of the present disclosure realizes fine adaptive control of the video data write pressure by monitoring the write time consumption of the memory in real time and dynamically adjusting the frame rate and the code rate of the video in combination with the multi-level time consumption threshold. At the same time, when the storage pressure increases, the frame rate is preferentially reduced, and then the code rate is reduced, effectively avoiding data accumulation and write delay, and guaranteeing the continuity of video recording and the real-time performance of the system; when the write pressure decreases, the higher quality and smoothness can be automatically restored, thereby optimizing the video quality and recording experience to the greatest extent on the premise of ensuring storage safety, and improving the stability and intelligent level of the system.
[0138] In some embodiments, a multi-level cache mechanism can be used to flexibly manage the storage of video data. For example, the multi-level cache mechanism can be specifically divided into three levels, including: Heap fixed memory for immediate storage, dynamic mapping memory for capacity expansion as needed, and cloud cache as a redundant backup. This hierarchical structure ensures sufficient buffer space in different states and reduces data loss caused by local faults.
[0139] Further, the write time consumption and error rate and other key indicators can be continuously monitored. Specifically, by periodically measuring the average write time consumption, the performance fluctuations or abnormal areas of the SD card can be identified in real time. In particular, the fluctuation variance can also be calculated while determining the average write time consumption. Further, the sliding window algorithm can be used to process data to eliminate transient noise and ensure the stability of the monitoring results.
[0140] Further, the video parameters can be intelligently adjusted based on real-time performance data. For example, when the write time consumption exceeds the first time consumption threshold T1 (such as 30 ms / 100 kB), the system gradually reduces the bit rate to reduce the data volume; if the problem persists and reaches the second time consumption threshold T2 (such as 100 ms / 100 kB), the frame rate is further reduced to preferentially maintain the smoothness of the video. In particular, intelligently adjusting the video parameters based on real-time performance data can ensure that the optimal balance between video quality and recording stability is achieved under different SD card performance.
[0141] In the embodiments of the present disclosure, through the joint action of the multi-level cache mechanism, continuous monitoring of key indicators and intelligent adjustment of video parameters, the compatibility and recording stability of the camera for various brands of SD cards can be significantly improved, the risk of recording interruption and data loss is reduced, and a more reliable video recording experience is provided for users.
[0142] Figure 6 A flowchart of a video storage method of the embodiments of the present disclosure is shown, which is applied to a storage system and can be used to efficiently operate and manage file or device data under a Linux operating system using C language through memory mapping related technologies such as mmap function and munmap function. As shown in Figure 6 The video storage method includes:
[0143] S601, initializing the sensor of a video image acquisition device such as a mobile phone or a camera, and completing the preparation for acquiring a video stream.
[0144] S602, initializing a video encoder according to initial video parameters, and preparing for subsequent video data acquisition and encoding.
[0145] S603, acquiring a current video frame in a video stream in real time.
[0146] S604, detecting whether the local first-level cache space meets the storage requirement of the current video frame. If yes, go to S605; otherwise, go to S606.
[0147] S605, writing the data of the video frame into the first-level cache, and going to S603 and S609.
[0148] S606, detecting whether the local second-level cache space meets the requirement. If yes, go to S607; otherwise, go to S608a and S608b.
[0149] S607, writing the data of the video frame into the second-level cache, and going to S603 and S609.
[0150] S608a, sending an alarm information to the user, which can be: SD card write failure, cloud cache is used.
[0151] S608b, writing the data of the video frame into the cloud cache, and going to S603 and S609.
[0152] S609, writing the correspondence between the video frame time sequence number and the cache unit into the message queue, and going to S611.
[0153] S610, initializing a storage thread for managing and scheduling data writing.
[0154] S611, obtain the correspondence between the video frame time sequence number and the cache unit from the message queue.
[0155] S612, determine whether there is a video frame to be written by judging whether there is data in the correspondence. If yes, go to S613; otherwise, go to S611.
[0156] S613, determine whether the video frame to be written exists in the cloud cache according to the correspondence. If yes, go to S614a; otherwise, go to S614b.
[0157] S614a, download the required video frame from the cloud.
[0158] S614b, directly read the video frame from the local memory.
[0159] S615, write the obtained video frame to the SD card.
[0160] S616, monitor the time spent on the SD card write operation.
[0161] S617, average the SD card write time consumption in a period of time.
[0162] S618, determine whether the current average write time consumption exceeds the first time consumption threshold T1. If yes, go to S620; otherwise, go to S619.
[0163] S619, the current average write time consumption does not exceed the first time consumption threshold T1, which proves that the write pressure is low at this time, and the instruction to restore the frame rate and the code rate can be issued to improve the video quality. Send the restored frame rate and code rate to the video encoder, and go to S602.
[0164] S620, reduce the code rate of video acquisition and storage to reduce the write pressure. Send the reduced code rate to the video encoder, and go to S602.
[0165] S621, calculate the new average write time consumption again to evaluate the adjustment effect.
[0166] S622, determine whether the adjusted average write time consumption exceeds the second time consumption threshold T2.
[0167] S623, reduce the frame rate of video acquisition and storage to further reduce the write pressure. Send the reduced frame rate to the video encoder, and go to S602.
[0168] It should be understood that Figures 2 to 6 The schematic diagram shown is only exemplary and not limiting, and it is scalable, and those skilled in the art can expand it based on Figures 2 to 6Various obvious changes and / or replacements can be made to the examples, and the resulting technical solutions still fall within the disclosure range of the embodiments of the present disclosure.
[0169] The embodiments of the present disclosure provide a cache scheduling apparatus, as shown in the accompanying drawings, which can include: Figure 7 The apparatus can include: a space calculation module 701 configured to determine a required space according to a current video frame; a primary cache judgment module 702 configured to determine whether a primary cache unit meets the requirement according to the required space; a primary cache determination module 703 configured to determine the primary cache unit as an available cache unit when the primary cache unit meets the requirement; a secondary cache judgment module 704 configured to determine whether a secondary cache unit meets the requirement according to the required space when the primary cache unit does not meet the requirement; a secondary cache determination module 705 configured to determine the secondary cache unit as an available cache unit when the secondary cache unit meets the requirement; a cloud cache determination module 706 configured to determine a cloud cache unit as an available cache unit when the secondary cache unit does not meet the requirement; and a corresponding sending module 707 configured to send the current video frame to the available cache unit and generate corresponding information of a time sequence number of the current video frame and the available cache unit.
[0170] The specific functions and examples of the modules and sub-modules of the apparatus of the embodiments of the present disclosure are described in the above-mentioned embodiments, and the corresponding descriptions of the steps are not repeated here.
[0171] The cache scheduling apparatus in the embodiments of the present disclosure can determine and dynamically select available cache units through hierarchical judgment, ensure that each frame of video data can be efficiently and reliably allocated storage space, and achieve accurate management through the corresponding relationship between the time sequence number and the storage location. At the same time, the flexibility and robustness of the system under limited storage resources or sudden pressure are improved, the risk of data loss and recording interruption is effectively reduced, and clear data mapping basis is provided for subsequent data scheduling, retrieval and playback, thereby improving the safety, continuity and intelligent management capability of the storage system as a whole.
[0172] The embodiments of the present disclosure provide a video parameter adjustment apparatus, as shown in the accompanying drawings, which can include: Figure 8As shown, the apparatus can comprise: a time consumption monitoring module 801 configured to acquire a real-time write time consumption of a memory; an average calculation module 802 configured to determine an average write time consumption in a preset time period according to the real-time write time consumption; a threshold determination module 803 configured to determine a first time consumption threshold and a second time consumption threshold according to a current video parameter; a parameter initialization module 804 configured to acquire a current frame rate and a current code rate according to the current video parameter; a frame reduction module 805 configured to reduce the current frame rate according to a preset frame reduction rate when the average write time consumption is greater than the second time consumption threshold, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; a code reduction module 806 configured to reduce the current code rate according to a preset code reduction rate when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, until the average write time consumption is less than or equal to the first time consumption threshold; and a parameter updating module 807 configured to update the video parameter according to the current frame rate and the current code rate when the average write time consumption is less than or equal to the first time consumption threshold.
[0173] The specific functions and examples of each module and sub-module of the apparatus of the embodiments of the present disclosure are described above in the corresponding steps, which will not be described here again.
[0174] The video parameter adjusting apparatus in the embodiments of the present disclosure can dynamically adjust the frame rate and the code rate of the video by monitoring the write time consumption of the memory in real time and combining the multi-level time consumption threshold, thereby realizing fine adaptive control of the write pressure of the video data. At the same time, when the storage pressure increases, the frame rate is reduced first and then the code rate is reduced, thereby effectively avoiding data accumulation and write delay, and guaranteeing the continuity of video recording and the real-time performance of the system; and when the write pressure decreases, the video quality and smoothness can be automatically restored, thereby optimizing the video quality and recording experience to the greatest extent on the premise of guaranteeing the storage safety, and improving the stability and intelligent level of the system.
[0175] The embodiments of the present disclosure provide a scene schematic diagram of a cache scheduling method, as shown in Figure 9
[0176] As described above, the cache scheduling method provided by the embodiments of the present disclosure is applied to an electronic device. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can be installed on or connected to an autonomous vehicle.
[0177] Specifically, the electronic device can specifically perform the following operations:
[0178] According to the current video frame, determine the required space; according to the required space, judge whether the first cache unit meets the demand; when the first cache unit meets the demand, take the first cache unit as the available cache unit; when the first cache unit does not meet the demand, according to the required space, judge whether the second cache unit meets the demand; when the second cache unit meets the demand, take the second cache unit as the available cache unit; when the second cache unit does not meet the demand, take the cloud cache unit as the available cache unit; send the current video frame to the available cache unit, and generate the corresponding information of the time sequence number of the current video frame and the available cache unit.
[0179] It should be understood that Figure 9 the scene diagram shown is merely illustrative and not restrictive, and those skilled in the art can make various obvious changes and / or replacements based on the examples Figure 9 obtained technical solutions still belong to the disclosure range of the embodiments of the present disclosure.
[0180] The embodiments of the present disclosure provide a scene diagram of a video parameter adjustment method, as Figure 10 shown.
[0181] As described above, the video parameter adjustment method provided by the embodiments of the present disclosure is applied to an electronic device. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other suitable computers. The electronic device can be installed on or connected to an autonomous vehicle.
[0182] Specifically, the electronic device can specifically perform the following operations:
[0183] obtain the real-time write time consumption of the memory; determine the average write time consumption in a preset time period according to the real-time write time consumption; determine a first time consumption threshold and a second time consumption threshold according to the current video parameter; obtain a current frame rate and a current code rate according to the current video parameter; when the average write time consumption is greater than the second time consumption threshold, reduce the current frame rate according to a preset frame rate reduction, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, reduce the current code rate according to a preset code rate reduction, until the average write time consumption is less than or equal to the first time consumption threshold; when the average write time consumption is less than or equal to the first time consumption threshold, update the video parameter according to the current frame rate and the current code rate.
[0184] It should be understood that Figure 10 the scene diagram shown is merely illustrative and not restrictive, and those skilled in the art can make various obvious changes and / or replacements based on the examples Figure 10 obtained technical solutions still belong to the disclosure range of the embodiments of the present disclosure.
[0185] In the technical solutions of the present disclosure, the acquisition, storage and application of user personal information comply with relevant laws and regulations and do not violate public order and good customs.
[0186] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device and a readable storage medium.
[0187] Figure 11 A schematic block diagram of an example electronic device 1100 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown here, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the present disclosure described and / or claimed in this document.
[0188] As shown in Figure 11 The device 1100 includes a computing unit 1101 that can perform various appropriate actions and processes in accordance with a computer program stored in a Read-Only Memory (ROM) 1102 or a computer program loaded from a storage unit 1108 into a Random Access Memory (RAM) 1103. Various programs and data required for the operation of the device 1100 can also be stored in the RAM 1103. The computing unit 1101, the ROM 1102, and the RAM 1103 are connected to each other through a bus 1104. An Input / Output (I / O) interface 1105 is also connected to the bus 1104.
[0189] Various components in the device 1100 are connected to the I / O interface 1105, including an input unit 1106, such as a keyboard, a mouse, etc., an output unit 1107, such as various types of displays, speakers, etc., a storage unit 1108, such as a magnetic disk, an optical disk, etc., and a communication unit 1109, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 1109 allows the device 1100 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.
[0190] The computing unit 1101 can be various general and / or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 1101 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various special-purpose Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 1101 performs various methods and processes described above, such as the cache scheduling method and / or the video tuning method. For example, in some embodiments, the cache scheduling method and / or the video tuning method can be implemented as a computer software program, which is tangibly embodied in a machine-readable medium, such as the storage unit 1108. In some embodiments, part or all of the computer program can be loaded and / or installed onto the device 1100 via the ROM 1102 and / or the communication unit 1109. When the computer program is loaded onto the RAM 1103 and executed by the computing unit 1101, one or more steps of the cache scheduling method and / or the video tuning method described above can be performed. Alternatively, in other embodiments, the computing unit 1101 can be configured to perform the cache scheduling method and / or the video tuning method by other any appropriate means, such as by means of firmware.
[0191] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application-Specific Standard Products (ASSP), a System on Chip (SOC), a Complex Programmable Logic Device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0192] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. This program code can be provided to a processor or controller of a general or special purpose computer, such that the program code, when executed by the processor or controller, causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
[0193] In the context of this disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0194] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a Cathode Ray Tube (CRT) or Liquid Crystal Display (LCD) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0195] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0196] The computer system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0197] It should be understood that the various forms of flow shown above can be re-ordered, added to, or have steps deleted, using the steps described above. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technology disclosed in the present disclosure can be achieved, which is not limited herein.
[0198] The specific implementation described above does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements, and improvements made within the principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A storage system, characterized by, The system comprises a video acquisition unit, a scheduling unit, a cache array, a storage writing unit and a storage; The cache array comprises a first-level cache unit, a second-level cache unit and a cloud cache unit; The video acquisition unit is in communication connection with the scheduling unit, the first-level cache unit, the second-level cache unit and the cloud cache unit respectively, and is configured to: acquire a current video frame according to a video parameter sent by the scheduling unit; sequentially traverse the first-level cache unit, the second-level cache unit and the cloud cache unit according to the current video frame, and determine an available cache unit; send the current video frame to the available cache unit, and send time sequence number of the current video frame and corresponding information of the available cache unit to the scheduling unit; The storage writing unit is in communication connection with the first-level cache unit, the second-level cache unit, the cloud cache unit, the scheduling unit and the storage respectively, and is configured to: determine time sequence number of a video frame to be written; send a cache unit search request to the scheduling unit according to the time sequence number of the video frame to be written; receive cache unit indication information sent by the scheduling unit, and determine a cache unit corresponding to the time sequence number of the video frame to be written; send a video frame pulling request to the cache unit corresponding to the time sequence number of the video frame to be written; and write the video frame returned by the cache unit corresponding to the time sequence number of the video frame to be written into the storage; The scheduling unit is configured to: send a video parameter to the video acquisition unit; receive the corresponding information sent by the video acquisition unit; determine, from the corresponding information, a cache unit corresponding to the time sequence number of the video frame to be written according to the cache unit search request sent by the storage writing unit, and send an address of the cache unit as the cache unit indication information to the storage writing unit; The storage writing unit is further configured to: acquire real-time writing time consumption of the storage; determine average writing time consumption in a preset period according to the real-time writing time consumption; and send the average writing time consumption to the scheduling unit; The scheduling unit is further configured to: receive the average writing time consumption sent by the storage writing unit; determine a time consumption threshold according to a current video parameter; and update the video parameter according to the average writing time consumption and the time consumption threshold; The time consumption threshold comprises a first time consumption threshold and a second time consumption threshold, and the first time consumption threshold is smaller than the second time consumption threshold; and the video parameter at least comprises a frame rate and a code rate; The updating of the video parameter according to the average writing time consumption and the time consumption threshold comprises: acquiring a current frame rate and a current code rate according to the current video parameter; when the average writing time consumption is greater than the second time consumption threshold, reducing the current frame rate according to a preset frame rate reduction, until the average writing time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; and when the average writing time consumption is greater than the second time consumption threshold, reducing the current frame rate according to a preset frame rate reduction, until the average writing time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold. when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, reducing the current code rate according to a preset code rate reduction rate until the average write time consumption is less than or equal to the first time consumption threshold; when the average write time consumption is less than or equal to the first time consumption threshold, updating the video parameters according to the current frame rate and the current code rate.
2. The system of claim 1, wherein, The method further includes: determining a unit time data amount according to the current video parameters; determining the time consumption threshold according to the unit time data amount and a preset proportion coefficient.
3. The system of claim 1, wherein, The method further includes: when the average write time consumption continuously does not exceed the first time consumption threshold and a continuous time length exceeds a preset stable time length threshold, obtaining a current frame rate and a current code rate according to the current video parameters; increasing the current code rate according to a preset code rate increase rate until a preset maximum code rate is reached or the average write time consumption is greater than the first time consumption threshold; when the current code rate reaches the preset maximum code rate and the average write time consumption is less than or equal to the first time consumption threshold, increasing the current frame rate according to a preset frame rate increase rate until a preset maximum frame rate is reached or the average write time consumption is greater than the first time consumption threshold; updating the video parameters according to the current frame rate and the current code rate.
4. The system of claim 1 or 3, wherein, The method further includes: determining whether corresponding values of the current frame rate and the current code rate exist in the current video parameters; when the corresponding values exist, obtaining the current frame rate and the current code rate according to the current video parameters; when the corresponding values do not exist, taking a preset maximum frame rate as the current frame rate and a preset maximum code rate as the current code rate.
5. The system of claim 1, wherein, The method further includes: determining a required space according to the current video frame; determining whether the primary cache unit meets the requirement according to the required space; when the primary cache unit meets the requirement, taking the primary cache unit as the available cache unit; when the primary cache unit does not meet the requirement, determining whether the secondary cache unit meets the requirement according to the required space; when the secondary cache unit meets the requirement, taking the secondary cache unit as the available cache unit; when the secondary cache unit does not meet the requirement, taking the cloud cache unit as the available cache unit.
6. The system of claim 1, wherein, The method further includes: determining a time sequence number of the current video frame according to a time sequence of the video acquisition unit; generating a correspondence between the time sequence number of the current video frame and the available cache unit according to the time sequence number of the current video frame and the available cache unit; sending the correspondence to the scheduling unit as the corresponding information.
7. A cache scheduling method, characterized by, The method is applied to the storage system of claim 1, and the method comprises: According to the current video frame, determining the required space; According to the required space, judging whether the first cache unit meets the requirement; When the first cache unit meets the requirement, taking the first cache unit as the available cache unit; When the first cache unit does not meet the requirement, according to the required space, judging whether the second cache unit meets the requirement; When the second cache unit meets the requirement, taking the second cache unit as the available cache unit; When the second cache unit does not meet the requirement, taking the cloud cache unit as the available cache unit; Sending the current video frame to the available cache unit and generating the corresponding information of the time sequence number of the current video frame and the available cache unit.
8. A video parameter adjustment method, characterized in that, The method is applied to the storage system of claim 1, and the method comprises: Obtaining the real-time write time consumption of the storage memory; According to the real-time write time consumption, determining the average write time consumption in a preset period; According to the current video parameter, determining the first time consumption threshold and the second time consumption threshold; According to the current video parameter, obtaining the current frame rate and the current code rate; When the average write time consumption is greater than the second time consumption threshold, reducing the current frame rate according to a preset frame rate reduction, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; When the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, reducing the current code rate according to a preset code rate reduction, until the average write time consumption is less than or equal to the first time consumption threshold; When the average write time consumption is less than or equal to the first time consumption threshold, updating the video parameter according to the current frame rate and the current code rate.
9. A cache scheduling apparatus, characterized by comprising: The device is applied to the storage system of claim 1, and the device comprises: A space calculation module is configured to determine the required space according to the current video frame; A first cache judgment module is configured to judge whether the first cache unit meets the requirement according to the required space; A first cache determination module is configured to take the first cache unit as the available cache unit when the first cache unit meets the requirement; A second cache judgment module is configured to judge whether the second cache unit meets the requirement according to the required space when the first cache unit does not meet the requirement; A second cache determination module is configured to take the second cache unit as the available cache unit when the second cache unit meets the requirement; A cloud cache determination module is configured to take the cloud cache unit as the available cache unit when the second cache unit does not meet the requirement; A corresponding sending module is configured to send the current video frame to the available cache unit and generate the corresponding information of the time sequence number of the current video frame and the available cache unit.
10. A video parameter setting device, characterized by comprising: The device is applied to the storage system of claim 1, and the device comprises: A time consumption monitoring module is configured to obtain the real-time write time consumption of the storage memory; An average calculation module is configured to determine the average write time consumption in a preset period according to the real-time write time consumption; A threshold determination module is configured to determine the first time consumption threshold and the second time consumption threshold according to the current video parameter; a parameter initialization module, configured to acquire a current frame rate and a current code rate according to the current video parameter; a frame reduction module, configured to reduce the current frame rate according to a preset frame reduction rate when the average write time consumption is greater than the second time consumption threshold, until the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold; a code reduction module, configured to reduce the current code rate according to a preset code reduction rate when the average write time consumption is greater than the first time consumption threshold and less than or equal to the second time consumption threshold, until the average write time consumption is less than or equal to the first time consumption threshold; a parameter updating module, configured to update the video parameter according to the current frame rate and the current code rate when the average write time consumption is less than or equal to the first time consumption threshold.
Citation Information
Patent Citations
Video coding method and device, electronic equipment and storage medium
CN112104879A
NVMe acceleration method and device based on multi-level cache and feedback algorithm
CN117785063A