WO2017201646A1 - 一种数据存储的方法及设备 - Google Patents

一种数据存储的方法及设备 Download PDF

Info

Publication number
WO2017201646A1
WO2017201646A1 PCT/CN2016/082979 CN2016082979W WO2017201646A1 WO 2017201646 A1 WO2017201646 A1 WO 2017201646A1 CN 2016082979 W CN2016082979 W CN 2016082979W WO 2017201646 A1 WO2017201646 A1 WO 2017201646A1
Authority
WO
WIPO (PCT)
Prior art keywords
storage medium
video data
data
write
target
Prior art date
Application number
PCT/CN2016/082979
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 PCT/CN2016/082979 priority Critical patent/WO2017201646A1/zh
Priority to CN201680003568.6A priority patent/CN107077514B/zh
Publication of WO2017201646A1 publication Critical patent/WO2017201646A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/18Closed-circuit television [CCTV] systems, i.e. systems in which the video signal is not broadcast
    • 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
    • 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/0611Improving I/O performance in relation to response time
    • 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/0638Organizing or formatting or addressing of data
    • G06F3/0643Management of files
    • 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/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • G06F3/0679Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]

Definitions

  • the present invention relates to the field of storage technologies, and in particular, to a data storage method and device.
  • the built-in storage medium is used, but the external storage medium is not supported, but the built-in storage medium is not conducive to data distribution between devices and The flow is limited, the usage scenario is limited, and the cost is high when the capacity of the built-in storage medium is large.
  • the present application provides a data storage method and device, which can solve the problem of low reliability of the write speed of the storage device in the prior art.
  • a first aspect of the present application provides a data storage method, the method being applied to a photographing apparatus, wherein the photographing apparatus includes N storage media, wherein N is a positive integer greater than or equal to 2; the method includes:
  • the preset selection rule includes at least one of the following items: selecting the first target storage medium according to a video code rate of the current shooting setting of the shooting device, and selecting according to an actual writing speed of each storage medium in the shooting device.
  • the first target storage medium selects the first target storage medium according to an equalization algorithm according to a video code rate currently set by the photographing device and an actual write speed of each storage medium in the photographing device.
  • the first target storage medium, or the first target storage medium is calculated according to an application built in the photographing device.
  • the storage information of the corresponding video data may also be recorded and backed up during the process of storing the above video data, which is embodied as:
  • the index file including index information of the video data
  • the index file is written to the first target storage medium in a ping-pong alternate manner.
  • the index file includes at least one index information, where the index information includes an index number, a timestamp of the frame data, an offset of the frame data in the video data, and a length of the frame data, and may further include The number of the storage medium storing the frame data.
  • the video data in the process of storing the captured video, may also be timed to perform an incremental backup or a full backup according to the index file.
  • the backup operation can be performed by using a snapshot or the like.
  • the backup time can be configured according to user requirements or by software, and is not limited.
  • the first target storage medium may be selected according to the storage mode and the video code rate, specifically:
  • the destination storage medium and the video code rate of the current shooting setting of the shooting device Calculating a theoretical write speed required to write the captured video data to the destination storage medium, where the destination storage medium is a storage medium corresponding to the storage mode currently set by the photographing device for storing the video data;
  • a first target storage medium for storing video data is determined according to the theoretical write speed and/or a storage mode currently set by the photographing device. To some extent, the writing speed of video data can be improved.
  • N storage media may be configured for one photographing device, where N is a positive integer greater than or equal to 2.
  • N there may be some storage media that cannot reach the current writing speed, and multiple storage media can be simultaneously selected to write video data in parallel to adapt to the current video data writing speed.
  • the video data in the storage medium is merged into a complete video file.
  • the first target storage medium can be selected according to the writing speed of the storage medium and the theoretical writing speed, and then according to the theoretical writing speed and/or the current setting of the shooting device.
  • the storage mode determines one of the following when determining the first target storage medium for storing video data:
  • the actual write speed of at least two of the N storage media is greater than or equal to the theoretical write speed, selecting the first target storage medium according to user configuration information or an equalization algorithm;
  • the actual writing speed of only one of the N storage media is greater than or equal to the theoretical writing speed, the actual writing speed is greater than or equal to the storage of the theoretical writing speed.
  • the media acts as a temporary storage medium.
  • the video data captured by the photographing device is written into the first target storage medium. At least two things are included:
  • the video data is divided into at least two pieces of data according to an equalization algorithm. And writing the at least two pieces of data into the at least two destination storage media respectively;
  • the at least two pieces of data written to the at least two destination storage media are merged and migrated to a second target storage medium of the N storage media when the shooting device is idle time or low load
  • the second target storage medium is any storage medium of the N storage media, and may be any storage medium other than the at least two destination storage media, and may be any other than the at least two destination storage media.
  • the storage medium may be an internal storage medium, an external storage medium, or a combination of an internal storage medium and an external storage medium. The number, type, or combination of the specific storage medium is not limited.
  • the merging process is: reading index information of each of the at least two pieces of data, and then, according to the index information corresponding to each piece of the at least two pieces of data, according to the time stamp of the frame data, the at least two The block data is stitched together to form a video file.
  • the video data written in the temporary storage medium is migrated to a third target storage medium other than the temporary storage medium, in an idle time or a low load of the photographing device,
  • the third target storage medium is selectable by the user.
  • the storage mode of the current photographing device is the automatic storage mode
  • the video data written in the temporary storage medium may be not migrated and still stored in the temporary storage medium, that is, the temporary storage medium is used as the foregoing A target storage medium.
  • the index file is written into the first target storage by ping-pong alternate manner.
  • this application can also be carried out:
  • the first target storage medium may also be selected according to the storage mode and the write speed, so that it is determined to be stored according to the theoretical write speed and/or the storage mode currently set by the photographing device.
  • the first target storage medium of the video data satisfies at least one of the following:
  • the internal storage medium of the photographing device is selected as the Describe the first target storage medium
  • the storage mode currently set by the photographing device is the internal storage mode, or the currently set storage mode is the automatic mode And selecting the internal storage medium as the first target storage medium;
  • the external storage medium of the photographing device is greater than or equal to the theoretical writing speed, and the storage mode currently set by the photographing device is the external storage mode, the external storage medium is selected as The first target storage medium.
  • the method when the storage mode currently set by the photographing device is an external storage mode, and the internal storage medium is selected as the first target storage medium, the method further includes:
  • video data written in the internal storage medium is synchronized to the external storage medium.
  • video data written in the internal storage medium is synchronized to the external storage medium.
  • the data to be repaired of the internal storage medium is written to the external storage medium to write the data to be repaired to the internal storage medium by an application built in the photographing device or a user configuration manner.
  • the built-in application may be an interactive interface of the photographing device, such as a virtual button or a physical button, and the user configuration mode generally responds to the user's instruction through an APP or a physical button.
  • the external storage medium when the external storage medium is selected as the first target storage medium, if video data cannot be written to the external storage medium, the first target storage medium is switched to the internal storage. Media, and recording frame data written in the internal storage medium after the switching time in the internal storage medium, so that an application or user built in the photographing device is used when the photographing device is idle or under a load
  • the configuration method will write the frame data in the internal storage medium and The frame data written to the external storage medium is merged and migrated to the spare storage medium.
  • the write status can also be monitored in real time, and switched to backup when the write status is abnormal (for example, entering slow write area, dead zone, and other external burst factors cannot be written) Storage media to further improve the stability and integrity of your data. Specifically:
  • the photographing device If it is detected that the video data captured by the photographing device cannot be written into the first target storage medium, switching the first target storage medium to the backup storage medium, and writing the video data captured by the photographing device to the standby Storing a medium such that frame data written in the spare storage medium is written to the first target storage by an application or a user configuration manner built in the photographing apparatus during an idle time or a low load of the photographing apparatus The frame data of the media is merged to form a video file.
  • the video file can be selected for storing the repaired video according to the actual free capacity of the storage medium.
  • the fifth target storage medium may be any storage in each of the N storage media
  • the medium may be an internal storage medium, an external storage medium, or a combination of an internal storage medium and an external storage medium.
  • the number, type, or combination of the specific storage medium is not limited.
  • the target index information includes an index number, frame header information, index information stored in each frame data in the data to be repaired, and a frame written in the internal storage medium after the switching time.
  • the index information of the data may further include storing video data captured by the photographing device The number of the storage medium.
  • the foregoing target index information includes at least one index information, and after the target index information is extracted from the index file, before the repairing the video data by using the data to be repaired, the method further includes:
  • the actual write speed of the storage medium is obtained by the following steps:
  • the actual write speed of the storage medium is obtained by reading a status register of the storage medium or performing a read/write speed test on the storage medium, the read/write speed including a continuous write speed and a random write speed.
  • a second aspect of the present invention also provides a storage device having a function of implementing the behavior of the storage device in the above method design.
  • the functions may be implemented by hardware or by corresponding software implemented by hardware.
  • the hardware or software includes one or more modules corresponding to the functions described above.
  • the modules can be software and/or hardware.
  • the storage device includes a storage module, a processing module, and a write module;
  • the storage module includes N storage media, where N is a positive integer greater than or equal to 2;
  • the processing module is configured to select, in the N storage media, a first target storage medium for storing video data captured by the photographing device according to a preset selection rule before shooting;
  • the writing module is configured to write video data captured by the photographing device to the first target storage medium selected by the processing module;
  • the preset selection rule includes at least one of the following items: selecting the first target storage medium according to a video code rate of the current shooting setting of the shooting device, and selecting according to an actual writing speed of each storage medium in the shooting device.
  • the first target storage medium selects the first target storage according to a video code rate set by the photographing device and a actual write speed of each storage medium in the photographing device.
  • the storage medium selects the first target storage medium according to an equalization algorithm, or calculates the first target storage medium according to an application built in the photographing apparatus.
  • the storage device includes:
  • N is a positive integer greater than or equal to 2
  • the memory is used to store program code
  • the processor is configured to invoke program code in the memory to perform the following operations:
  • a first target storage medium for storing video data captured by the photographing device is selected in the photographing device according to a preset selection rule
  • the preset selection rule includes at least one of the following items: selecting the first target storage medium according to a video code rate of the current shooting setting of the shooting device, and selecting according to an actual writing speed of each storage medium in the shooting device.
  • the first target storage medium selects the first target storage medium according to an equalization algorithm according to a video code rate currently set by the photographing device and an actual write speed of each storage medium in the photographing device.
  • the first target storage medium, or the first target storage medium is calculated according to an application built in the photographing device.
  • the first target storage medium suitable for writing the shooting data is dynamically selected according to the preset selection rule before the shooting, thereby effectively improving the reliability of the writing speed and the video flow process.
  • the fluency avoiding problems such as stuttering caused by insufficient writing speed and unsmooth picture.
  • FIG. 1 is a schematic flowchart of a method for data storage in an embodiment of the present invention
  • FIG. 2 is another schematic flowchart of a method for storing data in an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a photographing apparatus according to an embodiment of the present invention.
  • FIG. 4 is another schematic structural diagram of a photographing apparatus according to an embodiment of the present invention.
  • FIG. 5 is another schematic structural diagram of a photographing apparatus according to an embodiment of the present invention.
  • the terms “comprises” and “comprises” and “the” and “the” are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or device that comprises a series of steps or modules is not necessarily limited to Those steps or modules, but may include other steps or modules not explicitly listed or inherent to such processes, methods, products or devices, the division of the modules presented herein is merely a logical division. There may be additional divisions in the implementation of the actual application, for example, multiple modules may be combined or integrated into another system, or some features may be ignored, or not executed, and the displayed or discussed mutual coupling.
  • the direct coupling or the communication connection may be through some interfaces, and the indirect coupling or communication connection between the modules may be electrical or the like, which is not limited herein.
  • the module or the sub-module described as the separate component may or may not be physically separated, may not be a physical module, or may not be divided into a plurality of circuit modules, and may select a part thereof according to actual needs or All modules are used to achieve the objectives of the embodiments of the present invention.
  • Embodiments of the present invention provide a data storage method and device for use in a storage technology field.
  • the technical terms appearing in this article are described in detail below.
  • the photographing device includes a photographing device, a processing module, a writing module, and at least two storage media, wherein the writing module includes a cache module and a write-back module, and the cache module is configured to cache data written to the storage medium to the cache medium;
  • the write module is configured to write the data cached by the cache module to the cache medium to the storage medium;
  • the cache medium is one of the at least two storage media, and the read/write speed is faster.
  • the photographing apparatus in the present invention can be applied to various shooting scenes, and is particularly suitable for scenes requiring high efficiency for real-time shooting, such as scenes in which a photographing apparatus is mounted on an aircraft, a film recording on the ground end, and a real-time recording of a sports game.
  • the photographing device in the invention can reserve a plurality of types of interfaces, and can support multiple types of external storage media, which is convenient for the user to select.
  • the photographing device may be a device having a photographing function such as a mobile terminal, a tablet computer, a digital camera, or a SLR camera.
  • the photographing device uses a plurality of storage media.
  • the storage medium may be a non-volatile memory.
  • the number of storage media may be configured to a minimum of two, and may be a combination of multiple types of storage media.
  • the storage media may have the same or different capacity, the number, type, or The capacity is not limited herein.
  • each storage medium can support internal or external expansion, and the specific installation manner is not limited.
  • the preset selection rule may be: selecting a suitable storage medium according to the actual writing speed of the storage medium, the current storage mode, or the captured video code rate, etc., to adapt to the writing speed of the video data, and writing the shooting device. Performance is maximized.
  • the storage medium for storing video data in the recording phase needs to be considered that the actual writing speed requires a storage medium sufficient to support recording.
  • you need to select a storage medium that stores video data for a long period of time you need to consider the free capacity of the storage medium, regardless of the actual write speed.
  • the storage medium used for selecting the recording and the medium for selecting the storage may be the same or different, or may have an intersection, that is, part or all of the video data in the storage medium used for recording may be migrated to other storage medium, It can be saved without being migrated and stored in the storage medium used for recording.
  • the photographing apparatus includes N storage media, where N is a positive integer greater than or equal to 2, and each storage medium of N includes at least One of the internal storage medium and the external storage medium, the type of the storage medium may be the same or different, and the embodiment of the present invention includes:
  • the preset selection rule includes at least one of the following items: selecting the first target storage medium according to a video code rate of the current shooting setting of the shooting device, and selecting according to an actual writing speed of each storage medium in the shooting device.
  • the first target storage medium selects the first target storage medium according to an equalization algorithm according to a video code rate currently set by the photographing device and an actual write speed of each storage medium in the photographing device.
  • the first target storage medium, or the first target storage medium is calculated according to an application built in the photographing device.
  • the storage information of the corresponding video data may be recorded and backed up during the process of storing the video data, specifically Reflected:
  • the index file including index information of the video data
  • the index file is written to the first target storage medium and/or the spare storage medium in a ping-pong alternate manner.
  • the ping-pong alternate mode refers to updating only the index information of one storage medium in the first target storage medium at a time, thereby avoiding information abnormality caused by power-off at the moment of update.
  • the data backup mechanism can be further enhanced.
  • the index file includes at least one index information, where the index information includes an index number, a timestamp of the frame data, an offset of the frame data in the video data, and a length of the frame data, and may further include The number of the storage medium storing the frame data.
  • the index information may be a write record for at least one of an I frame, a P frame, or a B frame. For example, when recording is performed for an I frame, a P frame, and a B frame, the I frame and the P frame may be later.
  • the information such as the time stamp of the B frame forms a complete video file, it is less prone to error in splicing the frame data than the frame recording of only one or two types of I frame, P frame, and B frame.
  • the video data may be periodically or incrementally backed up according to the index file.
  • a snapshot or a similar technology can be used for the backup operation.
  • the backup time can be configured according to the user's needs or by the software.
  • the third-party backup software can be used to implement the incremental backup or the full backup, which is not limited.
  • the full backup refers to a backup of all data before the current backup time, or a basic backup.
  • Incremental backup refers to the backup of the difference data between the last backup time and the current backup time, that is, the incremental backup based on the previous backup.
  • the first target storage medium suitable for writing the shooting data is dynamically selected according to the preset selection rule before the shooting, thereby effectively improving the reliability of the writing speed and the smoothness of the video streaming process, and avoiding the writing speed. Insufficient problems caused by the lack of card, the picture is not smooth.
  • the first target storage medium before the shooting, in order to adapt to the writing speed of the video data, the first target storage medium may be selected according to the storage mode and the video code rate, specifically:
  • the theoretical writing speed required to write the captured video data to the destination storage medium is calculated according to the destination storage medium and the video code rate of the current shooting setting of the shooting device, the destination storage medium being the shooting device a storage medium for storing the video data corresponding to the currently set storage mode;
  • a first target storage medium for storing video data is determined according to the theoretical write speed and/or a storage mode currently set by the photographing device. To some extent, the writing speed of video data can be improved.
  • N storage media may be configured for one photographing device, where N is greater than or equal to 2.
  • a positive integer there may be some storage media that cannot reach the current writing speed, and multiple storage media can be simultaneously selected to write video data in parallel to adapt to the current video data writing speed.
  • the first target storage medium can be selected according to the writing speed of the storage medium and the theoretical writing speed, and then according to the theoretical writing speed and/or the current setting of the shooting device.
  • the storage mode determines at least one of the following conditions when determining the first target storage medium for storing video data:
  • the first target storage medium is selected according to user configuration information or an equalization algorithm.
  • the actual writing speed of two storage media is greater than or equal to the theoretical writing speed, one of the two may be selected using an equalization algorithm.
  • the actual writing speed of each of the N storage media is greater than or equal to the theoretical writing speed, the same reason will not be repeated.
  • the video data is divided into at least two pieces of data according to an equalization algorithm, and the at least two pieces of data are respectively written into the at least two destination storage media, when the photographing device is idle time or low load And combining the at least two pieces of data written in the at least two destination storage media, and migrating to a second target storage medium in the N storage media, where the second target storage medium is in each of the N storage media
  • Any storage medium may be any storage medium other than the at least two destination storage media, may be any storage medium other than the at least two destination storage media, may be an internal storage medium, or may be
  • the external storage medium may also be a combination of an internal storage medium and an external storage medium, and the specific storage medium quantity, type or combination manner is not limited.
  • the merging process is: reading index information of each of the at least two pieces of data, and then, according to the index information corresponding to each piece of the at least two pieces of data, according to the time stamp of the frame data, the at least two The block data is stitched together to form a video file. It can be understood that whether the merging of data to be repaired or the merging of multiple pieces of data stored in multiple storage media, etc., can be referred to the description herein, the similarities are no longer mentioned. Narration.
  • the actual write speed of only one of the N storage media is greater than or equal to the theoretical write speed, the actual write speed is greater than or equal to the storage of the theoretical write speed.
  • the media acts as a temporary storage medium.
  • the video data written in the temporary storage medium is migrated to a third target storage medium other than the temporary storage medium, in an idle time or a low load of the photographing device,
  • the third target storage medium is selected by the user.
  • the storage mode of the current photographing device is the automatic storage mode
  • the video data written to the temporary storage medium may not be migrated and stored in the temporary storage medium, that is, the temporary storage medium is used as the long-term storage medium.
  • the first target storage medium of the video data is saved.
  • the index file is written into the first file by using a ping-pong alternate manner.
  • the present application can also monitor the write speed and provide a flexible exception handling mechanism, such as:
  • the video data is monitored according to a queue management manner
  • the photographing device If it is detected that the video data captured by the photographing device cannot be written into the first target storage medium, switching the first target storage medium to the backup storage medium, and writing the video data captured by the photographing device to the standby Storing a medium such that frame data written in the spare storage medium is written to the first target storage by an application or a user configuration manner built in the photographing apparatus during an idle time or a low load of the photographing apparatus The frame data of the media is merged to form a video file.
  • the first target storage medium may also be selected according to the storage mode and the write speed, so determined according to the theoretical write speed and/or the storage mode currently set by the photographing device.
  • the first target storage medium for storing video data satisfies at least one of the following:
  • the internal storage medium of the photographing device is selected as the Describe the first target storage medium
  • the storage mode currently set by the photographing device is the internal storage mode, or the currently set storage mode is the automatic mode And selecting the internal storage medium as the first target storage medium;
  • the external storage medium of the photographing device is greater than or equal to the theoretical writing speed, and the storage mode currently set by the photographing device is the external storage mode, the external storage medium is selected as The first target storage medium.
  • the method when the storage mode currently set by the photographing device is an external storage mode, and the internal storage medium is selected as the first target storage medium, the method further includes:
  • video data written in the internal storage medium is synchronized to the external storage medium.
  • writing to the internal storage medium and synchronizing to the external storage medium are two tasks, and priority can be set for the two tasks to ensure that the synchronization does not affect the efficiency of shooting.
  • priority can be set for the two tasks to ensure that the synchronization does not affect the efficiency of shooting.
  • other video data can be temporarily placed on the external storage medium, and finally repaired, thereby ensuring the availability of data.
  • the data to be repaired that is not written to the internal storage medium is written to the external storage medium to write the data to be repaired to the internal storage medium by an application built in the photographing device or a user configuration manner.
  • the built-in application may be an interactive interface of the shooting device, such as a virtual button or a physical button.
  • the user configuration mode generally responds to the user's instruction through a built-in application (English full name: Application, English abbreviation: App) or a physical button.
  • the external storage medium when the external storage medium is selected as the first target storage medium, if the video data cannot be written to the external storage medium, the first target storage medium is switched to the The internal storage medium is described, and frame data written in the internal storage medium after the switching time is recorded in the internal storage medium.
  • frame data written in the internal storage medium with frame data written in the external storage medium by an application or a user configuration manner built in the photographing device when the photographing device is idle time or low load And migrate to an alternate storage medium. The way of merging will not be repeated.
  • the storage capacity may be selected according to the actual free capacity of the storage medium.
  • Video file specifically:
  • a fifth target storage medium for storing the video data after the data to be repaired, and acquiring the data to be repaired according to the target index information, that is, corresponding to the indication according to the target index information.
  • the corresponding data to be repaired is extracted from the storage medium.
  • the fifth target storage medium may be any storage medium of the N storage media, and may be an internal storage medium, an external storage medium, or a combination of an internal storage medium and an external storage medium, and the specific storage medium quantity. The type, combination or combination is not limited.
  • the fifth target storage medium may be the storage medium with the largest free capacity, or the fifth target storage medium may be specified by the user. In principle, it is necessary to ensure that the free capacity is greater than or equal to the actual size of the repaired video data.
  • the repaired data may also be written into the storage medium with the largest data size, that is, the data. The largest size storage medium is used as the fifth target storage medium.
  • the target index information includes an index number, frame header information, index information stored in each frame data in the data to be repaired, and index information of frame data written in the internal storage medium after the switching time.
  • the number of the storage medium storing the video data captured by the photographing device may also be included, so that when the frame data is spliced, the frame data can be extracted from the corresponding storage medium in an orderly manner, thereby improving processing efficiency.
  • the index information of the frame data written in the internal storage medium after the switching time is mainly used to ensure the subsequent repair of the video file when the video data of each block is stored in a plurality of different storage media.
  • the switching time may include: switching time between internal/external storage media, switching storage when an abnormality (for example, pulling out an external storage medium that is writing video data, powering off, storage medium failure, insufficient writing storage space, etc.)
  • the switching timing of the medium is not specifically limited.
  • all index information of the data to be repaired may be acquired first, and then the index information is used to establish an index table for the data to be repaired, and the data is repaired.
  • the data to be repaired in the corresponding storage medium can be directly called and located, the accuracy of the data is effectively ensured, and the search time of the repaired data is shortened. That is, the foregoing target index information includes at least one index information, and after the target index information is extracted from the index file, before the repairing the video data by using the data to be repaired, the method further includes:
  • the video data is repaired according to the timestamp of the frame data in the data to be repaired indicated by the index table, specifically, the multiple frame data is spliced according to the order of the frame data, and then the original video is replaced.
  • the faulty data in the file forms a complete video file.
  • the actual write speed of the storage medium is obtained by the following steps:
  • the actual write speed of the storage medium is obtained by reading a status register of the storage medium or performing a read/write speed test on the storage medium, the read/write speed including a continuous write speed and a random write speed.
  • a test may be performed on the write speed of the external storage medium, that is, by reading the status register of the destination storage medium, or reading and writing the target storage medium. Testing, the actual write speed of the destination medium is obtained, the read and write speeds including continuous write speed and random write speed.
  • the physical device corresponding to the processing module 301 may be Is a processor
  • the physical device corresponding to the obtaining module 302 may be an input/output unit
  • the physical device corresponding to the writing module 303 may be a controller
  • the processor may be stored by calling
  • the program code in the storage medium performs the method corresponding to the above-described FIGS. 1 and 2.
  • the processing module 301, the obtaining module 302, and the writing module 303 can be implemented by using a dedicated circuit. For the specific implementation, refer to the prior art, and details are not described herein.
  • the processor, the transmitter and the receiver in FIG. 5 implement the same or similar functions as the processing module, the acquisition module, and the write module provided by the apparatus embodiment corresponding to the apparatus.
  • the memory storage processor in FIG. 5 needs to call the program code when executing the above method of data storage.
  • the photographing device 30 includes a storage module, a processing module, and a writing module;
  • the storage module includes N storage media, where N is a positive integer greater than or equal to 2;
  • the processing module 301 is configured to select, in the N storage media, a first target storage medium for storing video data captured by the photographing device according to a preset selection rule before shooting;
  • the obtaining module 302 is configured to acquire video data captured by the photographing device
  • the writing module 303 is configured to write video data captured by the photographing device to the first target storage medium selected by the processing module 301;
  • the preset selection rule includes at least one of the following items: selecting the first target storage medium according to a video code rate of the current shooting setting of the shooting device, and selecting according to an actual writing speed of each storage medium in the shooting device.
  • the first target storage medium selects the first target storage medium according to an equalization algorithm according to a video code rate currently set by the photographing device and an actual write speed of each storage medium in the photographing device.
  • the first target storage medium, or the first target storage medium is calculated according to an application built in the photographing device.
  • the processing module 301 is further configured to:
  • the index file including index information of the video data
  • the index file is written to the first target storage medium and/or the spare storage medium by the write module 303 in a ping-pong alternate manner.
  • processing module 301 is further configured to:
  • the video data is timed to perform an incremental backup or a full backup according to the index file.
  • the index file includes at least one index information, and each of the index information includes an index number, a timestamp of the frame data, an offset of the frame data in the video data, and a length of the frame data, and may further include a storage frame. The number of the storage medium for the data.
  • the processing module 301 is specifically configured to:
  • the theoretical writing speed required to write the captured video data to the destination storage medium is calculated according to the destination storage medium and the video code rate of the current shooting setting of the shooting device, the destination storage medium being the shooting device a storage medium for storing the video data corresponding to the currently set storage mode;
  • a first target storage medium for storing video data is determined according to the theoretical write speed and/or a storage mode currently set by the photographing device.
  • the photographing device includes N storage media, where N is a positive integer greater than or equal to 2; the processing module 301 is specifically configured to perform one of the following:
  • the actual write speed of at least two of the N storage media is greater than or equal to the theoretical write speed, selecting the first target storage medium according to user configuration information or an equalization algorithm;
  • the second target storage medium is migrated to the second target storage medium of the N storage mediums by using the write module 303, and the second target storage medium is any storage medium of the N storage mediums, which may be Any storage medium other than the at least two destination storage media may be an internal storage medium, an external storage medium, or an internal storage medium and an external storage medium. Combinations, the specific number, type or combination of storage media are not limited.
  • the actual writing speed of only one of the N storage media is greater than or equal to the theoretical writing speed
  • the actual writing speed is greater than or equal to the storage of the theoretical writing speed.
  • the medium is used as a temporary storage medium, and the video data is written into the temporary storage medium by the writing module 303, and the idle storage medium is written in the idle time or low load of the photographing device.
  • the video data is migrated by the writing module 303 to a third target storage medium of the N storage media except the temporary storage medium, and the third target storage medium is selected by the user.
  • the storage mode of the current shooting device is the automatic storage mode, it can be stored in the temporary storage medium without migration.
  • the photographing device 30 further includes a monitoring module.
  • the processing module 301 uses the ping-pong alternate manner to pass the writing module 303. Before the video data and the index file are written in the storage medium of the photographing device, it is also used to:
  • the processing module 301 further performs at least one of the following:
  • the internal storage medium of the photographing device is selected as the Describe the first target storage medium
  • the storage mode currently set by the photographing device is the internal storage mode, or the currently set storage mode is the automatic mode And selecting the internal storage medium as the first target storage medium;
  • the external storage medium of the photographing device is greater than or equal to the theoretical writing speed, and the storage mode currently set by the photographing device is the external storage mode, the external storage medium is selected as The first target storage medium.
  • the processing module 301 when the storage mode currently set by the photographing device is an external storage mode, and the internal storage medium is selected as the first target storage medium, the processing module 301 further Used for:
  • the video data written in the internal storage medium is synchronized to the external storage medium by the write module 303 when the video data is written to the internal storage medium.
  • the processing module 301 writes, to the external storage medium, data to be repaired that is not written into the internal storage medium by the write module 303, so that an application built in the photographing device or an application built in the photographing device is available when the photographing device is idle or the load is small
  • the user configuration mode writes the data to be repaired to the internal storage medium.
  • the processing module 301 sets the first target.
  • the storage medium is switched to the internal storage medium, and frame data written in the internal storage medium after the switching timing is recorded in the internal storage medium.
  • frame data written in the internal storage medium with frame data written in the external storage medium by an application or a user configuration manner built in the photographing device when the photographing device is idle time or low load And migrate to an alternate storage medium.
  • the monitoring module is configured to monitor a write state in real time during the process of writing video data captured by the photographing device into the first target storage medium;
  • the processing module is further configured to switch the first target storage medium to the backup storage medium, by using the Writing a module to write the video data captured by the photographing device to the spare storage medium, so that when the photographing device is idle time or low load, the application or user configuration manner built in the photographing device is written into the The frame data in the spare storage medium is combined with the frame data written to the first target storage medium to form a video file.
  • the processing module 301 is further configured to:
  • the video data is repaired using the data to be repaired, and the repaired video data is written to the fifth target storage medium by the write module 303.
  • the fifth target storage medium may be any storage medium of the N storage media, and may be an internal storage medium, an external storage medium, or a combination of an internal storage medium and an external storage medium, and the specific storage medium quantity.
  • the type, combination or combination is not limited.
  • the target index information includes an index number, a frame header information, and each of the data to be repaired.
  • the index information of the frame data storage and the index information of the frame data written in the internal storage medium after the switching time may further include a number of a storage medium storing the video data captured by the photographing device.
  • the target index information includes at least one index information
  • the processing module 301 uses the data to be repaired to use the video after extracting target index information from the index file. Before the data is repaired, it is also used to:
  • the repairing the video data by using the data to be repaired includes:
  • the processing module 301 obtains an actual write speed of the storage medium by performing the following steps:
  • the status register of the storage medium is read, or the read/write speed test is performed on the storage medium to obtain the actual write speed of the storage medium, and the read/write speed includes a continuous write speed and a random write speed.
  • the disclosed system, apparatus, and method may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the unit is only a logical function division.
  • there may be another division manner for example, multiple units or components may be combined or Can be integrated into another system, or some features can be ignored or not executed.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interface, device or unit, and may be in an electrical, mechanical or other form.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. You can choose some of them according to actual needs or All units are used to achieve the objectives of the solution of this embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above integrated unit can be implemented in the form of hardware or in the form of a software functional unit.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as a standalone product, may be stored in a computer readable storage medium.
  • the technical solution of the present invention which is essential or contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product stored in a storage medium.
  • a number of instructions are included to cause a computer device (which may be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, and the like. .

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Television Signal Processing For Recording (AREA)
  • Studio Devices (AREA)

Abstract

一种数据存储的方法及设备,该方法应用于拍摄设备,方法包括:在拍摄之前,根据预设选择规则在N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;将拍摄设备拍摄的视频数据写入所述第一目标存储介质;预设选择规则至少包括以下项之一:根据拍摄设备当前拍摄设定的视频码率选择第一目标存储介质,根据拍摄设备中各存储介质的实际写入速度选择第一目标存储介质,根据拍摄设备当前拍摄设定的视频码率、以及拍摄设备中各存储介质的实际写入速度选择第一目标存储介质根据均衡算法选择第一目标存储介质,或根据拍摄设备中内置的应用计算得到第一目标存储介质。能够提高写入速度的可靠性以及录象流水过程的流畅性。

Description

一种数据存储的方法及设备 技术领域
本发明涉及存储技术领域,尤其涉及的是一种数据存储的方法及设备。
背景技术
在相机拍摄视频时,对不同的帧数据均按照图像采集、图像处理、编码、存储的流水进行,由于视频分辨率越高,在保证视频局部清晰度的情况下,若使用同样的编码方式,视频码率也越高,相应的,所拍摄的视频的文件大小也越大。较大的视频需要更快的写入速度,因此,对于视频码率高的视频,在写入相机的存储介质时整个流水容易发生阻塞,从而导致编码缓存溢出,甚至无法继续拍摄。目前为了保证整个流水正常进行,一般采取写入速度大于编码生成的速度的存储介质,否则将导致编码缓存溢出,进而导致录像无法继续进行,因此写入速度不足制约视频画质的提升。例如,采用安全数字卡(英文全称:Secure Digital card,英文简称:SD Card)、闪存卡(英文全称:Compact Flash Card,英文简称:CF Card)、记忆棒、固态硬盘(英文全称:Solid State Disk,英文简称:SSD)等写入速度高、容量大、可靠性高的存储介质。
由于各个存储卡厂家的技术与生产工艺的差异,并不能保证任何时刻的写入速度都能达到标称的写入速度,特别是在随机写入(英文全称:Random Write)状态下。并且由于相机拍摄视频为并行流水处理的过程,如果中间出现突发的存储介质写入速度变慢、卡顿(比如SD卡,由于每个区块的速度可能会有差异,厂家不保证任何时刻的写入速度都能达到标称的速度,特别是在随机写入状态下)等情况,则会导致视频拍摄无法继续进行。
现有机制中,主要采用以下两种方式解决写入速度的稳定性的问题:一、采用内置的存储介质,但不支持外部存储介质,但采用内置的存储介质不利于设备间的数据分发和流转,使用场景受限,并且在内置的存储介质的容量较大时,成本较高。二、通过厂商的大量评测,提供可支持的外存储设备型号的列表供用户选择。但该列表限制用户选择存储设备,且生产过程中的大量评测需额外增加测试成本。
发明内容
本申请提供了一种数据存储的方法及设备,能够解决现有技术中存储设备的写入速度的可靠性较低的问题。
本申请第一方面提供了一种数据存储的方法,所述方法应用于拍摄设备,所述拍摄设备包括N个存储介质,其中,N为大于或等于2的正整数;所述方法包括:
在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质;
所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
在一种可能的设计中,为实现后期对存储的视频文件进行针对性、有效的修复,还可以在存储上述视频数据过程中,对相应视频数据的存储信息进行记录和备份,具体体现为:
在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
采用乒乓交替方式将所述索引文件写入所述第一目标存储介质。
可选的,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度,还可以包括存储帧数据的存储介质的编号。
在一种可能的设计中,在存储拍摄视频的过程中,还可以根据所述索引文件对所述视频数据定时进行增量备份或全备份。可以采用快照或类似技术进行备份操作,备份的时刻可以根据用户需求或由软件配置,具体不作限定。
在一种可能的设计中,在拍摄之前,为适应视频数据的写入速度,可以根据存储模式和视频码率选择第一目标存储介质,具体为:
在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率 计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。一定程度上能够提高视频数据的写入速度。
在一种可能的设计中,由于拍摄设备的存储介质的写入速度、型号等参数会有所不同,可以为一个拍摄设备配置N个存储介质,其中,N为大于或等于2的正整数。例如,可能存在某些存储介质无法达到当前的写入速度,则可以同时选择多个存储介质来并行写入视频数据以适应当前视频数据的写入速度,在拍摄完毕后,可以将存储在各存储介质中的视频数据合并为完整的视频文件。由此可见,在拍摄之前,可以根据存储介质的写入速度、和所述理论写入速度选择第一目标存储介质,则在根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质时,满足以下之一:
若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质;
若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目的存储介质作为所述第一目标存储介质;
或者,若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质。
在一种可能的设计中,根据存储介质的写入速度、和所述理论写入速度选择第一目标存储介质时,将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质,至少包括以下两种情况:
1、若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理 论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则按照均衡算法将所述视频数据分为至少两块数据,并将所述至少两块数据分别写入所述至少2个目的存储介质;
在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并,并迁移至所述N个存储介质中的第二目标存储介质,该第二目标存储介质为N各存储介质中的任意存储介质,可以是除所述至少2个目的存储介质之外的任意存储介质,可以是除所述至少2个目的存储介质之外的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
其中,合并的过程为:读取所述至少两块数据中各数据的索引信息,然后根据所述至少两块数据中每块数据对应的索引信息,按照帧数据的时间戳将所述至少两块数据拼接,形成一个视频文件。
2、若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将所述视频数据写入所述临时存储介质;
在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质,该第三目标存储介质可由用户自行选择。
在第2种情况下,若当前拍摄设备的存储模式为自动存储模式,则可将写入该临时存储介质的视频数据不作迁移,仍存储于该临时存储介质,即将该临时存储介质作为上述第一目标存储介质。
在一种可能的设计中,为提高写入视频数据的稳定性,在拍摄过程中,为视频数据建立索引文件之后,所述采用乒乓交替方式将所述索引文件写入所述第一目标存储介质中之前,本申请还可以进行:
按队列管理方式对所述视频数据进行监控;
在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,将未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
在一种可能的设计中,还可以根据存储模式和写入速度选择第一目标存储介质,故根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的所述第一目标存储介质,至少满足以下之一:
若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
在一种可能的设计中,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述方法还包括:
在将所述视频数据写入所述内部存储介质时,将写入所述内部存储介质中的视频数据同步至所述外部存储介质。通过本设计,无需等到拍摄停止后再同步,若出现了内部存储介质的部分区域速度不够,可以将其他视频数据临时放到外部存储介质,最终做修复,从而保证数据的可用性。
在一种可能的设计中,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则将未写入所述内部存储介质的待修复数据写入所述外部存储介质,以便通过所述拍摄设备内置的应用或用户配置方式将所述待修复数据写入所述内部存储介质。其中,内置的应用可以是拍摄设备的交互界面,例如虚拟按钮或者物理按钮,用户配置方式一般通过APP或者物理按钮来响应用户的指令。
在一种可能的设计中,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与 写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。
通过提供灵活的存储机制,可以应付多种写入受限的场景,从而保证数据的完整度和有效性。
在一种可能的设计中,还可以实时监测写入状态,在写入状态异常(例如,进入写入速度慢区、死区、其他外界突发因素导致的无法写入)时,切换到备份存储介质,进一步提高数据的稳定性和完整性。具体为:
在将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质的过程中,实时监测写入状态;
若监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则将第一目标存储介质切换为备用存储介质,将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
在一种可能的设计中,在完成拍摄后,对需要修复的视频数据进行修复时,考虑到视频文件的大小不一,可以根据存储介质的实际空闲容量来选择用于存储修复后的视频文件,具体为:
从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;例如可以选择索引信息最完整且修复信息最多的索引信息作为目标索引信息,以减少合并多个修复数据的操作。
根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第五目标存储介质,并根据所述目标索引信息获取所述待修复数据;
使用所述待修复数据对所述视频数据进行修复,以及将修复后的所述视频数据写入所述第五目标存储介质,其中,第五目标存储介质可以是N各存储介质中的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
在一种可能的设计中,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息,还可以包括存储所述拍摄设备拍摄的视频数据的 存储介质的编号。通过提供每帧数据的存储信息,使得后期在修复时可以快速、有针对性、准确的定位到想要修复的数据。
在一种可能的设计中,为进一步的提高修复数据的效率,还可以先获取待修复数据的所有索引信息,然后使用这些索引信息为待修复数据建立一个索引表,实现在修复数据时,可以直接调用、定位修复的数据,有效缩短修复数据的查找时间。即上述目标索引信息包括至少一个索引信息,所述从所述索引文件中提取目标索引信息之后,所述使用所述待修复数据对所述视频数据进行修复之前,所述方法还包括:
根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
则根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复。
在一种可能的设计中,存储介质的实际写入速度通过以下步骤得到:
通过读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
本发明第二方面还提供一种存储设备,该存储设备具有实现上述方法设计中存储设备行为的功能。所述功能可以通过硬件实现,也可以通过硬件执行相应的软件实现。所述硬件或软件包括一个或多个与上述功能相对应的模块。所述模块可以是软件和/或硬件。
一种可能的设计中,所述存储设备包括存储模块,处理模块以及写模块;
所述存储模块包括N个存储介质,其中,N为大于或等于2的正整数;
所述处理模块,用于在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
所述写模块,用于将所述拍摄设备拍摄的视频数据写入所述处理模块选择的所述第一目标存储介质;
所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存 储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
一种可能的设计中,所述存储设备包括:
处理器、N个存储器、控制器;
其中,N为大于或等于2的正整数,所述存储器用于存储程序代码,所述处理器用于调用所述存储器中的程序代码来执行以下操作:
在拍摄之前,根据预设选择规则在所述拍摄设备中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
通过所述控制器将所述拍摄设备拍摄的视频数据写入选择的所述第一目标存储介质;
所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
相较于现有技术,本发明提供的方案中,在拍摄之前根据预设选择规则动态的选择适合写入拍摄数据的第一目标存储介质,有效提高写入速度的可靠性以及录象流水过程的流畅性,避免写入速度不足导致的卡顿、画面不流畅等问题。
附图说明
图1为本发明实施例中数据存储的方法的一种流程示意图;
图2为本发明实施例中数据存储的方法的另一种流程示意图;
图3为本发明实施例拍摄设备的一种结构示意图;
图4为本发明实施例拍摄设备的另一种结构示意图;
图5为本发明实施例拍摄设备的另一种结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例,基于本发明中的实施例,本领域技术人员在没有做出创造性劳 动前提下所获得的所有其他实施例,都属于本发明保护的范围。
本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或模块的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或模块,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或模块,本文中所出现的模块的划分,仅仅是一种逻辑上的划分,实际应用中实现时可以有另外的划分方式,例如多个模块可以结合成或集成在另一个系统中,或一些特征可以忽略,或不执行,另外,所显示的或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,模块之间的间接耦合或通信连接可以是电性或其他类似的形式,本文中均不作限定。并且,作为分离部件说明的模块或子模块可以是也可以不是物理上的分离,可以是也可以不是物理模块,或者可以分不到多个电路模块中,可以根据实际的需要选择其中的部分或全部模块来实现本发明实施例方案的目的。
本发明实施例提供了一种数据存储的方法及设备,用于存储技术领域。以下对本文中所出现的技术名词进行详细说明。
贯穿本文,拍摄设备包括拍摄装置、处理模块、写模块、至少2个存储介质,其中,写模块包括缓存模块和回写模块,缓存模块用于将写入存储介质的数据缓存至缓存介质;回写模块用于将缓存模块缓存至缓存介质的数据写入存储介质;缓存介质为至少2个存储介质中的一种存储介质,读/写速度较快。
本发明中的拍摄设备可应用于各种拍摄场景,尤其适用于对实时拍摄的效率要求较高的场景,例如拍摄设备搭载于飞行器、地面端的电影录制、运动赛况的实时录制等场景。
本发明中的拍摄设备可以预留多种类型的接口,可支持多种类型的外接存储介质,方便用户选择。该拍摄设备可以是移动终端、平板电脑、数码相机、单反相机等具有拍摄功能的装置。
为解决写入速度的可靠性较低的问题,本发明实施主要提供以下技术方 案:
1、拍摄设备采用多个存储介质。
存储介质可以采用非易失性存储器,存储介质的数量可以配置最少两个,可以是多种类型的存储介质的组合,存储介质的容量可相同或不相同,具体的存储介质的数量、类型或容量本文均不作限定。另外,各存储介质可支持内置或外接扩展等方式,具体的安装方式也不限定。
2、根据预设选择规则选择用于存储视频数据的存储介质。
例如,该预设选择规则可以是,根据存储介质的实际写入速度、当前的存储模式或拍摄的视频码率等选择合适的存储介质,以适应视频数据的写入速度,将拍摄设备的写性能发挥到最大。
需要说明的是,选择录像阶段用于存储视频数据的存储介质需要考虑的是:实际写入速度需要足够支持录像的存储介质。在后期需要选择长期保存视频数据的存储介质时需要考虑的则是:存储介质的空闲容量,而不用考虑实际写入速度。可以理解的是,选择录像时用的存储介质和选择存储用的介质可以相同或不同,或者有交集,即可以将录像时使用的存储介质中的视频数据部分或全部迁移至其他存储介质,也可以不迁移,继续保存在录像时使用的存储介质中。
请参照图1,以下对本发明实施例中的一种数据存储的方法进行描述,所述拍摄设备包括包括N个存储介质,其中,N为大于或等于2的正整数,N各存储介质至少包括内部存储介质、和外部存储介质中的一种,存储介质的类型可相同或不同,本发明实施例包括:
101、在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
102、将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质。
可选的,在一些发明实施例中,为实现后期对存储的视频文件进行针对性、有效的修复,还可以在存储上述视频数据过程中,对相应视频数据的存储信息进行记录和备份,具体体现为:
在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
采用乒乓交替方式将所述索引文件写入所述第一目标存储介质和/或备用存储介质。其中,乒乓交替方式是指每次只更新第一目标存储介质中的一个存储介质的索引信息,从而避免在更新的瞬间断电导致的信息异常等情况。另外,通过将索引文件同时写入备用存储介质实现对索引文件的备份,能够进一步加强数据备份机制。
可选的,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度,还可以包括存储帧数据的存储介质的编号。可选的,索引信息可以是针对I帧、P帧或B帧中的至少一个的写入记录,例如同时针对I帧、P帧和B帧进行记录时,则后期可以根据I帧、P帧和B帧的时间戳等信息形成完整的视频文件时,相较于只针对I帧、P帧和B帧中的一种或两种类型的帧记录,在拼接帧数据时不容易出错。
可选的,在存储拍摄视频的过程中,还可以根据所述索引文件对所述视频数据定时进行增量备份或全备份。例如,可以采用快照或类似技术进行备份操作,备份的时刻可以根据用户需求或由软件配置,可以采用第三方的备份软件实现增量备份或全备份,具体不作限定。
其中,全备份是指对本次备份时刻之前的所有数据进行一次备份,或者是基础备份。增量备份是指对上一次备份时刻到本次备份时刻之间的差异数据进行备份,即在前一次备份的基础上进行的增量备份。
本发明实施例中,在拍摄之前根据预设选择规则动态的选择适合写入拍摄数据的第一目标存储介质,有效提高写入速度的可靠性以及录象流水过程的流畅性,避免写入速度不足导致的卡顿、画面不流畅等问题。
具体的数据存储过程可参考图2所示的流程示意图,本处不作赘述。
可选的,在一些发明实施例中,在拍摄之前,为适应视频数据的写入速度,可以根据存储模式和视频码率选择第一目标存储介质,具体为:
在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。一定程度上能够提高视频数据的写入速度。
可选的,在一些发明实施例中,由于拍摄设备的存储介质的写入速度、型号等参数会有所不同,可以为一个拍摄设备配置N个存储介质,其中,N为大于或等于2的正整数。例如,可能存在某些存储介质无法达到当前的写入速度,则可以同时选择多个存储介质来并行写入视频数据以适应当前视频数据的写入速度,在拍摄完毕后,可以将存储在各存储介质中的视频数据合并为完整的视频文件。由此可见,在拍摄之前,可以根据存储介质的写入速度、和所述理论写入速度选择第一目标存储介质,则在根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质时,至少满足以下情况之一:
1、若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质。
举例来说,若有2个存储介质的实际写入速度均大于或等于理论写入速度,则可以采用均衡算法选择其中一个,或者同时选择这两个。N个存储介质中每个存储介质的实际写入速度均大于或等于理论写入速度时,同理,不作赘述。
2、若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目的存储介质作为所述第一目标存储介质。
进一步的,按照均衡算法将所述视频数据分为至少两块数据,并将所述至少两块数据分别写入所述至少2个目的存储介质,在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并,并迁移至所述N个存储介质中的第二目标存储介质,该第二目标存储介质为N各存储介质中的任意存储介质,可以是除所述至少2个目的存储介质之外的任意存储介质,可以是除所述至少2个目的存储介质之外的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
其中,合并的过程为:读取所述至少两块数据中各数据的索引信息,然后根据所述至少两块数据中每块数据对应的索引信息,按照帧数据的时间戳将所述至少两块数据拼接,形成一个视频文件。可以理解的是,不管是针对待修复数据的合并、还是针对存储于多个存储介质的多块数据的合并等类似的数据合并场景,均可参考此处说明,后文类似之处均不再赘述。
3、若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质。
进一步的,将所述视频数据写入所述临时存储介质;
在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质,该第三目标存储介质由用户自行选择。
在第3种情况下,若当前拍摄设备的存储模式为自动存储模式,则可以不用对写入该临时存储介质的视频数据进行迁移,仍存储于该临时存储介质,即将该临时存储介质作为长期保存视频数据的上述第一目标存储介质。
可选的,在一些发明实施例中,为提高写入视频数据的稳定性,在拍摄过程中,为视频数据建立索引文件之后,所述采用乒乓交替方式将所述索引文件写入所述第一目标存储介质中之前,本申请还可以进行写入速度的监控,并提供灵活的异常处理机制,例如:
一、根据写队列当前的占用率判断写操作是否异常。
具体为:按队列管理方式对所述视频数据进行监控;
在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
在确定写操作异常后,则根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,将未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
二、实时监测写入状态。
在写入状态异常(例如,进入写入速度慢区、死区、其他外界突发因素导致的无法写入)时,切换到备份存储介质,进一步提高数据的稳定性和完整性。
具体为:在将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质的过程中,实时监测写入状态;
若监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则将第一目标存储介质切换为备用存储介质,将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
可选的,在一些发明实施例中,还可以根据存储模式和写入速度选择第一目标存储介质,故根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的所述第一目标存储介质,至少满足以下之一:
若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
可选的,在一些发明实施例中,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述方法还包括:
在将所述视频数据写入所述内部存储介质时,将写入所述内部存储介质中的视频数据同步至所述外部存储介质。通过本可能的设计,无需等到拍摄停止后再同步,可以缩短用户等待至同步到外部存储介质的时间。
并且,写入所述内部存储介质,和同步至外部存储介质为两个任务,可以为这两个任务设置优先级,以保证同步不影响拍摄的效率。另外,若出现了内部存储介质的部分区域速度不够,可以将其他视频数据临时放到外部存储介质,最终做修复,从而保证数据的可用性。
可选的,在一些发明实施例中,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则将未写入所述内部存储介质的待修复数据写入所述外部存储介质,以便通过所述拍摄设备内置的应用或用户配置方式将所述待修复数据写入所述内部存储介质。其中,内置的应用可以是拍摄设备的交互界面,例如虚拟按钮或者物理按钮,用户配置方式一般通过内置的应用(英文全称:Application,英文简称:App)或者物理按钮来响应用户的指令。
可选的,在一些发明实施例中,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据。在所述拍摄设备的空闲时间或低负载时,再通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。合并的方式不再赘述。
通过提供灵活的存储机制,可以应付多种写入受限的场景,从而保证数据的完整度和有效性。
可选的,在一些发明实施例中,在完成拍摄后,对需要修复的视频数据进行修复时,考虑到视频文件的大小不一,可以根据存储介质的实际空闲容量来选择用于存储修复后的视频文件,具体为:
从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;例如可以选择索引信息最完整且修复信息最多的索引信息作为目标索引信息,以减少合并多个修复数据的操作。
根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第五目标存储介质,并根据所述目标索引信息获取所述待修复数据,即根据目标索引信息的指示去对应的存储介质中提取相应的待修复数据。
使用所述待修复数据对所述视频数据进行修复,以及将修复后的所述视频数据写入所述第五目标存储介质。该修复后的所述视频数据为最终合并后的完整视频文件。其中,第五目标存储介质可以是N各存储介质中的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
例如,该第五目标存储介质可以是空闲容量最多的存储介质,也可以由用户指定第五目标存储介质,原则上要能够保证空闲容量大于或等于修复后的所述视频数据的实际大小。可选的,为尽可能的减少数据的迁移,在修复后的所述视频数据写入所述第五目标存储介质时,还可以将修复的数据都写入数据大小最大的存储介质,即将数据大小最大的存储介质作为第五目标存储介质。
可选的,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息,还可以包括存储所述拍摄设备拍摄的视频数据的存储介质的编号,以便在拼接帧数据时,能够有序的从对应的存储介质中提取帧数据,从而提高处理效率。通过提供每帧数据的存储信息,使得后期在修复时可以快速、有针对性、准确的定位到想要修复的数据。可以理解的是,切换时刻之后写入所述内部存储介质中的帧数据的索引信息主要是用在:将各分块的视频数据存储存储于多个不同的存储介质时,保证后续修复视频文件时,能够重组准确的帧上下文,使得按照拍摄时的帧数据的顺序进行修复,从而保证视频文件的完 整性。其中,切换时刻可以包括:内/外部存储介质之间的切换时刻,异常(例如拔出正在写入视频数据的外部存储介质、断电、存储介质故障、写入存储空间不足等)时切换存储介质的切换时刻,具体不作限定。
可选的,在一些发明实施例中,为进一步的提高修复数据的效率,还可以先获取待修复数据的所有索引信息,然后使用这些索引信息为待修复数据建立一个索引表,实现在修复数据时,可以直接调用、定位对应的存储介质中待修复的数据,有效保证数据的准确度,以及缩短修复数据的查找时间。即上述目标索引信息包括至少一个索引信息,所述从所述索引文件中提取目标索引信息之后,所述使用所述待修复数据对所述视频数据进行修复之前,所述方法还包括:
根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
然后根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复,具体来说,则是按照帧数据的顺序将多个帧数据拼接,然后替换原视频文件中故障的数据,从而形成一个完整的视频文件。
可选的,在一些发明实施例中,存储介质的实际写入速度通过以下步骤得到:
通过读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
例如,所述目的存储介质为外部存储介质时,可执行对外部存储介质进行写入速度的测试,即通过读取所述目的存储介质的状态寄存器,或对所述目的存储介质进行读写速度测试,得到所述目的介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
请参照图3,以下对本发明实施例中用于执行上述图1或图2中数据存储的方法的拍摄设备30进行描述,需要说明的是,本实施例中,处理模块301对应的实体设备可以是处理器,获取模块302对应的实体设备可以是输入/输出单元,写模块303对应的实体设备可以是控制器,处理器可通过调用存储在 存储介质中的程序代码执行上述图1和图2所对应的方法。其中,处理模块301、获取模块302、写模块303可以分别通过专有电路来实现,具体实现方式参见现有技术,这里不作赘述。当拍摄设备30具有如图5所示的结构时,图5中的处理器、发射器和接收器实现前述对应该装置的装置实施例提供的处理模块、获取模块和写模块相同或相似的功能,图5中的存储器存储处理器执行上述数据存储的方法时需要调用的程序代码。
本发明实施例中,所述拍摄设备30包括存储模块,处理模块以及写模块;
所述存储模块包括N个存储介质,其中,N为大于或等于2的正整数;
所述处理模块301,用于在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
获取模块302,用于获取所述拍摄设备拍摄的视频数据;
所述写模块303,用于将所述拍摄设备拍摄的视频数据写入所述处理模块301选择的所述第一目标存储介质;
所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
可选的,在一些发明实施例中,所述处理模块301还用于:
在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
采用乒乓交替方式通过所述写模块303将所述索引文件写入所述第一目标存储介质和/或备用存储介质。
进一步,所述处理模块301还用于:
根据所述索引文件对所述视频数据定时进行增量备份或全备份。
其中,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度,还可以包括存储帧数据的存储介质的编号。
可选的,在一些发明实施例中,所述处理模块301具体用于:
在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。
可选的,在一些发明实施例中,所述拍摄设备包括N个存储介质,其中,N为大于或等于2的正整数;所述处理模块301具体用于执行以下之一:
若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质;
若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目的存储介质作为所述第一目标存储介质;按照均衡算法将所述视频数据分为至少两块数据,并通过所述写模块303将所述至少两块数据分别写入所述至少2个目的存储介质,并在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并后,通过所述写模块303迁移至所述N个存储介质中的第二目标存储介质,该第二目标存储介质为N各存储介质中的任意存储介质,可以是除所述至少2个目的存储介质之外的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
或者,若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质,通过所述写模块303将所述视频数据写入所述临时存储介质,并在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据通过所述写模块303迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质,该第三目标存储介质由用户自行选 择,或者,如果当前拍摄设备的存储模式为自动存储模式,则可以不用迁移,继续存储在该临时存储介质中。
可选的,在一些发明实施例中,所述拍摄设备30还包括监控模块,在拍摄过程中,所述处理模块301为视频数据建立索引文件之后,采用乒乓交替方式通过所述写模块303将所述视频数据和所述索引文件写入拍摄设备的存储介质中之前,还用于:
通过所述监控模块按队列管理方式对所述视频数据进行监控;
在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,通过所述写模块303将未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
可选的,在一些发明实施例中,所述处理模块301至少还执行以下之一:
若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
可选的,在一些发明实施例中,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述处理模块301还用于:
在将所述视频数据写入所述内部存储介质时,通过所述写模块303将写入所述内部存储介质中的视频数据同步至所述外部存储介质。
可选的,在一些发明实施例中,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则所 述处理模块301通过所述写模块303将未写入所述内部存储介质的待修复数据写入所述外部存储介质,以便在拍摄设备空闲或负载较小时,通过所述拍摄设备内置的应用或用户配置方式将所述待修复数据写入所述内部存储介质。
可选的,在一些发明实施例中,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则所述处理模块301将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据。在所述拍摄设备的空闲时间或低负载时,再通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。
或者,通过所述监控模块用于在将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质的过程中,实时监测写入状态;
若所述监控模块监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则所述处理模块还用于将第一目标存储介质切换为备用存储介质,通过所述写模块将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
可选的,在一些发明实施例中,所述处理模块301还用于:
从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;
根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第五目标存储介质,并根据所述目标索引信息获取所述待修复数据;
使用所述待修复数据对所述视频数据进行修复,以及通过所述写模块303将修复后的所述视频数据写入所述第五目标存储介质。
其中,第五目标存储介质可以是N各存储介质中的任意存储介质,可以是内部存储介质,也可以是外部存储介质,也可以是内部存储介质与外部存储介质的组合,具体的存储介质数量、类型或组合方式均不作限定。
可选的,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每 个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息,还可以包括存储所述拍摄设备拍摄的视频数据的存储介质的编号。
可选的,在一些发明实施例中,所述目标索引信息包括至少一个索引信息,所述处理模块301在从所述索引文件中提取目标索引信息之后,使用所述待修复数据对所述视频数据进行修复之前,还用于:
根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
所述使用所述待修复数据对所述视频数据进行修复,包括:
根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复。
可选的,在一些发明实施例中,所述处理模块301通过执行以下步骤得到存储介质的实际写入速度:
读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统,装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。
在本申请所提供的几个实施例中,应该理解到,所揭露的系统,装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或 者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。
以上对本发明所提供的技术方案进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。

Claims (57)

  1. 一种数据存储的方法,所述方法应用于拍摄设备,其特征在于,所述拍摄设备包括N个存储介质,N为大于或等于2的正整数,所述方法包括:
    在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
    将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质;
    所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
    采用乒乓交替方式将所述索引文件写入所述第一目标存储介质和/或备用存储介质。
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:
    根据所述索引文件对所述视频数据定时进行增量备份或全备份。
  4. 根据权利要求3所述的方法,其特征在于,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度。
  5. 根据权利要求1-4任一所述的方法,其特征在于,所述根据预设选择规则在所述拍摄设备中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质,包括:
    在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
    根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。
  6. 根据权利要求5所述的方法,其特征在于,所述根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质,包括以下之一:
    若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质;
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目的存储介质作为所述第一目标存储介质;
    或者,若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质。
  7. 根据权利要求6所述的方法,其特征在于,所述将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质,包括:
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则按照均衡算法将所述视频数据分为至少两块数据,并将所述至少两块数据分别写入所述至少2个目的存储介质;
    所述方法还包括:
    在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并,并迁移至所述N个存储介质中的第二目标存储介质。
  8. 根据权利要求7所述的方法,其特征在于,所述将写入所述至少2个目的存储介质的所述至少两块数据合并,包括:
    根据所述至少两块数据中每块数据对应的索引信息,按照帧数据的时间戳将所述至少两块数据拼接,形成一个视频文件。
  9. 根据权利要求6所述的方法,其特征在于,所述将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质,包括:
    若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将所述视频数据写入所述临时存储介质;
    所述方法还包括:
    在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质。
  10. 根据权利要求6至9任一所述的方法,其特征在于,所述在拍摄过程中,为视频数据建立索引文件之后,所述采用乒乓交替方式将所述索引文件写入所述第一目标存储介质中之前,还包括:
    按队列管理方式对所述视频数据进行监控;
    在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
    根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,将所述写队列中等待写入的帧数据,以及未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
  11. 根据权利要求5所述的方法,其特征在于,所述根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的所述第一目标存储介质,至少包括以下之一:
    若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
    若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
    或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
  12. 根据权利要求11所述的方法,其特征在于,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述方法还包括:
    在将所述视频数据写入所述内部存储介质时,将写入所述内部存储介质中的视频数据同步至所述外部存储介质。
  13. 根据权利要求12所述的方法,其特征在于,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则将未写入所述内部存储介质的待修复数据写入所述外部存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将所述待修复数据写入所述内部存储介质。
  14. 根据权利要求11所述的方法,其特征在于,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。
  15. 根据权利要求1-14任一所述的方法,其特征在于,所述方法还包括:
    在将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质的过程中,实时监测写入状态;
    若监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则将第一目标存储介质切换为备用存储介质,将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
  16. 根据权利要求4-13任一所述的方法,其特征在于,所述方法还包括:
    从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;
    根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第 五目标存储介质,并根据所述目标索引信息获取所述待修复数据;
    使用所述待修复数据对所述视频数据进行修复,以及将修复后的所述视频数据写入所述第五目标存储介质。
  17. 根据权利要求16所述的方法,其特征在于,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息。
  18. 根据权利要求16或17所述的方法,其特征在于,所述目标索引信息包括至少一个索引信息,所述从所述索引文件中提取目标索引信息之后,所述使用所述待修复数据对所述视频数据进行修复之前,所述方法还包括:
    根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
    所述使用所述待修复数据对所述视频数据进行修复,包括:
    根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复。
  19. 根据权利要求6所述的方法,其特征在于,存储介质的实际写入速度通过以下步骤得到:
    通过读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
  20. 一种拍摄设备,其特征在于,所述拍摄设备包括存储模块,处理模块以及写模块;
    所述存储模块包括N个存储介质,其中,N为大于或等于2的正整数;
    所述处理模块,用于在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
    所述写模块,用于将所述拍摄设备拍摄的视频数据写入所述处理模块选择的所述第一目标存储介质;
    所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置 的应用计算得到所述第一目标存储介质。
  21. 根据权利要求20所述的拍摄设备,其特征在于,所述处理模块还用于:
    在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
    采用乒乓交替方式通过所述写模块将所述索引文件写入所述第一目标存储介质和/或备用存储介质。
  22. 根据权利要求21所述的拍摄设备,其特征在于,所述处理模块还用于:
    根据所述索引文件对所述视频数据定时进行增量备份或全备份。
  23. 根据权利要求21所述的拍摄设备,其特征在于,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度。
  24. 根据权利要求20-23任一所述的拍摄设备,其特征在于,所述处理模块具体用于:
    在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
    根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。
  25. 根据权利要求24所述的拍摄设备,其特征在于,所述处理模块具体用于执行以下之一:
    若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质;
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目 的存储介质作为所述第一目标存储介质;
    或者,若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质。
  26. 根据权利要求25所述的拍摄设备,其特征在于,所述处理模块具体用于:
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则按照均衡算法将所述视频数据分为至少两块数据,并通过所述写模块将所述至少两块数据分别写入所述至少2个目的存储介质;
    所述处理模块还用于:
    在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并,并通过所述写模块迁移至所述N个存储介质中的第二目标存储介质。
  27. 根据权利要求26所述的拍摄设备,其特征在于,所述处理模块具体用于:
    根据所述至少两块数据中每块数据对应的索引信息,按照帧数据的时间戳将所述至少两块数据拼接,形成一个视频文件。
  28. 根据权利要求25所述的拍摄设备,其特征在于,所述处理模块具体用于:
    若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则通过所述写模块将所述视频数据写入所述临时存储介质;
    所述处理模块还用于:
    在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据通过所述写模块迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质。
  29. 根据权利要求25-28任一所述的拍摄设备,其特征在于,所述拍摄设 备还包括监控模块,在拍摄过程中,所述处理模块为视频数据建立索引文件之后,采用乒乓交替方式通过所述写模块将所述索引文件写入所述第一目标存储介质中之前,还用于:
    通过所述监控模块按队列管理方式对所述视频数据进行监控;
    在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
    根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,通过所述写模块将所述写队列中等待写入的帧数据,以及未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
  30. 根据权利要求24所述的拍摄设备,其特征在于,所述处理模块至少还执行以下之一:
    若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
    若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
    或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
  31. 根据权利要求30所述的拍摄设备,其特征在于,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述处理模块还用于:
    在将所述视频数据写入所述内部存储介质时,通过所述写模块将写入所述内部存储介质中的视频数据同步至所述外部存储介质。
  32. 根据权利要求31所述的拍摄设备,其特征在于,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则通过所述写模块将未写入所述内部存储介质的待修复数据写入所述外部存储介质。
  33. 根据权利要求30所述的拍摄设备,其特征在于,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则所述处理模块还用于将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。
  34. 根据权利要求29-33任一所述的拍摄设备,其特征在于,所述监控模块用于在将所述拍摄设备拍摄的视频数据写入所述第一目标存储介质的过程中,实时监测写入状态;
    若所述监控模块所述监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则所述处理模块还用于将第一目标存储介质切换为备用存储介质,通过所述写模块将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
  35. 根据权利要求23至32任一所述的拍摄设备,其特征在于,所述处理模块还用于:
    从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;
    根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第五目标存储介质,并根据所述目标索引信息获取所述待修复数据;
    使用所述待修复数据对所述视频数据进行修复,以及通过所述写模块将修复后的所述视频数据写入所述第五目标存储介质。
  36. 根据权利要求35所述的拍摄设备,其特征在于,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息。
  37. 根据权利要求35或36所述的拍摄设备,其特征在于,所述目标索引信息包括至少一个索引信息,所述处理模块在从所述索引文件中提取目标索引 信息之后,使用所述待修复数据对所述视频数据进行修复之前,还用于:
    根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
    所述使用所述待修复数据对所述视频数据进行修复,包括:
    根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复。
  38. 根据权利要求24所述的拍摄设备,其特征在于,所述处理模块通过执行以下步骤得到存储介质的实际写入速度:
    读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的实际写入速度,所述读写速度包括连续写入速度和随机写入速度。
  39. 一种拍摄设备,其特征在于,所述拍摄设备包括:
    处理器、N个存储器、控制器;
    其中,N为大于或等于2的正整数,所述存储器用于存储程序代码,所述处理器用于调用所述存储器中的程序代码来执行以下操作:
    在拍摄之前,根据预设选择规则在所述N个存储介质中选择用于存储拍摄设备所拍摄的视频数据的第一目标存储介质;
    通过所述控制器将所述拍摄设备拍摄的视频数据写入选择的所述第一目标存储介质;
    所述预设选择规则至少包括以下项之一:根据所述拍摄设备当前拍摄设定的视频码率选择所述第一目标存储介质,根据所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质,根据所述拍摄设备当前拍摄设定的视频码率、以及所述拍摄设备中各存储介质的实际写入速度选择所述第一目标存储介质根据均衡算法选择所述第一目标存储介质,或根据所述拍摄设备中内置的应用计算得到所述第一目标存储介质。
  40. 根据权利要求39所述的拍摄设备,其特征在于,所述处理器还用于:
    在所述拍摄设备拍摄过程中,为拍摄的视频数据建立索引文件,所述索引文件包括所述视频数据的索引信息;
    采用乒乓交替方式通过所述写模块将所述索引文件写入所述第一目标存储介质和/或备用存储介质。
  41. 根据权利要求40所述的拍摄设备,其特征在于,所述处理模块还用 于:
    根据所述索引文件对所述视频数据定时进行增量备份或全备份。
  42. 根据权利要求40所述的拍摄设备,其特征在于,所述索引文件包括至少一个索引信息,每个所述索引信息包括索引号、帧数据的时间戳、帧数据在所述视频数据中的偏移以及帧数据的长度。
  43. 根据权利要求40-42任一所述的拍摄设备,其特征在于,所述处理器具体用于:
    在拍摄之前,根据目的存储介质和所述拍摄设备当前拍摄设定的视频码率计算将拍摄的视频数据写入目的存储介质所需的理论写入速度,所述目的存储介质为所述拍摄设备当前设定的存储模式对应的用于存储所述视频数据的存储介质;
    根据所述理论写入速度和/或所述拍摄设备当前设定的存储模式,确定用于存储视频数据的第一目标存储介质。
  44. 根据权利要求43所述的拍摄设备,其特征在于,所述处理器具体用于执行以下之一:
    若所述N个存储介质中的至少2个存储介质的实际写入速度均大于或等于所述理论写入速度,则按照用户配置信息或均衡算法选择所述第一目标存储介质;
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和大于或等于所述理论写入速度,则从所述至少2个存储介质中选择至少2个目的存储介质作为所述第一目标存储介质;
    或者,若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则将实际写入速度均大于或等于所述理论写入速度的存储介质作为临时存储介质。
  45. 根据权利要求44所述的拍摄设备,其特征在于,所述处理器具体用于:
    若所述N个存储介质中的每个存储介质的实际写入速度均小于所述理论写入速度,且所述N个存储介质中的至少2个存储介质的实际写入速度总和 大于或等于所述理论写入速度,则按照均衡算法将所述视频数据分为至少两块数据,并通过所述写模块将所述至少两块数据分别写入所述至少2个目的存储介质;
    所述处理器还用于:
    在所述拍摄设备的空闲时间或低负载时,将写入所述至少2个目的存储介质的所述至少两块数据合并,并通过所述写模块迁移至所述N个存储介质中的第二目标存储介质。
  46. 根据权利要求45所述的拍摄设备,其特征在于,所述处理器具体用于:
    根据所述至少两块数据中每块数据对应的索引信息,按照帧数据的时间戳将所述至少两块数据拼接,形成一个视频文件。
  47. 根据权利要求44所述的拍摄设备,其特征在于,所述处理器具体用于:
    若所述N个存储介质中,仅有1个存储介质的实际写入速度大于或等于所述理论写入速度,则通过所述写模块将所述视频数据写入所述临时存储介质;
    所述处理器还用于:
    在所述拍摄设备的空闲时间或低负载时,将写入所述临时存储介质的所述视频数据通过所述写模块迁移至所述N个存储介质中除所述临时存储介质之外的第三目标存储介质。
  48. 根据权利要求44-47任一所述的拍摄设备,其特征在于,所述在拍摄过程中,所述处理器为视频数据建立索引文件之后,采用乒乓交替方式通过所述写模块将所述索引文件写入所述第一目标存储介质中之前,还用于:
    按队列管理方式对所述视频数据进行监控;
    在编码完成的帧数据进入写队列之前,判断所述写队列当前的占用率高于第一阈值时,则确定写操作异常;
    根据所述预设选择规则从所述N个存储介质中选择第四目标存储介质,通过所述写模块将所述写队列中等待写入的帧数据,以及未进入所述写队列的已编码的帧数据写入所述第四目标存储介质。
  49. 根据权利要求43所述的拍摄设备,其特征在于,所述处理器至少还执行以下之一:
    若所述拍摄设备的外部存储介质的实际写入速度小于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述拍摄设备的内部存储介质作为所述第一目标存储介质;
    若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为内部存储模式,或当前设定的存储模式为自动模式,则选择所述内部存储介质作为所述第一目标存储介质;
    或者,若所述拍摄设备的外部存储介质的实际写入速度大于或等于所述理论写入速度,且所述拍摄设备当前设定的存储模式为外部存储模式,则选择所述外部存储介质作为所述第一目标存储介质。
  50. 根据权利要求49所述的拍摄设备,其特征在于,当所述拍摄设备当前设定的存储模式为外部存储模式,且选择所述内部存储介质作为所述第一目标存储介质时,所述处理器还用于:
    在将所述视频数据写入所述内部存储介质时,通过所述写模块将写入所述内部存储介质中的视频数据同步至所述外部存储介质。
  51. 根据权利要求50所述的拍摄设备,其特征在于,在将所述视频数据写入所述内部存储介质过程中,当所述内部存储介质的实际写入速度低于所述理论写入速度时,则所述处理器还用于通过所述写模块将未写入所述内部存储介质的待修复数据写入所述外部存储介质。
  52. 根据权利要求49所述的拍摄设备,其特征在于,在选择所述外部存储介质作为所述第一目标存储介质时,若视频数据无法写入所述外部存储介质,则所述处理器还用于将第一目标存储介质切换为所述内部存储介质,并在所述内部存储介质中记录切换时刻之后写入所述内部存储介质中的帧数据,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述内部存储介质中的帧数据与写入所述外部存储介质的帧数据合并,并迁移至备用存储介质。
  53. 根据权利要求39-52任一所述的拍摄设备,其特征在于,所述拍摄设备还包括监控模块,所述监控模块用于在将所述拍摄设备拍摄的视频数据写入 所述第一目标存储介质的过程中,实时监测写入状态;
    若监测到将所述拍摄设备拍摄的视频数据无法写入所述第一目标存储介质,则所述处理器将第一目标存储介质切换为备用存储介质,通过所述写模块将所述拍摄设备拍摄的视频数据写入所述备用存储介质,以便在所述拍摄设备的空闲时间或低负载时,通过所述拍摄设备内置的应用或用户配置方式将写入所述备用存储介质中的帧数据与写入所述第一目标存储介质的帧数据合并,形成一个视频文件。
  54. 根据权利要求42至51任一所述的拍摄设备,其特征在于,所述处理器还用于:
    从所述外部存储介质和所述内部存储介质中读取所述索引文件,从所述索引文件中提取目标索引信息;
    根据均衡算法选择用于存储修复所述待修复数据后的所述视频数据的第五目标存储介质,并根据所述目标索引信息获取所述待修复数据;
    使用所述待修复数据对所述视频数据进行修复,以及通过所述写模块将修复后的所述视频数据写入所述第五目标存储介质。
  55. 根据权利要求54所述的拍摄设备,其特征在于,所述目标索引信息包括索引号、帧头信息、所述待修复数据中每个帧数据存储的索引信息、以及切换时刻之后写入所述内部存储介质中的帧数据的索引信息。
  56. 根据权利要求54或55所述的拍摄设备,其特征在于,所述目标索引信息包括至少一个索引信息,所述处理器在从所述索引文件中提取目标索引信息之后,使用所述待修复数据对所述视频数据进行修复之前,还用于:
    根据索引号的编排规则,将至少一个索引信息重组为一个索引表;
    所述使用所述待修复数据对所述视频数据进行修复,包括:
    根据所述索引表指示的所述待修复数据中帧数据的时间戳,对所述视频数据进行修复。
  57. 根据权利要求53所述的拍摄设备,其特征在于,所述处理器通过执行以下步骤得到存储介质的实际写入速度:
    读取存储介质的状态寄存器,或对存储介质进行读写速度测试,得到存储介质的写入速度,所述读写速度包括连续写入速度和随机写入速度。
PCT/CN2016/082979 2016-05-23 2016-05-23 一种数据存储的方法及设备 WO2017201646A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2016/082979 WO2017201646A1 (zh) 2016-05-23 2016-05-23 一种数据存储的方法及设备
CN201680003568.6A CN107077514B (zh) 2016-05-23 2016-05-23 一种数据存储的方法及设备

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2016/082979 WO2017201646A1 (zh) 2016-05-23 2016-05-23 一种数据存储的方法及设备

Publications (1)

Publication Number Publication Date
WO2017201646A1 true WO2017201646A1 (zh) 2017-11-30

Family

ID=59624503

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/082979 WO2017201646A1 (zh) 2016-05-23 2016-05-23 一种数据存储的方法及设备

Country Status (2)

Country Link
CN (1) CN107077514B (zh)
WO (1) WO2017201646A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688070A (zh) * 2018-12-13 2019-04-26 迈普通信技术股份有限公司 一种数据调度方法、网络设备及转发单元
CN112631524A (zh) * 2020-12-29 2021-04-09 杭州海康汽车软件有限公司 一种存储介质分配方法、装置及电子设备
CN114245052A (zh) * 2021-12-28 2022-03-25 浙江大华技术股份有限公司 视频数据的存储方法及装置、存储介质、电子装置

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108520569A (zh) * 2018-03-30 2018-09-11 深圳市华宝电子科技有限公司 视频数据的存储方法、装置、系统及存储介质
CN110770713A (zh) * 2018-07-31 2020-02-07 深圳市大疆创新科技有限公司 文件浏览方法、电子设备、机器可读存储介质
CN110795316A (zh) * 2018-08-01 2020-02-14 昆山研达电脑科技有限公司 摄像设备警示方法
CN110809874A (zh) * 2018-08-24 2020-02-18 深圳市大疆创新科技有限公司 数据的同步方法及系统、可移动平台和可读存储介质
CN109445527B (zh) * 2018-12-21 2019-12-13 李银花 平板电脑数据转存系统
CN112506447B (zh) * 2021-02-01 2021-04-30 成都焱之阳科技有限公司 一种用于视频监控设备的数据无锁缓存方法和服务器
CN114461151B (zh) * 2022-04-11 2022-08-26 武汉中科通达高新技术股份有限公司 国标相机的视频存储方法、计算机设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090129744A1 (en) * 2007-11-16 2009-05-21 Canon Kabushiki Kaisha Video processing apparatus, method, and storage medium
CN102264003A (zh) * 2010-05-27 2011-11-30 华为软件技术有限公司 降低码率的实现方法与相关设备及系统
CN102811344A (zh) * 2011-12-08 2012-12-05 苏州科达科技有限公司 一种视频监控系统中提高存储稳定性的控制方法以及装置
CN103916716A (zh) * 2013-01-08 2014-07-09 北京信威通信技术股份有限公司 一种无线网络下视频实时传输的码率平滑方法
CN104394382A (zh) * 2014-12-09 2015-03-04 浙江省公众信息产业有限公司 视频监控录像的存储方法、设备和系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5508128B2 (ja) * 2010-05-10 2014-05-28 キヤノン株式会社 映像記録装置及びその制御方法
CN102623033A (zh) * 2011-01-31 2012-08-01 苏州科达科技有限公司 一种基于快速视频数据存储的文件系统的控制方法及装置
CN104765576B (zh) * 2015-04-28 2017-10-31 广东欧珀移动通信有限公司 一种数据存储方法和数据存储装置

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090129744A1 (en) * 2007-11-16 2009-05-21 Canon Kabushiki Kaisha Video processing apparatus, method, and storage medium
CN102264003A (zh) * 2010-05-27 2011-11-30 华为软件技术有限公司 降低码率的实现方法与相关设备及系统
CN102811344A (zh) * 2011-12-08 2012-12-05 苏州科达科技有限公司 一种视频监控系统中提高存储稳定性的控制方法以及装置
CN103916716A (zh) * 2013-01-08 2014-07-09 北京信威通信技术股份有限公司 一种无线网络下视频实时传输的码率平滑方法
CN104394382A (zh) * 2014-12-09 2015-03-04 浙江省公众信息产业有限公司 视频监控录像的存储方法、设备和系统

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109688070A (zh) * 2018-12-13 2019-04-26 迈普通信技术股份有限公司 一种数据调度方法、网络设备及转发单元
CN112631524A (zh) * 2020-12-29 2021-04-09 杭州海康汽车软件有限公司 一种存储介质分配方法、装置及电子设备
CN114245052A (zh) * 2021-12-28 2022-03-25 浙江大华技术股份有限公司 视频数据的存储方法及装置、存储介质、电子装置
CN114245052B (zh) * 2021-12-28 2024-04-16 浙江大华技术股份有限公司 视频数据的存储方法及装置、存储介质、电子装置

Also Published As

Publication number Publication date
CN107077514B (zh) 2021-05-25
CN107077514A (zh) 2017-08-18

Similar Documents

Publication Publication Date Title
WO2017201646A1 (zh) 一种数据存储的方法及设备
US8332354B1 (en) Asynchronous replication by tracking recovery point objective
US8286030B1 (en) Information lifecycle management assisted asynchronous replication
WO2017162033A1 (zh) 数据迁移的优化方法、评估方法及处理方法及装置
US8200927B2 (en) Data backup management system, computer system, and program recording medium
CN101945131B (zh) 一种基于存储虚拟化的数据迁移方法
TWI531901B (zh) 群組表資料沖除技術
EP3490194B1 (en) Method and device for playing video
CN109271098A (zh) 一种数据迁移方法及装置
JP2004086823A (ja) 情報処理装置、情報処理方法および情報処理プログラム
WO2014075586A1 (zh) 一种jbod阵列自动恢复存储的方法和装置
WO2017014814A1 (en) Replicating memory volumes
JP6137980B2 (ja) 記録装置およびその制御方法
US11934665B2 (en) Systems and methods for ephemeral storage snapshotting
CN109669818A (zh) 无本地缓存的连续数据保护方法和系统
CN101465145B (zh) 记录设备
JP6582721B2 (ja) 制御装置、ストレージシステム、及び制御プログラム
US7657700B2 (en) Recording device, recording-medium-management method, program of recording-medium-management method, and recording medium recording program of recording-medium-management method
JP2013235317A (ja) 仮想計算機システム
US8761573B2 (en) Recording device, imaging and recording device, recording method, and program
CN111142802B (zh) 一种基于虚拟块设备存储的回迁卷级数据的方法及系统
CN105357462B (zh) 一种pvr分区录制方法及系统
CN113467698A (zh) 基于文件系统的写方法、装置、计算机设备和存储介质
JP5933875B1 (ja) 情報処理装置及び起動方法
CN104391763B (zh) 基于设备视图冗余的众核处理器容错方法

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

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

Ref document number: 16902636

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 16902636

Country of ref document: EP

Kind code of ref document: A1