WO2020224184A1 - 视频数据存储方法、装置、终端设备及存储介质 - Google Patents

视频数据存储方法、装置、终端设备及存储介质 Download PDF

Info

Publication number
WO2020224184A1
WO2020224184A1 PCT/CN2019/110636 CN2019110636W WO2020224184A1 WO 2020224184 A1 WO2020224184 A1 WO 2020224184A1 CN 2019110636 W CN2019110636 W CN 2019110636W WO 2020224184 A1 WO2020224184 A1 WO 2020224184A1
Authority
WO
WIPO (PCT)
Prior art keywords
buffer space
data
video
space
stored
Prior art date
Application number
PCT/CN2019/110636
Other languages
English (en)
French (fr)
Inventor
吴佐华
丁强
Original Assignee
浙江宇视科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 浙江宇视科技有限公司 filed Critical 浙江宇视科技有限公司
Priority to US17/609,694 priority Critical patent/US11966398B2/en
Priority to EP19928031.4A priority patent/EP3968186A4/en
Publication of WO2020224184A1 publication Critical patent/WO2020224184A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/70Information retrieval; Database structures therefor; File system structures therefor of video data
    • G06F16/71Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/061Improving I/O performance
    • G06F3/0613Improving I/O performance in relation to throughput
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/40Scenes; Scene-specific elements in video content
    • G06V20/48Matching video sequences
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/231Content storage operation, e.g. caching movies for short term storage, replicating data over plural servers, prioritizing data for deletion
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/232Content retrieval operation locally within server, e.g. reading video streams from disk arrays
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/432Content retrieval operation from a local storage medium, e.g. hard-disk

Definitions

  • This application relates to the technical field of video data block storage, for example, to a video data storage method, device, terminal device, and storage medium.
  • the block storage mode is usually used to realize data storage in various industries (for example, video surveillance industry, network communication industry, etc.), but excessively frequent small block storage will cause the memory space of data storage devices Fragmentation in turn causes the storage performance of the data storage device to deteriorate. For this reason, most data storage devices add a fixed amount of cache space to the memory space, and transfer the data that needs to be written to the memory space through the cache space, so that the data cached in the cache space can be cached when certain conditions are met. Write to the memory space for storage, thereby reducing the number of memory writes and improving the storage performance of the device.
  • Most data storage devices can only write data sequentially to the cache space for caching.
  • the data storage device completes the buffering operation of non-sequentially written video data each time (for example, the frame header of the I frame group video data that has been buffered in the buffer space).
  • the buffer space is not full, the currently buffered video data will be directly written to the memory space in advance, so that the buffer space cannot be fully utilized, resulting in the storage performance of the data storage device Unable to reach a better state.
  • This application provides a video data storage method, device, terminal equipment, and storage medium, which can fully utilize the space capacity of the video buffer space while realizing the buffering operation of non-sequentially written I-frame group video data, Reduce the number of memory writes, increase the amount of data written in each memory write operation, and make the storage performance of the terminal device reach a better state.
  • the embodiment of the application provides a video data storage method, which is applied to a terminal device including a video buffer space, wherein the video buffer space includes a first buffer space and a second buffer space, and writing of the first buffer space is prioritized
  • the level is greater than the write priority of the second buffer space, and the first buffer space and the second buffer space can both write at least one I-frame group of video data, the method includes:
  • the target writing position of the I-frame data to be stored is read, and it is determined whether the target writing position is located in the first buffer space. Within the position range corresponding to the written data;
  • the I-frame data to be stored is written into the first buffer space for buffering according to the target writing position, and the first buffer is detected. 1. Whether the cache space is full;
  • the embodiment of the present application provides a video data storage device, which is applied to a terminal device including a video buffer space, wherein the video buffer space includes a first buffer space and a second buffer space, and the write priority of the first buffer space Is greater than the write priority of the second buffer space, and both the first buffer space and the second buffer space can write at least one I-frame group video data, the device includes:
  • the written detection module is configured to detect whether there is written data in the video buffer space when receiving I frame data included in the I frame group video data to be stored;
  • the position judgment module is configured to read the target writing position of the I frame data to be stored in the case of detecting that there is written data in the video buffer space, and determine whether the target writing position is located in the Within a position range corresponding to the written data in the first buffer space;
  • the cache writing module is configured to write the I-frame data to be stored into the first cache space according to the target writing position in response to the judgment result that the target writing position is within the position range Cache, and detect whether the first cache space is full;
  • the storage writing module is configured to write all video data buffered in the video buffer space into the memory space of the terminal device for storage, and empty it when it is detected that the first buffer space is full.
  • the video buffer space is configured to write all video data buffered in the video buffer space into the memory space of the terminal device for storage, and empty it when it is detected that the first buffer space is full.
  • An embodiment of the present application provides a terminal device, including a processor and a memory, where a computer program is stored in the memory, and when the computer program is executed by the processor, the method described above is implemented.
  • the embodiment of the present application provides a computer-readable storage medium that stores a computer program, and when the computer program is executed by the processor, the method described above is implemented.
  • FIG. 1 is a schematic flowchart of a video data storage method provided by an embodiment of the application
  • FIG. 2 is a schematic flowchart of another video data storage method provided by an embodiment of the application.
  • FIG. 3 is a schematic block diagram of a video data storage device provided by an embodiment of the application.
  • FIG. 4 is a schematic block diagram of another video data storage device provided by an embodiment of the application.
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of this application.
  • Icon 100-video data storage device; 110-written detection module; 120-location judgment module; 130-cache writing module; 140-storage writing module; 150-statistical calculation module; 160-capacity configuration module; 210 -Processor; 220-memory.
  • FIG. 1 is a schematic flowchart of a video data storage method provided by an embodiment of the present application.
  • the video data storage method is applied to a terminal device that includes a video buffer space, and the terminal device implements a buffer operation for non-sequentially written I-frame group video data based on the video buffer space.
  • the space capacity of the video buffer space is fully utilized, thereby reducing the overall memory writing times, increasing the data writing amount of each memory writing operation, and making the storage performance of the terminal device reach a better state.
  • the terminal device includes at least one random access memory (Random Access Memory, RAM) and at least one read-only memory (Read Only Memory, ROM), and the terminal device uses the at least one RAM to construct For the video buffer space for transferring the I-frame video data, the terminal device constructs a corresponding memory space for storing the I-frame video data through the at least one ROM.
  • the terminal device may be, but not limited to, a personal computer (Personal Computer, PC), a server, a tablet computer, a personal digital assistant (Personal Digital Assistant, PDA), and a mobile Internet device (Mobile Internet Device, MID) and so on.
  • the video buffer space includes a first buffer space and a second buffer space.
  • the write priority of the first buffer space is greater than the write priority of the second buffer space.
  • Both the buffer space and the second buffer space can write at least one average data volume of I-frame video data, and the average data volume of the I-frame video data is the amount received by the terminal device in a period of time.
  • the average value between the data amounts of the video data of the I frame group, the space capacity of the first buffer space may be different from the space capacity of the second buffer space.
  • Step S210 in the case of receiving I-frame data to be stored included in the I-frame group of video data to be stored, detecting whether there is written data in the video buffer space.
  • the terminal device when the terminal device receives any piece of to-be-stored I-frame data included in a piece of to-be-stored I-frame group video data, it will correspondingly detect whether there is written in the video buffer space. data.
  • the data capacity corresponding to a piece of I-frame data to be stored is equal to the data capacity of a buffer unit in the video buffer space, and the terminal device can directly detect whether there is an existing buffer in the first buffer space.
  • Write data to detect whether there is written data in the video buffer space In the case of detecting that there is written data in the video buffer space, the terminal device will perform step S220 accordingly; in the case of detecting that there is no written data in the video buffer space, the terminal The device will perform step S300 accordingly.
  • the data capacity of one buffer unit in the video buffer space is 64KB.
  • Step S220 Read the target writing position of the I-frame data to be stored, and determine whether the target writing position is within the position range corresponding to the written data in the first buffer space.
  • the terminal device when the terminal device detects that there is written data in the video buffer space, the terminal device will correspondingly read the I frame data to be stored in the video buffer space.
  • the cached target writing position is used to determine whether the to-be-stored I frame data is the write-back content corresponding to the frame group header in the to-be-stored I frame group video data.
  • the terminal device when the terminal device determines that the target writing position of the I frame data to be stored is within the position range corresponding to the written data in the first buffer space, it will determine that The I-frame data to be stored is the write-back content in the video data of the I-frame group to be stored, and the terminal device will perform step S230 accordingly; the terminal device will determine the target writing of the I-frame data to be stored If the location is not within the location range corresponding to the written data in the first buffer space, it will be determined that the I-frame data to be stored is not the write-back content, and the terminal device will perform step S250 accordingly .
  • Step S230 Write the to-be-stored I-frame data into the first buffer space for buffering according to the target writing position, and detect whether the first buffer space is full.
  • the terminal device when the terminal device determines that the target writing position of the I frame data to be stored is within the position range corresponding to the written data in the first buffer space, the terminal The device directly uses the to-be-stored I-frame data to overwrite the written data in the first buffer space corresponding to the target writing position, so as to buffer the to-be-stored I-frame data in the first buffer space.
  • the buffering process of the to-be-stored I-frame group video data corresponding to the to-be-stored I-frame data is completed.
  • the terminal device will detect whether the first buffer space is full to determine whether to write the video data buffered in the first buffer space and the second buffer space into the memory of the terminal device Store in the space.
  • the step of detecting whether the first buffer space is full includes: counting the data amount of the video data buffered in the first buffer space and the second buffer space respectively , And calculate the total amount of video data buffered in the video buffer space; compare the total video data amount with the space capacity of the first buffer space; when the total video data amount is not less than the first buffer space In the case of the space capacity of the space, it is determined that the first buffer space is full, and in the case that the total video data amount is less than the space capacity of the first buffer space, it is determined that the first buffer space is not full .
  • the step of detecting whether the first buffer space is full includes: counting the data volume of the video data currently buffered in the first buffer space; The amount of data is compared with the space capacity of the first buffer space; in the case that the amount of data is less than the space capacity of the first buffer space, it is determined that the first buffer space is not full; If the amount is equal to the space capacity of the first buffer space, it is determined that the first buffer space is full.
  • the terminal device when the terminal device detects that the first buffer space is full, the terminal device will directly determine that the video buffer space is currently unable to store the next I frame group of video data. To perform caching, the terminal device will perform step S240 accordingly; in the case that the terminal device detects that the first buffer space is not full, the terminal device may base on the remaining space of the first buffer space The capacity caches the next I-frame group video data to be stored. For example, when the terminal device receives the I-frame data corresponding to the frame group header of the next I-frame group video data to be stored, it will use the The remaining space capacity of the first buffer space buffers the I frame data corresponding to the header of the frame group.
  • Step S240 All the video data buffered in the video buffer space is written into the memory space of the terminal device for storage, and the video buffer space is cleared.
  • the terminal device when the terminal device completes the data write-back process of the I frame data and detects that the first buffer space is full, the terminal device directly transfers the video buffer space All the video data currently buffered in the first buffer space and the second buffer space of each are written into the memory space of the terminal device for storage, and the video buffer space is emptied to pass the emptied video
  • the buffer space buffers the next I frame group video data to be stored.
  • the terminal device executes the above-mentioned steps S210 to S240 included in the video data storage method, while realizing the caching operation of the non-sequentially written I-frame group video data, Make full use of the space capacity of the video buffer space to reduce the number of memory writes, increase the amount of data written each time data is written to the memory, and make the storage performance of the terminal device reach a better state.
  • the video data storage method further includes:
  • Step S250 It is determined whether the target writing location is located behind the buffer location corresponding to the written data in the video buffer space.
  • the terminal device when the terminal device determines that the target writing position of the I-frame data to be stored is not within the position range corresponding to the written data in the first buffer space, the The terminal device will determine whether the target writing position of the I-frame data to be stored is located behind the buffer position corresponding to the written data in the video buffer space. In the case that the terminal device determines that the target writing location is located after the buffer location corresponding to the written data in the video buffer space, the terminal device will determine that the I frame data to be stored corresponds to the I frame data to be stored.
  • the terminal device will perform step S260 accordingly; the terminal device determines that the target writing position is not located in the video buffer space and has After the buffer location corresponding to the data is written (for example, the target write location is before the video buffer space, or the target write location exceeds the video buffer space), the terminal device will determine that The I frame data to be stored is abnormal video data, and the terminal device will perform step S290 accordingly.
  • Step S260 It is detected whether the second buffer space is full.
  • the terminal device determines that the target writing position of the I-frame data to be stored is not within the position range corresponding to the written data in the first buffer space, but is located in the video buffer In the case after the buffer location corresponding to the written data in the space, the terminal device will detect whether the second buffer space is full to determine whether the I frame data to be stored can be written to the Cache in the video cache space.
  • the step of detecting whether the second buffer space is full includes: counting the data amount of the video data buffered in the first buffer space and the second buffer space, and The total amount of video data buffered in the video buffer space is calculated; the total amount of video data is added to the data amount of the I frame data to be stored, and the total amount of data obtained by the addition is added to the video The total space capacity of the cache space is compared; when the total data amount is not less than the total space capacity, it is determined that the second cache space is full, and if the total data amount is less than the total space capacity In this case, it is determined that the second buffer space is not full.
  • the step of detecting whether the second buffer space is full includes: counting the data volume of the video data currently buffered in the second buffer space; and comparing the data obtained by statistics The amount of data is compared with the space capacity of the second cache space; in the case that the data amount is less than the space capacity of the second cache space, it is determined that the second cache space is not full; when the data amount is equal to In the case of the space capacity of the second buffer space, it is determined that the second buffer space is full.
  • the terminal device determines that the target writing position of the I-frame data to be stored is located in the buffer position corresponding to the written data in the video buffer space, and the second buffer space is not written In the case of full, the terminal device will directly buffer the I-frame data to be stored with the current remaining space capacity of the video buffer space, and the terminal device will perform step S280 accordingly;
  • the terminal device will directly determine the The video buffer space cannot currently buffer the I frame data to be stored, and the terminal device will perform step S270 accordingly.
  • Step S270 Write all the video data buffered in the video buffer space into the memory space of the terminal device for storage, then clear the video buffer space, and write the I-frame data to be stored directly after being cleared Cache is performed in the first cache space of the video cache space.
  • the terminal device when the terminal device determines that the video buffer space cannot currently buffer the I frame data to be stored, the terminal device writes all the video data buffered in the video buffer space. Into the memory space of the terminal device for storage, and then clear the video buffer space, and make the terminal device write the current I-frame data to be stored directly into the emptied video buffer space Cache is performed in the first cache space, so that the terminal device uses the current video cache space to cache the remaining I frame data of the currently to be stored I frame group video data.
  • Step S280 Write the I-frame data to be stored into the video buffer space for buffering according to the target writing position.
  • the terminal device when the terminal device determines that the video buffer space can still buffer the I-frame data to be stored at present, the terminal device directly writes the I-frame data to be stored into the Cache is performed at a location in the video cache space corresponding to the target writing location.
  • the terminal device when the first buffer space is not full, the terminal device directly writes the to-be-stored I frame data to the corresponding target write location in the first buffer space.
  • the terminal device When the first buffer space is full, the terminal device directly writes the to-be-stored I frame data to the target writing position at the corresponding position in the second buffer space .
  • the video data storage method further includes:
  • Step S290 directly write the I-frame data to be stored into the memory space of the terminal device for storage.
  • the terminal device when the terminal device determines that the target writing position is not located after the buffer position corresponding to the written data in the video buffer space, the I frame data to be stored will be determined as Abnormal video data, at this time, the terminal device writes the stored I frame data into the memory space of the terminal device for storage.
  • the terminal device when the I-frame data to be stored is the write-back content corresponding to the frame group header of the current I-frame video data to be stored that has been written into the memory space, the terminal device will directly use the The to-be-stored I-frame data overwrites and writes the frame group header data of the to-be-stored I-frame group video data written into the memory space.
  • the video data storage method further includes:
  • Step S300 directly writing the I-frame data to be stored into the first buffer space for buffering.
  • the terminal device after the terminal device has executed the step S210 and determined that there is no written data in the video buffer space, the first buffer space also has no written data, The terminal device will determine that the I frame data to be stored is the frame group header data to be written back of the current I frame group video data to be stored, and write the I frame data to be stored into the first buffer space Cache is performed to cache the remaining video data of the I-frame group of video data currently to be stored by using the remaining space capacity of the video cache space.
  • FIG. 2 is a schematic flowchart of another video data storage method provided by an embodiment of the present application.
  • the video data storage method further includes:
  • Step S310 When a data storage period ends, count the amount of video data received by the terminal device in the one data storage period, and calculate an average of the video data of an I frame group based on the statistically obtained video data amount The amount of data.
  • the data storage period is used to indicate that the terminal device needs to store video data within the time period corresponding to the data storage period, and the data storage period may be 1 hour or 1.5 hours, or 3 hours.
  • the terminal device will correspondingly count the amount of video data and the number of I frame groups received by the terminal device in the data storage period, And calculate the average data amount of the I frame group video data in the data storage period according to the statistically obtained video data amount and the number of I frame groups.
  • Step S320 Adjust the respective space capacities of the first buffer space and the second buffer space according to the average data amount of the I frame group video data, so that the first buffer space and the second buffer space The average data amount of at least one I frame group video data can be written.
  • each time the terminal device calculates the average data amount of the corresponding I-frame group video data it will calculate the average data amount of the I-frame group video data currently calculated with the previous calculation
  • the average data volume of the I-frame group video data is compared. If the currently calculated average data volume is the same as the last calculated average data volume, the respective space capacities of the first buffer space and the second buffer space currently configured by the terminal device need not be performed Adjust, still maintain the state where the average data amount of at least one I-frame group video data can be written; in the case that the average data amount currently calculated is not the same as the average data amount calculated last time ,
  • the terminal device will calculate the respective target space capacities of the first buffer space and the second buffer space to be adjusted according to the receiving speed of the video data volume of the terminal device in the data storage period, and The obtained target space capacity dynamically adjusts the current space capacity of the first cache space and the current space capacity of the second cache space.
  • the terminal device selects the smallest inherent buffer capacity value, and the largest value among the capacity product values calculated from the video data volume receiving speed and inherent coefficients, as the first buffer space The target space capacity.
  • the minimum inherent buffer capacity is not less than the average data amount of the I-frame group video data calculated this time, and the inherent coefficient may be 5, 6, or 7.
  • the terminal device selects the capacity product value calculated from the video data volume receiving speed and the buffer expansion coefficient as the target space capacity of the second buffer space.
  • the buffer expansion coefficient may be 1.2, 2.5 or 3.
  • FIG. 3 is a block diagram of a video data storage device 100 provided by an embodiment of the present application.
  • the video data storage device 100 is applied to a terminal device including a video buffer space.
  • the video buffer space includes a first buffer space and a second buffer space.
  • the first buffer The write priority of the space is greater than the write priority of the second buffer space, and both the first buffer space and the second buffer space can write at least one I frame group of video data.
  • the video data storage device 100 includes a written detection module 110, a location determination module 120, a cache writing module 130, and a storage writing module 140.
  • the written detection module 110 is configured to detect whether there is written data in the video buffer space when receiving the to-be-stored I-frame data included in the to-be-stored I-frame group of video data.
  • the written detection module 110 can execute step S210 in FIG. 1, and the execution process can refer to the description of step S210 above.
  • the position judgment module 120 is configured to read the target writing position of the I-frame data to be stored in the case of detecting that there is written data in the video buffer space, and determine whether the target writing position is It is located within the position range corresponding to the written data in the first buffer space.
  • the position determining module 120 can execute step S220 in FIG. 1, and the execution process can refer to the description of step S220 above.
  • the cache writing module 130 is configured to write the I-frame data to be stored into the first cache according to the target writing position in response to the judgment result that the target writing position is within the position range Cache in the space, and detect whether the first cache space is full.
  • the cache writing module 130 may execute step S230 in FIG. 1, and the execution process may refer to the above description of step S230.
  • the storage writing module 140 is configured to write all the video data buffered in the video buffer space into the memory space of the terminal device for storage when detecting that the first buffer space is full. Clear the video buffer space.
  • the storage writing module 140 can execute step S240 in FIG. 1, and the execution process can refer to the above description of step S240.
  • the position determination module 120 is further configured to determine whether the target writing position is located in the video buffer space and corresponds to the written data in response to the determination result that the target writing position is not within the position range After the cache location.
  • the position determining module 120 may also perform step S250 in FIG. 1, and the execution process may refer to the description of step S250 above.
  • the cache write module 130 is further configured to detect whether the second cache space is full in response to the judgment result that the target write location is located behind the cache location, and when the second cache is detected When the space is not full, write the I-frame data to be stored into the video buffer space for buffering according to the target writing position.
  • the cache writing module 130 can also perform step S260 and step S280 in FIG. 1, and the execution process can refer to the description of step S260 and step S280 above.
  • the storage writing module 140 is further configured to write all the video data buffered in the video buffer space to the video buffer space when the buffer writing module 130 detects that the second buffer space is full. Store in the memory space of the terminal device, and clear the video buffer space, so that the buffer writing module 130 directly writes the I-frame data to be stored into the emptied first buffer space of the video buffer space Cache.
  • the storage writing module 140 may also execute part of the content of step S270 in FIG. 1, and the cache writing module 130 may also execute the remaining content of step S270 in FIG. 1.
  • the execution process can be referred to Step S270 is described above.
  • the storage writing module 140 is further configured to directly write the to-be-stored I frame data into the memory space of the terminal device in response to the judgment result that the target writing position is not located behind the cache position. storage.
  • the storage writing module 140 may also execute step S290 in FIG. 1, and the execution process may refer to the description of step S290 above.
  • the buffer writing module 130 is further configured to directly write the I-frame data to be stored into the first buffer space for buffering when it is detected that there is no written data in the video buffer space. .
  • the cache writing module 130 can also execute step S300 in FIG. 1, and the execution process can refer to the description of step S300 above.
  • FIG. 4 is a block diagram of a video data storage device 100 provided by an embodiment of the present application.
  • the video data storage device 100 may further include a statistical calculation module 150 and a capacity configuration module 160.
  • the statistical calculation module 150 is configured to count the amount of video data and the number of I-frame groups received by the terminal device in the one data storage period when a data storage period ends, and according to the video statistics obtained The data amount and the number of I frame groups calculate the average data amount of the I frame group video data.
  • the statistical calculation module 150 can also execute step S310 in FIG. 2, and the execution process can refer to the description of step S310 above.
  • the capacity configuration module 160 is configured to adjust the respective space capacities of the first buffer space and the second buffer space according to the average data volume of the I-frame group video data, so that the first buffer space and The average data amount of at least one I-frame group video data can be written into the second buffer space.
  • the capacity configuration module 160 may also perform step S320 in FIG. 2, and the execution process may refer to the description of step S320 above.
  • this application detects whether there is written data in the video buffer space when receiving the to-be-stored I-frame data included in the I-frame group video data, and In the case where there is written data, it is determined whether to overwrite the written data in the first buffer space of the video buffer space with the I frame data to be stored, to determine whether the I frame data to be stored is Is video data written in a non-sequential manner; then, when the application determines that the I-frame data to be stored is to overwrite the written data in the first buffer space, directly the I-frame data to be stored The frame data is written to the corresponding position in the first buffer space, and it is detected whether the first buffer space is full; then, in the case that the present application determines that the first buffer space is not full, it can be based on all The remaining space capacity of the first buffer space is to buffer the next I-frame group video data to be stored, and when it is determined that the first buffer space is full, the first buffer space and the second buffer of
  • FIG. 5 is a schematic structural diagram of a terminal device provided by an embodiment of the application.
  • the terminal device includes a processor 210 and a memory 220; the number of processors 210 in the financial self-service device may be one or more.
  • a processor 210 is taken as an example; the processor 210 and the memory 220 in the terminal device may be connected by a bus or other methods, and in FIG. 5, the connection by a bus is taken as an example.
  • the memory 220 can be configured to store software programs, computer-executable programs, and modules, such as the program instructions/modules corresponding to the video data storage device in any of the foregoing embodiments (for example, in the video data storage device).
  • the processor 210 executes at least one functional application and data processing of the video data storage device by running software programs, instructions, and modules stored in the memory 220, that is, realizes the operations of the video data storage device described above.
  • the memory 220 may mainly include a storage program area and a storage data area.
  • the storage program area may store an operating system and an application program required by at least one function; the storage data area may store data created according to the use of the video data storage device, and the like.
  • the memory 220 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state storage devices.
  • the memory 220 may include memories remotely provided with respect to the processor 210, and these remote memories may be connected to a deposit device through a network. Examples of the aforementioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
  • This embodiment also provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the video data storage method provided by any of the foregoing embodiments is implemented.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • General Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

本申请提供一种视频数据存储方法、装置、终端设备及存储介质。所述方法包括:在接收到待存储I帧数据的情况下,检测视频缓存空间中是否存在已写入数据;在检测到视频缓存空间中存在已写入数据的情况下,读取待存储I帧数据的目标写入位置,并判断目标写入位置是否位于第一缓存空间中的与已写入数据对应的位置范围内;响应于目标写入位置位于第一缓存空间中的与已写入数据对应的位置范围内的判断结果,按照目标写入位置将待存储I帧数据写入到第一缓存空间中进行缓存,并检测第一缓存空间是否被写满;在检测到第一缓存空间被写满的情况下,将视频缓存空间缓存的所有视频数据写入到终端设备的内存空间中进行存储,并清空视频缓存空间。。

Description

视频数据存储方法、装置、终端设备及存储介质
本申请要求在2019年05月09日提交中国专利局、申请号为201910382809.8的中国专利申请的优先权,该申请的全部内容通过引用结合在本申请中。
技术领域
本申请涉及视频数据块存储技术领域,例如,涉及一种视频数据存储方法、装置、终端设备及存储介质。
背景技术
随着网络技术的不断发展,块存储模式通常被用于实现多种行业(例如,视频监控行业、网络通信行业等)的数据存储,但过度频繁的小块存储会致使数据存储设备的内存空间碎片化,进而导致该数据存储设备的存储性能变差。为此,大多数数据存储设备都会为内存空间增加固定容量的缓存空间,并通过缓存空间对需要写入到内存空间的数据进行中转缓存,以在满足一定条件时将该缓存空间内缓存的数据写入到内存空间中进行存储,从而降低内存写入次数,提高设备的存储性能。
大多数的数据存储设备只能将数据顺序写入到缓存空间进行缓存。当数据存储设备被用于存储视频数据时,该数据存储设备在每次完成对非顺序写入视频数据的缓存操作(例如,对已缓存到缓存空间中的I帧组视频数据的帧组头部进行数据回写)后,会在该缓存空间未被填满的情况下直接将当前已缓存的视频数据提前写入到内存空间中,从而无法充分利用缓存空间,导致数据存储设备的存储性能无法达到较佳状态。
发明内容
本申请提供了一种视频数据存储方法、装置、终端设备及存储介质,可在实现对非顺序写入的I帧组视频数据的缓存操作的同时,对视频缓存空间的空间容量进行充分利用,降低内存写入次数,提高每次内存写入操作的数据写入量,使终端设备的存储性能达到较佳状态。
本申请实施例提供一种视频数据存储方法,应用于包括视频缓存空间的终端设备,其中,所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,且所述第一缓存空间与所述第二缓存空间均可写入至少一个I帧组视频数据,所述方法包括:
在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测所述视频缓存空间中是否存在已写入数据;
在检测到所述视频缓存空间中存在已写入数据的情况下,读取该待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于所述第一缓存空间中的与已写入数据对应的位置范围内;
响应于所述目标写入位置位于所述位置范围内的判断结果,按照所述目标写入位置将该待存储I帧数据写入到所述第一缓存空间中进行缓存,并检测所述第一缓存空间是否被写满;
在检测到所述第一缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间。
本申请实施例提供一种视频数据存储装置,应用于包括视频缓存空间的终端设备,其中所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,且所述第一缓存空间与所述第二缓存空间均可写入至少一个I帧组视频数据,所述装置包括:
已写入检测模块,设置为在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测所述视频缓存空间中是否存在已写入数据;
位置判断模块,设置为在检测到所述视频缓存空间中存在已写入数据的情况下,读取该待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于所述第一缓存空间中的与已写入数据对应的位置范围内;
缓存写入模块,设置为响应于所述目标写入位置位于所述位置范围内的判断结果,按照所述目标写入位置将该待存储I帧数据写入到所述第一缓存空间中进行缓存,并检测所述第一缓存空间是否被写满;
存储写入模块,设置为在检测到所述第一缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间。
本申请实施例提供一种终端设备,包括处理器和存储器,存储器存储有计算机程序,所述计算机程序被所述处理器执行时实现如上所述的方法。
本申请实施例提供一种计算机可读存储介质,存储有计算机程序,所述计算机程序被所述处理器执行时实现如上所述的方法。
附图说明
图1为本申请实施例提供的一种视频数据存储方法的流程示意图;
图2为本申请实施例提供的另一种视频数据存储方法的流程示意图;
图3为本申请实施例提供的一种视频数据存储装置的方框示意图;
图4为本申请实施例提供的另一种视频数据存储装置的方框示意图;
图5为本申请实施例提供的一种终端设备的结构示意图。
图标:100-视频数据存储装置;110-已写入检测模块;120-位置判断模块;130-缓存写入模块;140-存储写入模块;150-统计计算模块;160-容量配置模块;210-处理器;220-存储器。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行描述,本文所描述的实施例是本申请一部分实施例,而不是全部的实施例。在本文附图中描述和示出的本申请实施例的组件可以以多种不同的配置来布置和设计。
因此,对在本文附图中提供的本申请的实施例的描述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实施例。相似的标号和字母在本文附图中表示类似项,因此,一旦一项在一个附图中被定义,则在随后的附图中不需要对其进行定义和解释。
在本申请的描述中,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。。
下面结合附图,对本申请的一些实施方式进行说明。请参照图1,图1是本申请实施例提供的一种视频数据存储方法的流程示意图。在本申请实施例中,所述视频数据存储方法应用于包括视频缓存空间的终端设备,由所述终端设备基于所述视频缓存空间在实现对非顺序写入的I帧组视频数据的缓存操作的同时,对所述视频缓存空间的空间容量进行充分利用,从而降低整体的内存写入次数,提高每次内存写入操作的数据写入量,使终端设备的存储性能达到较佳状态。本实施例中,所述终端设备包括至少一个随机存取存储器(Random Access Memory,RAM)及至少一个只读存储器(Read Only Memory,ROM),所述终端设备通过所述至少一个RAM构建出用于对I帧组视频数据进行中转缓存的视频缓存空间,所述终端设备通过所述至少一个ROM构建出对应的用于对I帧组视频数据进行存储的内存空间。在本实施例中,所述终端设备可以是,但不限于,个人电脑(Personal Computer,PC)、服务器、平板电脑、个人数字助理(Personal Digital Assistant,PDA)、移动上网设备(Mobile Internet Device, MID)等。
在本实施例中,所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,所述第一缓冲空间与所述第二缓存空间均可写入至少一个I帧组视频数据的平均数据量,所述I帧组视频数据的平均数据量为所述终端设备在一段时间段内接收到的多个I帧组视频数据的数据量之间的平均值,所述第一缓存空间的空间容量可与所述第二缓存空间的空间容量不同。所述终端设备在将视频数据写入到所述视频缓存空间中进行缓存时,会优先考虑将视频数据写入第一缓存空间,并在确定所述第一缓存空间被写满后将对应的视频数据写入第二缓存空间。下面对图1所示的视频数据存储方法的流程和步骤进行阐述。
步骤S210,在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测所述视频缓存空间中是否存在已写入数据。
在本实施例中,所述终端设备在接收到一个待存储I帧组视频数据所包括的任意一份待存储I帧数据的情况下,将对应检测所述视频缓存空间中是否存在已写入数据。一实施例中,一份待存储I帧数据所对应的数据容量等于所述视频缓存空间中的一个缓存单元的数据容量,所述终端设备可通过直接检测所述第一缓存空间中是否存在已写入数据来检测所述视频缓存空间中是否存在已写入数据。在检测到所述视频缓存空间中存在已写入数据的情况下,所述终端设备将对应执行步骤S220;在检测到所述视频缓存空间中不存在已写入数据的情况下,所述终端设备将对应执行步骤S300。在本实施例的一种实施方式中,所述视频缓存空间中的一个缓存单元的数据容量为64KB。
步骤S220,读取该待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于第一缓存空间中的与已写入数据对应的位置范围内。
在本实施例中,在所述终端设备检测到所述视频缓存空间中存在已写入数据的情况下,所述终端设备将对应读取所述待存储I帧数据在所述视频缓存空间处缓存的目标写入位置,以通过该目标写入位置判断该待存储I帧数据是否为该待存储I帧组视频数据中的帧组头部所对应的回写内容。本实施例中,所述终端设备在判断出所述待存储I帧数据的目标写入位置位于所述第一缓存空间中的与已写入数据对应的位置范围内的情况下,将判定该待存储I帧数据为该待存储I帧组视频数据中的所述回写内容,所述终端设备将对应执行步骤S230;所述终端设备在判断出所述待存储I帧数据的目标写入位置不位于所述第一缓存空间中的与已写入数据对应的位置范围内的情况下,将判定该待存储I帧数据不为所述回写内容,所述终端设备将对应执行步骤S250。
步骤S230,按照所述目标写入位置将该待存储I帧数据写入到所述第一缓 存空间中进行缓存,并检测所述第一缓存空间是否被写满。
在本实施例中,当所述终端设备判断出该待存储I帧数据的目标写入位置位于所述第一缓存空间中的与已写入数据对应的位置范围内的情况下,所述终端设备直接以所述待存储I帧数据对所述第一缓存空间中的与所述目标写入位置对应的已写入数据进行覆盖写入,以将该待存储I帧数据缓存到所述第一缓存空间中,从而完成对该待存储I帧数据所对应的待存储I帧组视频数据的缓存流程。而后,所述终端设备将检测所述第一缓存空间是否被写满,以判断是否将所述第一缓存空间及所述第二缓存空间各自缓存的视频数据写入到所述终端设备的内存空间中进行存储。
在本实施例的一种实施方式中,所述检测所述第一缓存空间是否被写满的步骤包括:统计所述第一缓存空间及所述第二缓存空间各自缓存的视频数据的数据量,并计算得到所述视频缓存空间缓存的总视频数据量;将所述总视频数据量与所述第一缓存空间的空间容量进行比较;在所述总视频数据量不小于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间被写满,在所述总视频数据量小于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间未写满。
在本实施例的另一种实施方式中,所述检测所述第一缓存空间是否被写满的步骤包括:统计所述第一缓存空间当前缓存的视频数据的数据量;将统计得到的所述数据量与所述第一缓存空间的空间容量进行比较;在所述数据量小于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间未写满;在所述数据量等于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间被写满。
在本实施例中,在所述终端设备检测到所述第一缓存空间被写满的情况下,所述终端设备将直接判定所述视频缓存空间当前无法对下一待存储I帧组视频数据进行缓存,此时所述终端设备将对应执行步骤S240;在所述终端设备检测到所述第一缓存空间未写满的情况下,所述终端设备可基于所述第一缓存空间剩余的空间容量对下一待存储I帧组视频数据进行缓存,例如所述终端设备在接收到下一待存储I帧组视频数据的与帧组头部对应的I帧数据的情况下,会以所述第一缓存空间剩余的空间容量对所述与帧组头部对应的I帧数据进行缓存。
步骤S240,将所述视频缓存空间缓存的所有视频数据全部写入到终端设备的内存空间中进行存储,并清空所述视频缓存空间。
在本实施例中,在所述终端设备完成对所述I帧数据的数据回写过程并检测到所述第一缓存空间被写满的情况下,所述终端设备直接将所述视频缓存空间的第一缓存空间及第二缓存空间各自当前缓存的所有视频数据全部写入到所述 终端设备的内存空间中进行存储,并对所述视频缓存空间进行清空,以通过清空后的所述视频缓存空间对下一待存储I帧组视频数据进行缓存。
在本实施例中,所述终端设备通过执行所述视频数据存储方法所包括的上述的步骤S210~步骤S240的方式,在实现对非顺序写入的I帧组视频数据的缓存操作的同时,对视频缓存空间的空间容量进行充分利用,以降低内存写入次数,提高每次将数据写入内存时的数据写入量,使终端设备的存储性能达到较佳状态。
请再次参照图1,所述视频数据存储方法还包括:
步骤S250,判断所述目标写入位置是否位于所述视频缓存空间中与已写入数据对应的缓存位置之后。
在本实施例中,在所述终端设备判定所述待存储I帧数据的目标写入位置不位于所述第一缓存空间中的与已写入数据对应的位置范围内的情况下,所述终端设备将判断该待存储I帧数据的目标写入位置是否位于所述视频缓存空间中与已写入数据对应的缓存位置之后。在所述终端设备判定所述目标写入位置位于所述视频缓存空间中与已写入数据对应的缓存位置之后的情况下,所述终端设备将判定该待存储I帧数据为对应待存储I帧组视频数据中的帧组中间数据或帧组尾部数据,此时所述终端设备将对应执行步骤S260;在所述终端设备判定所述目标写入位置不位于所述视频缓存空间中与已写入数据对应的缓存位置之后(例如,所述目标写入位置位于所述视频缓存空间之前,或所述目标写入位置超出所述视频缓存空间)的情况下,所述终端设备将判定该待存储I帧数据为异常视频数据,此时所述终端设备将对应执行步骤S290。
步骤S260,检测第二缓存空间是否被写满。
在本实施例中,在所述终端设备判定该待存储I帧数据的目标写入位置不位于所述第一缓存空间中的与已写入数据对应的位置范围内,而位于所述视频缓存空间中与已写入数据对应的缓存位置之后的情况下,所述终端设备将检测所述第二缓存空间是否被写满,以判断所述待存储I帧数据是否能够被写入到所述视频缓存空间中进行缓存。
在本实施例的一种实施方式中,所述检测第二缓存空间是否被写满的步骤包括:统计所述第一缓存空间及所述第二缓存空间各自缓存的视频数据的数据量,并计算得到所述视频缓存空间缓存的总视频数据量;将所述总视频数据量与所述待存储I帧数据的数据量进行相加运算,并将相加得到的总数据量与所述视频缓存空间的总空间容量进行比较;在所述总数据量不小于所述总空间容量的情况下,判定所述第二缓存空间被写满,在所述总数据量小于所述总空间容 量的情况下,判定所述第二缓存空间未写满。
在本实施例的另一种实施方式中,所述检测第二缓存空间是否被写满的步骤包括:统计所述第二缓存空间当前缓存的视频数据的数据量;将统计得到的所述数据量与所述第二缓存空间的空间容量进行比较;在所述数据量小于所述第二缓存空间的空间容量的情况下,判定所述第二缓存空间未写满;在所述数据量等于所述第二缓存空间的空间容量的情况下,判定所述第二缓存空间被写满。
在本实施例中,在所述终端设备判定该待存储I帧数据的目标写入位置位于所述视频缓存空间中与已写入数据对应的缓存位置之后,且所述第二缓存空间未写满的情况下,所述终端设备将直接以所述视频缓存空间当前剩余的空间容量对该待存储I帧数据进行缓存,所述终端设备将对应执行步骤S280;在所述终端设备判定该待存储I帧数据的目标写入位置位于所述视频缓存空间中与已写入数据对应的缓存位置之后,且所述第二缓存空间被写满的情况下,所述终端设备将直接判定所述视频缓存空间当前无法对该待存储I帧数据进行缓存,此时所述终端设备将对应执行步骤S270。
步骤S270,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,而后清空所述视频缓存空间,并将该待存储I帧数据直接写入到清空后的所述视频缓存空间的第一缓存空间中进行缓存。
在本实施例中,在所述终端设备判定所述视频缓存空间当前无法对该待存储I帧数据进行缓存的情况下,所述终端设备会将所述视频缓存空间缓存的所有视频数据全部写入到所述终端设备的内存空间中进行存储,而后清空所述视频缓存空间,并使所述终端设备将当前的所述待存储I帧数据直接写入到清空后的所述视频缓存空间的第一缓存空间中进行缓存,使所述终端设备以当前视频缓存空间对当前待存储I帧组视频数据的剩余待存储I帧数据进行缓存。
步骤S280,按照所述目标写入位置将该待存储I帧数据写入到所述视频缓存空间中进行缓存。
在本实施例中,在所述终端设备判定所述视频缓存空间当前仍可对该待存储I帧数据进行缓存的情况下,所述终端设备直接将该待存储I帧数据写入到所述视频缓存空间中的与所述目标写入位置对应的位置处进行缓存。本实施例中,在所述第一缓存空间未写满的情况下,所述终端设备直接将该待存储I帧数据写入到所述目标写入位置在所述第一缓存空间中对应的位置处;在所述第一缓存空间被写满的情况下,所述终端设备直接将该待存储I帧数据写入到所述目标写入位置在所述第二缓存空间中对应的位置处。
请再次参照图1,所述视频数据存储方法还包括:
步骤S290,直接将该待存储I帧数据写入到所述终端设备的内存空间中进行存储。
在本实施例中,在所述终端设备判定所述目标写入位置不位于所述视频缓存空间中与已写入数据对应的缓存位置之后的情况下,该待存储I帧数据将被判定为异常视频数据,此时所述终端设备将该存储I帧数据写入到所述终端设备的内存空间中进行存储。一实施例中,在该待存储I帧数据为与已写入内存空间的当前待存储I帧组视频数据的帧组头部对应的回写内容的情况下,所述终端设备将直接以该待存储I帧数据对被写入内存空间的所述待存储I帧组视频数据的帧组头部数据进行覆盖写入。
请再次参照图1,所述视频数据存储方法还包括:
步骤S300,直接将该待存储I帧数据写入到所述第一缓存空间中进行缓存。
在本实施例中,在所述终端设备在执行完所述步骤S210,并确定所述视频缓存空间中不存在已写入数据的情况下,所述第一缓存空间也无已写入数据,所述终端设备将判定该待存储I帧数据为当前待存储I帧组视频数据的待回写的帧组头部数据,并将该待存储I帧数据写入到所述第一缓存空间中进行缓存,以通过所述视频缓存空间剩余的空间容量对当前待存储I帧组视频数据的剩余待存储视频数据进行缓存。
请参照图2,图2是本申请实施例提供的另一种视频数据存储方法的流程示意图。在本申请实施例中,所述视频数据存储方法还包括:
步骤S310,在一个数据存储周期结束的情况下,统计所述终端设备在所述一个数据存储周期内接收到的视频数据量,并根据统计得到的视频数据量计算一个I帧组视频数据的平均数据量。
在本实施例中,所述数据存储周期用于表示所述终端设备需要在所述数据存储周期所对应的时间段内对视频数据进行存储,所述数据存储周期可以是1小时,也可以是1.5小时,还可以是3小时。所述终端设备在每个数据存储周期所对应的工作时长被消耗完的情况下,所述终端设备将对应统计该终端设备在该数据存储周期内接收到的视频数据量及I帧组数目,并根据统计得到的所述视频数据量及所述I帧组数目计算出I帧组视频数据在该数据存储周期的平均数据量。
步骤S320,根据所述I帧组视频数据的平均数据量对所述第一缓存空间及所述第二缓存空间各自的空间容量进行调整,使所述第一缓存空间与所述第二缓存空间均可写入至少一个所述I帧组视频数据的平均数据量。
在本实施例中,所述终端设备在每次计算出对应的I帧组视频数据的平均数据量的情况下,会将当前计算出的I帧组视频数据的平均数据量与上次计算出的I帧组视频数据的平均数据量进行比较。若当前计算出的所述平均数据量与上次计算出的所述平均数据量相同,则所述终端设备当前配置的所述第一缓存空间及所述第二缓存空间各自的空间容量无需进行调整,仍旧保持在可写入至少一个所述I帧组视频数据的平均数据量的状态;在当前计算出的所述平均数据量不与上次计算出的所述平均数据量相同的情况下,所述终端设备将以该终端设备在该数据存储周期内的视频数据量接收速度,计算出要调整到位的所述第一缓存空间及所述第二缓存空间各自的目标空间容量,并根据得到的目标空间容量动态调整所述第一缓存空间当前的空间容量及所述第二缓存空间当前的空间容量。
在本实施例的一种实施方式中,所述终端设备选取最小固有缓存容量数值,与由视频数据量接收速度及固有系数计算得到的容量积值中的最大数值,作为所述第一缓存空间的目标空间容量。一实施例中,所述最小固有缓存容量不小于本次计算出的I帧组视频数据的平均数据量,所述固有系数可以是5、6或7。
在本实施例的一种实施方式中,所述终端设备选取由视频数据量接收速度及缓存扩展系数计算得到的容量积值,作为所述第二缓存空间的目标空间容量。一实施例中,所述缓存扩展系数可以是1.2、2.5或3。
请参照图3,图3是本申请实施例提供的一种视频数据存储装置100的方框示意图。在本申请实施例中,所述视频数据存储装置100应用于包括视频缓存空间的终端设备,本实施例中,所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,所述第一缓存空间与所述第二缓存空间均可写入至少一个I帧组视频数据。本实施例中,所述视频数据存储装置100包括已写入检测模块110、位置判断模块120、缓存写入模块130及存储写入模块140。
所述已写入检测模块110,设置为在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测视频缓存空间中是否存在已写入数据。
在本实施例中,所述已写入检测模块110可以执行图1中的步骤S210,执行过程可参照上文中对步骤S210的描述。
所述位置判断模块120,设置为在检测到所述视频缓存空间中存在已写入数据的情况下,读取该待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于第一缓存空间中的与已写入数据对应的位置范围内。
在本实施例中,所述位置判断模块120可以执行图1中的步骤S220,执行 过程可参照上文中对步骤S220的描述。
所述缓存写入模块130,设置为响应于所述目标写入位置位于所述位置范围内的判断结果,按照所述目标写入位置将该待存储I帧数据写入到所述第一缓存空间中进行缓存,并检测所述第一缓存空间是否被写满。
在本实施例中,所述缓存写入模块130可以执行图1中的步骤S230,执行过程可参照上文中对步骤S230的描述。
所述存储写入模块140,设置为在检测到所述第一缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到终端设备的内存空间中进行存储,并清空所述视频缓存空间。
在本实施例中,所述存储写入模块140可以执行图1中的步骤S240,执行过程可参照上文中对步骤S240的描述。
所述位置判断模块120,还设置为响应于所述目标写入位置不位于所述位置范围内的判断结果,判断所述目标写入位置是否位于所述视频缓存空间中与已写入数据对应的缓存位置之后。
在本实施例中,所述位置判断模块120还可以执行图1中的步骤S250,执行过程可参照上文中对步骤S250的描述。
所述缓存写入模块130,还设置为响应于所述目标写入位置位于所述缓存位置之后的判断结果,检测所述第二缓存空间是否被写满,并在检测到所述第二缓存空间未写满的情况下,按照所述目标写入位置将该待存储I帧数据写入到所述视频缓存空间中进行缓存。
在本实施例中,所述缓存写入模块130还可以执行图1中的步骤S260及步骤S280,执行过程可参照上文中对步骤S260及步骤S280的描述。
所述存储写入模块140,还设置为在所述缓存写入模块130检测到所述第二缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间,使所述缓存写入模块130将该待存储I帧数据直接写入到清空后的所述视频缓存空间的第一缓存空间中进行缓存。
在本实施例中,所述存储写入模块140还可以执行图1中的步骤S270的部分内容,所述缓存写入模块130还可以执行图1中的步骤S270的剩余内容,执行过程可参照上文中对步骤S270的描述。
所述存储写入模块140,还设置为响应于所述目标写入位置不位于所述缓存位置之后的判断结果,直接将该待存储I帧数据写入到所述终端设备的内存空间 中进行存储。
在本实施例中,所述存储写入模块140还可以执行图1中的步骤S290,执行过程可参照上文中对步骤S290的描述。
所述缓存写入模块130,还设置为在检测到所述视频缓存空间中不存在已写入数据的情况下,直接将该待存储I帧数据写入到所述第一缓存空间中进行缓存。
在本实施例中,所述缓存写入模块130还可以执行图1中的步骤S300,执行过程可参照上文中对步骤S300的描述。
请参照图4,图4是本申请实施例提供的一种视频数据存储装置100的方框示意图。在本申请实施例中,所述视频数据存储装置100还可以包括统计计算模块150及容量配置模块160。
所述统计计算模块150,设置为在一个数据存储周期结束的情况下,统计所述终端设备在所述一个数据存储周期内接收到的视频数据量及I帧组数目,并根据统计得到的视频数据量及I帧组数目计算I帧组视频数据的平均数据量。
在本实施例中,所述统计计算模块150还可以执行图2中的步骤S310,执行过程可参照上文中对步骤S310的描述。
所述容量配置模块160,设置为根据所述I帧组视频数据的平均数据量对所述第一缓存空间及所述第二缓存空间各自的空间容量进行调整,使所述第一缓存空间与所述第二缓存空间均可写入至少一个所述I帧组视频数据的平均数据量。
在本实施例中,所述容量配置模块160还可以执行图2中的步骤S320,执行过程可参照上文中对步骤S320的描述。
在本申请提供的视频数据存储方法及装置中,本申请在接收到待存储I帧组视频数据所包括的待存储I帧数据的情况下,检测视频缓存空间中是否存在已写入数据,并在存在已写入数据的情况下判断是否要以该待存储I帧数据对所述视频缓存空间的第一缓存空间中的已写入数据进行覆盖写入,以判断该待存储I帧数据是否为非顺序写入的视频数据;而后,本申请在判定该待存储I帧数据是要对所述第一缓存空间中的已写入数据进行覆盖写入的情况下,直接将该待存储I帧数据写入到所述第一缓存空间中对应的位置处,并检测该第一缓存空间是否被写满;接着,本申请在判定该第一缓存空间未写满的情况下,可基于所述第一缓存空间剩余的空间容量对下一待存储I帧组视频数据进行缓存,并在判定该第一缓存空间被写满的情况下,将视频缓存空间的第一缓存空间及第二缓存空间缓存的所有视频数据全部写入到终端设备的内存空间中进行存储,并清空 所述视频缓存空间,从而在实现对非顺序写入的I帧组视频数据的缓存操作的同时,对视频缓存空间的空间容量进行充分利用,以提高每次内存写入操作的数据写入量,降低内存写入次数,使终端设备的存储性能达到较佳状态。
图5为本申请实施例提供的一种终端设备的结构示意图,如图5所示,该终端设备包括处理器210和存储器220;金融自助设备中处理器210的数量可以是一个或多个,图5中以一个处理器210为例;终端设备中的处理器210和存储器220可以通过总线或其他方式连接,图5中以通过总线连接为例。
存储器220作为一种计算机可读存储介质,可设置为存储软件程序、计算机可执行程序以及模块,如上述任意实施例中的视频数据存储装置对应的程序指令/模块(例如,视频数据存储装置中的已写入检测模块110、位置判断模块120、缓存写入模块130及存储写入模块140)。处理器210通过运行存储在存储器220中的软件程序、指令以及模块,从而执行视频数据存储装置的至少一种功能应用以及数据处理,即实现上述的视频数据存储装置的操作。
存储器220可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序;存储数据区可存储根据视频数据存储装置的使用所创建的数据等。此外,存储器220可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他非易失性固态存储器件。在一些实例中,存储器220可包括相对于处理器210远程设置的存储器,这些远程存储器可以通过网络连接至存款装置。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。
本实施例还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,该程序被处理器执行时实现上述任意实施例提供的视频数据存储方法。

Claims (12)

  1. 一种视频数据存储方法,应用于包括视频缓存空间的终端设备,其中,所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,且所述第一缓存空间与所述第二缓存空间均支持写入至少一个I帧组视频数据,所述方法包括:
    在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测所述视频缓存空间中是否存在已写入数据;
    在检测到所述视频缓存空间中存在所述已写入数据的情况下,读取所述待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于所述第一缓存空间中的与所述已写入数据对应的位置范围内;
    响应于所述目标写入位置位于所述位置范围内的判断结果,按照所述目标写入位置将所述待存储I帧数据写入到所述第一缓存空间中进行缓存,并检测所述第一缓存空间是否被写满;
    在检测到所述第一缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间。
  2. 根据权利要求1所述的方法,其中,所述检测所述第一缓存空间是否被写满,包括:
    统计所述第一缓存空间及所述第二缓存空间各自缓存的视频数据的数据量,并计算得到所述视频缓存空间缓存的总视频数据量;
    将所述总视频数据量与所述第一缓存空间的空间容量进行比较;
    在所述总视频数据量不小于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间被写满,在所述总视频数据量小于所述第一缓存空间的空间容量的情况下,判定所述第一缓存空间未写满。
  3. 根据权利要求1或2所述的方法,还包括:
    响应于所述目标写入位置不位于所述位置范围内的判断结果,判断所述目标写入位置是否位于所述视频缓存空间中与所述已写入数据对应的缓存位置之后;
    响应于所述目标写入位置位于所述缓存位置之后的判断结果,检测所述第二缓存空间是否被写满;
    在检测到所述第二缓存空间未写满的情况下,按照所述目标写入位置将所述待存储I帧数据写入到所述视频缓存空间中进行缓存,在检测到所述第二缓存空间写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端 设备的内存空间中进行存储,清空所述视频缓存空间,并将所述待存储I帧数据写入到清空后的所述视频缓存空间的第一缓存空间中进行缓存。
  4. 根据权利要求3所述的方法,还包括:
    响应于所述目标写入位置不位于所述缓存位置之后的判断结果,将所述待存储I帧数据写入到所述终端设备的内存空间中进行存储。
  5. 根据权利要求1-4中任意一项所述的方法,还包括:
    在检测到所述视频缓存空间中不存在所述已写入数据的情况下,将所述待存储I帧数据写入到所述第一缓存空间中进行缓存。
  6. 根据权利要求1-5中任一项所述的方法,还包括:
    在一个数据存储周期结束的情况下,统计所述终端设备在所述一个数据存储周期内接收到的视频数据量及I帧组数目,并根据统计得到的所述视频数据量及所述I帧组数目计算I帧组视频数据的平均数据量;
    根据所述I帧组视频数据的平均数据量对所述第一缓存空间及所述第二缓存空间各自的空间容量进行调整,使所述第一缓存空间与所述第二缓存空间均支持写入至少一个所述I帧组视频数据的平均数据量。
  7. 一种视频数据存储装置,应用于包括视频缓存空间的终端设备,其中,所述视频缓存空间包括第一缓存空间及第二缓存空间,所述第一缓存空间的写入优先级大于所述第二缓存空间的写入优先级,且所述第一缓存空间与所述第二缓存空间均支持写入至少一个I帧组视频数据,所述装置包括:
    已写入检测模块,设置为在接收到待存储I帧组视频数据包括的待存储I帧数据的情况下,检测所述视频缓存空间中是否存在已写入数据;
    位置判断模块,设置为在检测到所述视频缓存空间中存在所述已写入数据的情况下,读取所述待存储I帧数据的目标写入位置,并判断所述目标写入位置是否位于所述第一缓存空间中的与所述已写入数据对应的位置范围内;
    缓存写入模块,设置为响应于所述目标写入位置位于所述第一缓存空间中的与所述已写入数据对应的位置范围内的判断结果,按照所述目标写入位置将所述待存储I帧数据写入到所述第一缓存空间中进行缓存,并检测所述第一缓存空间是否被写满;
    存储写入模块,设置为在检测到所述第一缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间。
  8. 根据权利要求7所述的装置,其中,所述位置判断模块,还设置为响应于 所述目标写入位置不位于所述位置范围内的判断结果,判断所述目标写入位置是否位于所述视频缓存空间中与所述已写入数据对应的缓存位置之后;
    所述缓存写入模块,还设置为响应于所述目标写入位置位于所述缓存位置之后的判断结果,检测所述第二缓存空间是否被写满,并在检测到所述第二缓存空间未写满的情况下,按照所述目标写入位置将所述待存储I帧数据写入到所述视频缓存空间中进行缓存;
    所述存储写入模块,还设置为在所述缓存写入模块检测到所述第二缓存空间被写满的情况下,将所述视频缓存空间缓存的所有视频数据写入到所述终端设备的内存空间中进行存储,并清空所述视频缓存空间,使所述缓存写入模块将所述待存储I帧数据写入到清空后的所述视频缓存空间的第一缓存空间中进行缓存;
    所述存储写入模块,还设置为响应于所述目标写入位置不位于所述缓存位置之后的判断结果,将所述待存储I帧数据写入到所述终端设备的内存空间中进行存储。
  9. 根据权利要求7或8所述的装置,其中,所述缓存写入模块,还设置为在检测到所述视频缓存空间中不存在所述已写入数据的情况下,将所述待存储I帧数据写入到所述第一缓存空间中进行缓存。
  10. 根据权利要求7-9中任一项所述的装置,还包括:
    统计计算模块,设置为在一个数据存储周期结束的情况下,统计所述终端设备在所述一个数据存储周期内接收到的视频数据量及I帧组数目,并根据统计得到的所述视频数据量及所述I帧组数目计算I帧组视频数据的平均数据量;
    容量配置模块,设置为根据所述I帧组视频数据的平均数据量对所述第一缓存空间及所述第二缓存空间各自的空间容量进行调整,使所述第一缓存空间与所述第二缓存空间均支持写入至少一个所述I帧组视频数据的平均数据量。
  11. 一种终端设备,包括处理器和存储器,所述存储器存储有计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1-6任一项所述的方法。
  12. 一种计算机可读存储介质,存储有计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1-6任一项所述的方法。
PCT/CN2019/110636 2019-05-09 2019-10-11 视频数据存储方法、装置、终端设备及存储介质 WO2020224184A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
US17/609,694 US11966398B2 (en) 2019-05-09 2019-10-11 Video data storage method, apparatus, terminal device and storage medium
EP19928031.4A EP3968186A4 (en) 2019-05-09 2019-10-11 VIDEO DATA MEMORY METHOD, APPARATUS, TERMINAL DEVICE AND INFORMATION CARRY

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910382809 2019-05-09
CN201910382809.8 2019-05-09

Publications (1)

Publication Number Publication Date
WO2020224184A1 true WO2020224184A1 (zh) 2020-11-12

Family

ID=73051225

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/110636 WO2020224184A1 (zh) 2019-05-09 2019-10-11 视频数据存储方法、装置、终端设备及存储介质

Country Status (4)

Country Link
US (1) US11966398B2 (zh)
EP (1) EP3968186A4 (zh)
CN (1) CN111914116B (zh)
WO (1) WO2020224184A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115297094B (zh) * 2022-10-08 2023-02-28 苏州浪潮智能科技有限公司 视频传输控制方法、装置、设备及计算机可读存储介质
CN115580727B (zh) * 2022-11-16 2023-03-14 苏州浪潮智能科技有限公司 一种视频压缩的丢帧处理方法、装置、服务器及存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359460A (zh) * 2008-09-02 2009-02-04 北京中星微电子有限公司 一种图像旋转显示控制方法和装置
CN101720033A (zh) * 2009-11-24 2010-06-02 北京中星微电子有限公司 一种视频传输设备及其usb传输的装置及方法
CN107229620A (zh) * 2016-03-23 2017-10-03 杭州海康威视数字技术股份有限公司 一种视频数据的存储方法及装置

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8706968B2 (en) 2007-12-06 2014-04-22 Fusion-Io, Inc. Apparatus, system, and method for redundant write caching
KR20140097924A (ko) * 2013-01-30 2014-08-07 한국전자통신연구원 우선 순위를 가지는 이중 캐싱 방법 및 이를 위한 장치
US9270620B2 (en) * 2013-09-25 2016-02-23 International Business Machines Corporation Memory transfer optimization of network adapter data placement when performing header-data split operations
JP2017010396A (ja) * 2015-06-24 2017-01-12 富士通株式会社 ストレージ装置、キャッシュ書込制御方法及びキャッシュ書込制御プログラム
US10019372B2 (en) 2015-12-16 2018-07-10 Western Digital Technologies, Inc. Caching sensing device data in data storage device
US10123040B2 (en) * 2016-08-30 2018-11-06 Qualcomm Incorporated Intra-coded video frame caching for video telephony sessions
CN107329694B (zh) * 2017-06-22 2021-05-18 苏州奈特力智能科技有限公司 数据存储控制方法、控制装置及存储设备
CN108055556B (zh) * 2017-11-16 2019-09-03 北京达佳互联信息技术有限公司 数据处理方法和装置
CN109597568B (zh) * 2018-09-18 2022-03-04 天津字节跳动科技有限公司 一种数据存储方法、装置、终端设备及存储介质

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359460A (zh) * 2008-09-02 2009-02-04 北京中星微电子有限公司 一种图像旋转显示控制方法和装置
CN101720033A (zh) * 2009-11-24 2010-06-02 北京中星微电子有限公司 一种视频传输设备及其usb传输的装置及方法
CN107229620A (zh) * 2016-03-23 2017-10-03 杭州海康威视数字技术股份有限公司 一种视频数据的存储方法及装置

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
See also references of EP3968186A4

Also Published As

Publication number Publication date
CN111914116B (zh) 2024-04-05
US11966398B2 (en) 2024-04-23
EP3968186A4 (en) 2023-05-17
US20220222257A1 (en) 2022-07-14
CN111914116A (zh) 2020-11-10
EP3968186A1 (en) 2022-03-16

Similar Documents

Publication Publication Date Title
US8443152B2 (en) Cache memory capable of adjusting burst length of write-back data in write-back operation
MX2013001941A (es) Combinacion de memoria temporal de escritura con metricas de vaciado dinamicamente ajustables.
TWI688859B (zh) 記憶體控制器與記憶體頁面管理方法
WO2020224184A1 (zh) 视频数据存储方法、装置、终端设备及存储介质
US20170269875A1 (en) Memory system and operating method thereof
CN114860785A (zh) 缓存数据处理系统、方法、计算机设备和存储介质
US11226898B2 (en) Data caching method and apparatus
US20080307169A1 (en) Method, Apparatus, System and Program Product Supporting Improved Access Latency for a Sectored Directory
CN102779098B (zh) 混合缓存的协同式自适应预取方法、装置和系统
CN111459402B (zh) 磁盘可控缓冲写方法、控制器、混合io调度方法及调度器
US9311988B2 (en) Storage control system and method, and replacing system and method
CN116610262A (zh) 降低ssd顺序读延时的方法、装置、设备及介质
US11720486B2 (en) Memory data access apparatus and method thereof
KR20220033976A (ko) 저장 디바이스들에 대한 강화된 선판독 능력
CN104123243A (zh) 数据缓存系统及方法
CN109117388B (zh) 针对内存端缓存的数据动态旁路装置及方法
CN107621926B (zh) 栈区数据存取方法、装置、可读存储介质和计算机设备
JPH06103169A (ja) 中央演算処理装置のリードデータプリフェッチ機構
CN112214178A (zh) 一种存储系统、数据读取方法及数据写入方法
US20190378477A1 (en) Image processing system and memory managing method thereof
JPH0415493B2 (zh)
CN112445794A (zh) 一种大数据系统的缓存方法
US11403034B1 (en) Non-volatile storage class memory data flow with mismatched block sizes
CN110658999A (zh) 一种信息更新方法、装置、设备及计算机可读存储介质
US11687462B1 (en) Configurable caching policy for transferring data via shared memory

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19928031

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

ENP Entry into the national phase

Ref document number: 2019928031

Country of ref document: EP

Effective date: 20211209