CN115328391A - Storage method, device and management method for local recording of video acquisition equipment - Google Patents

Storage method, device and management method for local recording of video acquisition equipment Download PDF

Info

Publication number
CN115328391A
CN115328391A CN202210826895.9A CN202210826895A CN115328391A CN 115328391 A CN115328391 A CN 115328391A CN 202210826895 A CN202210826895 A CN 202210826895A CN 115328391 A CN115328391 A CN 115328391A
Authority
CN
China
Prior art keywords
file
gop
index
hole
record
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202210826895.9A
Other languages
Chinese (zh)
Inventor
赵頔
左成
余昌乐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fiberhome Telecommunication Technologies Co Ltd
Original Assignee
Fiberhome Telecommunication Technologies Co Ltd
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 Fiberhome Telecommunication Technologies Co Ltd filed Critical Fiberhome Telecommunication Technologies Co Ltd
Priority to CN202210826895.9A priority Critical patent/CN115328391A/en
Publication of CN115328391A publication Critical patent/CN115328391A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • 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
    • 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/0674Disk device
    • G06F3/0676Magnetic disk device

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)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

The invention discloses a storage method, a device and a management method for local recording of video acquisition equipment, wherein the storage method comprises the steps of firstly, selecting continuous storage space on a local storage medium, pre-distributing a plurality of areas with fixed sizes in the selected continuous storage space, and creating a cavity file according to the pre-distributed areas with fixed sizes; and then initializing each hole file, creating a memory management structure of the hole file, and mapping the memory management structure of the hole file into a file form to be written into a storage medium to form a total warehouse index. The method and the device solve the problem that in the prior art, the local storage performance is degraded to influence the local recording and writing performance under the conditions that the local storage medium fragments are too many and the channel is damaged or the local storage medium is damaged after the local recording is carried out for a long time.

Description

Storage method, device and management method for local recording of video acquisition equipment
Technical Field
The invention relates to the technical field of card recording of video acquisition equipment, in particular to a storage method, a storage device and a management method for local recording of video acquisition equipment.
Background
Video Capture (Video Capture) refers to converting analog Video into digital Video and storing the digital Video in a format of a digital Video file. The video acquisition is a process of converting video signals output by an analog camera, a video recorder, an LD video disc player and a television into binary digital information through special analog and digital conversion equipment. The most common adaptive acquisition devices are various types of cameras.
Local recording is relative to cloud recording, and media information acquired by a video acquisition device needs to be stored so as to be referred to later and needs to be recorded. Local recording relies on a local storage medium, typically a magnetic disk within the video capture device, an SD card, or the like. The cloud recording is to transmit the media content to a cloud server for storage through network transmission.
Disk Fragments (Disk Fragments) are more preferably referred to as file Fragments because files are stored scattered throughout the Disk, rather than being stored contiguously in contiguous clusters of the Disk. The discontinuous writing of files on the disk or the SD card or the frequent random creation and deletion of files can generate disk fragments, which can lengthen the seek time of the disk or the addressing time of the SD card and affect the system performance. For example, the virtual memory uses a hard disk, and disk fragments are generated on the hard disk, so that the seek time of the hard disk is prolonged by the disk fragments, and the system performance is affected.
The Bad track (Disk Bad Sector) of the Disk is divided into a logic Bad track and a physical Bad track, wherein the former is a soft Bad track, which is usually caused by improper application or operation of software, has little influence on the Disk, and can be repaired by some tools and software or formatting. The latter is a real physical bad track, which indicates that physical damage is generated on the magnetic track of your hard disk and cannot be repaired by software, and the physical bad track has infectivity to spread to the periphery, so that data stored near the bad track is in a dangerous situation. Under the condition, the bad track is isolated as soon as possible, namely the hard disk partition is changed, the bad sector is concealed, and backup work is performed immediately to avoid the loss of precious data.
The period of a GOP (Group of picture) key frame, i.e. the distance between two key frames, the maximum number of frames of a frame Group, generally speaking, at least 1 key frame is required for each second of video. Increasing the number of critical frames improves quality but increases bandwidth and network load.
With the rapid development of video acquisition services such as security monitoring and the like, local recording of video acquisition equipment is a necessary function, the existing local storage method of the video acquisition equipment adopts a traditional mode to store acquired videos, the performance degradation of the local storage cannot be avoided along with the increase of the service time, and the challenge of how to guarantee the performance of the local recording function for a longer time is unavoidable.
Disclosure of Invention
The invention provides a storage method, a storage device and a management method for local recording of video acquisition equipment, which are used for solving or at least partially solving the technical problem of poor storage performance in the prior art.
In order to solve the above technical problem, a first aspect of the present invention provides a storage method for local recording of a video capture device, including:
selecting a continuous storage space on a local storage medium, pre-allocating a plurality of areas with fixed sizes in the selected continuous storage space, and creating a hole file according to the pre-allocated areas with fixed sizes;
initializing each hole file, and creating a memory management structure of the hole file, wherein the memory management structure of the hole file takes each hole file as a node, the nodes are mutually connected to form an annular linked list, and simultaneously, the current writing position and the serial number of the hole file are recorded;
mapping a memory management structure of the cavity file into a file form to be written into a storage medium to form a total warehouse index, wherein the total warehouse index is of a two-stage structure and comprises a head part and a cavity file list, the head part is used for recording the total number of the cavity files and the serial numbers of the cavity files, the cavity file list is used for storing index information of each cavity file, and the index information of the cavity files comprises file numbers, starting and stopping time stamps, the number of fragments and the start of the serial numbers of the fragments; each hole file in the hole file list is divided into two areas, namely an index recording area and a media recording area, wherein the hole file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the hole file index recording area is used for recording the general information of the hole file, and comprises a file number, a start-stop time stamp, the number of the segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the hole file index recording area corresponds to the index information of each hole file in the hole list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
In one embodiment, the profile information in the hole file index record area header corresponds to index information of each hole file in the hole list in the overall repository index, including:
the file number, start-stop timestamp, number of fragments, and start of sequence number in the header of the hole file index recording area correspond to the file number, start-stop timestamp, number of fragments, and start of sequence number in each hole file index information in the hole list in the total warehouse index one-to-one.
In one embodiment, the number of segment records in the segment records of the hole file index recording area is preset according to the recording scene, and the number of GOP records is obtained according to the size of the media recording area in the hole file, the minimum code rate of video acquisition, the frame rate and the GOP length.
Based on the same inventive concept, a second aspect of the present invention provides a video capture data management method based on the storage method for local recording by a video capture device in the first aspect, including:
s11, reading a total warehouse index, mapping a memory management structure of a cavity file, acquiring a serial number of the recorded cavity file according to the memory management structure, reading index recording area information of the cavity file corresponding to the serial number of the recorded cavity file, and confirming index information of a current GOP record to be written, wherein the index information of the current GOP record to be written comprises offset and length;
s12, judging whether the space capacity of the cavity file media recording area is sufficient, if so, executing S13, otherwise, switching to the next cavity file and restarting to execute the step S11;
s13, cross-comparing the length of the frame to be written with the sum of the offset of the current GOP record to be written with the recorded bad track record, if the cross exists and indicates that the frame to be written may coincide with the known bad track, adjusting the offset in the GOP record to be written to be the address for skipping the bad track record, simultaneously integrally migrating the written frame data in the GOP record to be written, merging the length of the frame data written in the GOP record and the length of the frame to be written into the length of the GOP record to be written, then jumping to S12, if the cross does not exist and indicates that the frame to be written does not coincide with the known bad track, jumping to S14, wherein when the GOP record to be written is written, the frame is written in by taking the frame as a unit;
s14, positioning to a start address of the start sequence writing of the media recording area according to the offset in the index information of the GOP record to be written, packaging according to the recording requirement, and writing the packaged data into the media recording area;
and S15, updating the index recording area information of the hollow file.
In one embodiment, reading the index recording area information of the hole file corresponding to the recording hole file serial number in step S11, and confirming the index information of the current GOP record to be written, includes:
acquiring the file number of the hole file of the total warehouse index according to the recorded hole file serial number, then determining an index recording area of the hole file according to the hole file serial number, and positioning the three-level structure of the index recording area from top to bottom, wherein the method specifically comprises the following steps: loading the head of an index recording area, and finding the last effective fragment according to the number of fragments in the head; then loading the fragment information of the last effective fragment in the fragment recording area, and calculating the last GOP recording according to the GOP index starting point and the GOP number in the fragment informationIndex GOP of A (ii) a Then, the index GOP to be written into the GOP record is obtained according to the index of the last GOP record B ,GOP B =GOP A +1, offset to write GOP record = offset of end GOP record + length of end GOP record.
In one embodiment, step S15 includes: updating is carried out in a sequence from bottom to top, and specifically comprises the following steps: firstly, updating field information of a GOP recording area, when written GOP records are I frames, updating three fields of time stamp, offset and length of the GOP recording area, and otherwise, only updating the length field; then updating field information of the segment recording area, if the current GOP record to be written is the first frame of a certain segment, adding 1 new segment record, and updating all field information in the added new segment record, otherwise, only updating the GOP number of the segment in which the current GOP record to be written is located; and finally, updating field information of the header area, and if the segment recording area is added with new segment records, updating the number of the segments and the timestamp of the dead point of the hole file.
Based on the same inventive concept, a third aspect of the present invention provides a video capture data management method based on the storage method for local recording by the video capture device in the first aspect, including:
s21, reading the total warehouse index, mapping a memory management structure of the hole file, and acquiring a serial number of the recorded hole file according to the memory management structure;
s22, positioning the current recording cavity file according to the serial number of the recording cavity file, starting traversing from the 2 nd file cavity file after the current recording cavity file until the current recording cavity file, inquiring all segments in each cavity file, and combining the segments which contain consistent media metadata and have the interval time less than 1 second.
Based on the same inventive concept, a fourth aspect of the present invention provides a video capture data management method based on the storage method for local recording by a video capture device in the first aspect, including:
s31, reading the total warehouse index, mapping the memory management structure of the void file, and positioning the corresponding void file according to the time to be read;
s32, positioning the corresponding fragment records of the hole file according to the time to be read, and positioning GOP records;
s33, reading the index information recorded by the GOP, completely reading the GOP data at one time, decapsulating the read GOP data frame by frame, and feeding back the decapsulated GOP data to a reading interface;
s34, if the end of one hole file is read, retrieving the memory management structure of the hole file, opening the next hole file with the recorded content to start reading, and re-entering S31; and if the latest GOP of the hole file being recorded is read, reading the end all the time, and ending the reading.
Based on the same inventive concept, a fifth aspect of the present invention provides a storage apparatus for local recording of a video capture device, comprising:
the system comprises a space pre-allocation module, a storage management module and a control module, wherein the space pre-allocation module is used for selecting continuous storage spaces on a local storage medium, pre-allocating a plurality of areas with fixed sizes in the selected continuous storage spaces, and creating a hole file according to the pre-allocated areas with fixed sizes;
the memory management structure creating module is used for initializing each cavity file and creating a memory management structure of the cavity file, wherein each cavity file is used as a node by the memory management structure of the cavity file, the nodes are mutually connected to form an annular linked list, and the current writing position and the number of the currently recorded cavity file are recorded;
the system comprises a general warehouse index creating module, a storing module and a storing module, wherein the general warehouse index creating module is used for mapping a memory management structure of the cavity files into a file form to be written into a storage medium to form a general warehouse index, the general warehouse index is of a two-stage structure and comprises a head and a cavity file list, the head is used for recording the total number of the cavity files and recording the serial numbers of the cavity files, the cavity file list is used for storing index information of each cavity file, and the index information of the cavity files comprises file numbers, start and stop timestamps, the number of fragments and the start of the serial numbers of the fragments; each cavity file in the cavity file list is divided into two areas which are an index recording area and a media recording area respectively, wherein the cavity file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the cavity file index recording area is used for recording the general information of the cavity file, and comprises a file number, a start-stop time stamp, the number of segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the cavity file index recording area corresponds to the index information of each cavity file in the cavity list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
Based on the same inventive concept, a sixth aspect of the present invention provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the method of the first aspect when executing the program.
Compared with the prior art, the invention has the advantages and beneficial technical effects as follows:
the storage method for local recording of the video acquisition equipment constructs a hole file management structure through the pre-allocation space and by adopting an index management mode for the pre-allocation space, and maps the constructed hole file management structure into a file form to be written into a storage medium to form a total warehouse index. The problem that in the prior art, the local storage performance is degraded to influence the local recording and writing performance under the conditions that the local storage medium fragments are too many and the local storage medium encounters a bad track or a local storage medium damaged block after long-time local recording is solved, and the storage performance is improved.
Further, based on the storage method, a video acquisition data management method is also provided, which comprises local storage sequence writing, recording information query and local storage random reading, and realizes sequence writing and rapid random reading.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
FIG. 1 is a schematic diagram of a general warehouse index structure in an embodiment of the present invention;
FIG. 2 is a diagram illustrating a memory management structure of a hole file according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating a structure of a hole file according to an embodiment of the present invention;
FIG. 4 is a flow chart of pre-allocating memory in an embodiment of the present invention;
FIG. 5 is a flow chart of sequential writing of video capture data in an embodiment of the present invention;
FIG. 6 is a flowchart of querying recording information in an embodiment of the present invention;
FIG. 7 is a flow chart of read out from random time sequence in an embodiment of the present invention;
FIG. 8 is a schematic diagram of a custom encryption package supported in an embodiment of the present invention;
FIG. 9 is a diagram of an MPEG PS encapsulation structure supported in an embodiment of the present invention.
Detailed Description
The invention provides a storage method and a storage device for local recording of video acquisition equipment and a management method for video acquisition data. Through the pre-allocation space and the index management mode adopted for the pre-allocation space, the method is convenient and rapid to position, retrieve and playback, and simultaneously solves the problems that in the prior art, under the conditions that the fragments of the local storage medium are too many and the local storage medium is subjected to bad tracks or damaged blocks of the local storage medium after long-time recording, the local storage performance is deteriorated, recording is blocked, and even the acquired data to be recorded is overflowed and lost.
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, belong to the protection scope of the present invention.
Example one
The embodiment of the invention provides a storage method for local recording of video acquisition equipment, which comprises the following steps:
selecting continuous storage space on a local storage medium, pre-allocating a plurality of fixed-size areas in the selected continuous storage space, and creating a hole file according to the pre-allocated fixed-size areas;
initializing each cavity file and creating a memory management structure of the cavity file, wherein the memory management structure of the cavity file takes each cavity file as a node, the nodes are mutually connected to form an annular linked list, and simultaneously, the current writing position and the sequence number of the cavity file are recorded;
mapping a memory management structure of the cavity file into a file form to be written into a storage medium to form a total warehouse index, wherein the total warehouse index is of a two-stage structure and comprises a head part and a cavity file list, the head part is used for recording the total number of the cavity files and the serial numbers of the cavity files, the cavity file list is used for storing index information of each cavity file, and the index information of the cavity files comprises file numbers, starting and stopping time stamps, the number of fragments and the start of the serial numbers of the fragments; each cavity file in the cavity file list is divided into two areas which are an index recording area and a media recording area respectively, wherein the cavity file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the cavity file index recording area is used for recording the general information of the cavity file, and comprises a file number, a start-stop time stamp, the number of segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the cavity file index recording area corresponds to the index information of each cavity file in the cavity list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
FIG. 4 is a flow chart of pre-allocating memory according to an embodiment of the present invention.
In a specific implementation process, a continuous storage space is selected on a local storage medium, and a plurality of areas with fixed sizes are pre-allocated in the selected continuous storage space, that is, a space pre-allocation process is performed, and the space pre-allocation can be realized by the following method: the storage medium is formatted and then allocated a number of fixed-size files, named hole files in this embodiment, by the kernel's fallocate mechanism (pre-allocation mechanism). The size of the cavity file needs to be limited, the size of the content to be recorded needs to be set to be 1-2 hours according to the code rate of the video acquisition equipment, and then the whole is rounded up according to the integral multiple of the data cluster stored in the file system. The total space occupied by the cavity file is limited, the occupation ratio is about 90% -95%, 5% -10% of residual space needs to be reserved, and the file system layer is used for isolation of bad channel repair when the subsequent storage medium is damaged and repaired.
Referring to fig. 1 to fig. 3, in which fig. 1 is a schematic diagram of a general warehouse index structure in an embodiment of the present invention, and fig. 2 is a schematic diagram of a memory management structure of a hole file in an embodiment of the present invention; FIG. 3 is a diagram illustrating a structure of a hole file according to an embodiment of the present invention.
The memory management structure records the current writing position at the same time, so that the writing positioning is convenient. The memory management structure of the hole file needs to be mapped into a file format for long-term storage and written into a storage medium, which is referred to as a total repository index in this embodiment. The total warehouse index file will store 2 copies, backup each other.
The general warehouse index structure is characterized by comprising a two-stage structure: a header and a hole file list. The head records the total number of the hole files and records the serial numbers of the hole files. The sequence in the hole file column represents the sequencing between the hole files, and each hole file in the hole file list needs to record the file number, the starting and stopping time stamps, the number of fragments and the starting of the fragment sequence number. The tail of the hole file list also comprises file list information CRC check used for checking the integrity of the list information. In addition, the header can extend information such as the recording device model, the device mac, etc. for checking and recording information for additional service requirements.
The storage structure of each hole file index recording area in the hole file list is characterized by comprising a three-level structure: header, clip recording, and GOP recording. The hole file index recording area is fixed at the head or tail of the hole file, and the size of the occupied space is related to the length of the segment record and the GOP record. The rest parts of the hole file except the index recording area are the medium recording areas. The head of the hole file index recording area records the general information of the hole file, including the file number, the starting and stopping time stamp, the number of the segments, the starting of the segment sequence number and the bad track record. Except for the bad track record, other items are in one-to-one correspondence with each hole file item in the hole file list in the total warehouse index.
The start time stamp and the stop time stamp in the header include a start time stamp and a stop time stamp, where the start time stamp and the stop time stamp of the area refer to time stamps of a start point and a stop point of the cavity file, specifically, the start time stamp refers to a start time stamp of a start segment (a first segment) in the cavity file, and the stop time stamp refers to a stop time stamp of a last segment.
The start and stop timestamps in a segment record include a start timestamp and a stop timestamp, where the start and stop timestamps in the region are timestamps for the start and stop of the segment, and specifically, the start timestamp is the start timestamp for the start GOP record in the segment, and the stop timestamp is the timestamp for the end frame (which may be a GOP record or other type of frame) in the segment.
In one embodiment, the profile information in the hole file index record area header corresponds to index information of each hole file in the hole list in the aggregate repository index, including:
the file number, the start-stop timestamp, the number of segments, and the start of the segment sequence number in the header of the hole file index recording area correspond to the file number, the start-stop timestamp, the number of segments, and the start of the segment sequence number in each hole file index information in the hole list in the total warehouse index one by one.
In one embodiment, the maximum number of storable segment records in the segment records of the hole file index recording area is preset according to the recording scene, and the maximum number of GOP records storable in the GOP records is obtained according to the size of the medium recording area in the hole file, the minimum code rate of video acquisition, the frame rate and the GOP length.
Specifically, the segment records in the hole file index recording area store information of 1 to n segments, where n is the maximum number of segment records that can be stored, and is set in advance according to the characteristics of the recording scene, and is fixed during initialization after pre-allocation, and the set principle is that a smaller n value can be set if the recording is stable for a long time, and a larger n value is set if the recording process is frequently interrupted. The information of each segment needs to include a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a segment data length and a packaging type, wherein the sequence number is the number of the segment, the start-stop time stamp is the start-stop UTC time precision of the content included in the segment at least to the millisecond level, and the media metadata is the data included in the segment.
The GOP index starting point corresponds to the offset value of the GOP nodes in the GOP recording area, the GOP number refers to the number of GOP nodes from the offset value of the GOP nodes to the back, the section data length refers to the storage space actually occupied by the section in the statistical media recording area.
The GOP record of the hole file index recording area is information of 1 to m GOPs, wherein m refers to the maximum number of GOPs which can be stored, and the number of m is obtained by rounding down the frame rate and the GOP length according to the size of the media recording area and the minimum code rate of video acquisition in the hole file, namely m = (the size of the media recording area/the minimum code rate of video acquisition)/(the GOP length/the frame rate). Each GOP record needs to contain an offset, a timestamp, and a length, where the offset refers to an offset address of the video GOP starting position from the head of the hole file, the length refers to the total length of the GOP occupied in the hole file, and the timestamp refers to the time corresponding to the GOP.
Example two
Based on the same inventive concept, the present embodiment provides a video capture data management method based on the storage method for local recording of the video capture device in the first embodiment, including:
s11, reading a total warehouse index, mapping a memory management structure of a cavity file, acquiring a serial number of the recorded cavity file according to the memory management structure, reading index recording area information of the cavity file corresponding to the serial number of the recorded cavity file, and confirming index information of a current GOP record to be written, wherein the index information of the current GOP record to be written comprises offset and length;
s12, judging whether the space capacity of the cavity file media recording area is sufficient, if so, executing S13, otherwise, switching to the next cavity file and restarting to execute the step S11;
s13, cross-comparing the length of the frame to be written with the sum of the offsets of the current GOP record to be written with the recorded bad track record, if the cross exists and indicates that the frame to be written may coincide with the known bad track, adjusting the offset in the GOP record to be written to be the address for skipping the bad track record, integrally migrating the written frame data in the GOP record to be written, combining the length of the frame data written in the GOP record and the length of the frame to be written to be the length of the GOP record to be written, jumping to the step S12, and if the cross does not exist and indicates that the frame to be written does not coincide with the known bad track, jumping to S14, wherein when the GOP record to be written is written, the frame is written by taking the frame as a unit;
s14, positioning to a start address of the start sequence writing of the media recording area according to the offset in the index information of the GOP record to be written, packaging according to the recording requirement, and writing the packaged data into the media recording area;
and S15, updating the index recording area information of the hollow file.
Fig. 5 is a flowchart illustrating sequential writing of video capture data according to an embodiment of the present invention.
In S13, the frame length to be written refers to the length of the frame written in the recording area of the medium. In the write operation, the current GOP record to be written is written in units of frames. The current GOP record to be written has two conditions, the first condition is that the frame to be written is written for the first time, namely the frame to be written is the first frame, the second condition is that the frame to be written is not written for the first time, and the frame to be written is not the first frame, at the moment, the current GOP record to be written has written partial data, namely the written frame data is included.
Under normal conditions (namely when no bad track appears), for a frame of data, the length of the frame (namely the length of the frame to be written) can be obtained according to the packaging rule, and then the frame is written in the corresponding storage space of the media recording area according to the length of the frame to be written.
When a bad track is encountered, if the frame to be written is an I-frame, that is, the first frame of the GOP record, a normal position can be found by adjusting the offset address in the GOP recording area to start writing. If the frame to be written is not an I-frame, it indicates that the continuous region from the offset address to the back before the media recording region is abnormal, and the subsequent continuous space is not enough to satisfy the total length of the written GOP record, at this time, the content (written frame data) written in the GOP record needs to be read out, and continuous writing is performed again in the media recording region according to the length of the written frame and the length of the frame to be written as the length of one GOP record.
With reference to fig. 3, a description is given of an update situation of a field related to an index recording area in a write operation in the video acquisition data management method:
in general, the related fields of the index recording area are updated in a bottom-up order, the fields of the GOP recording area are updated first, then the clip recording area is updated, and finally the related fields of the header area are updated.
Specifically, the GOP recording area is updated first. And judging whether the GOP record to be written is an I frame (first frame), if so, updating three fields of a time stamp, an offset and a length of the GOP record to be written according to the information of the GOP record to be written, and if so, only updating the length field.
The fields of the fragment record are then updated. Judging whether the GOP record to be written is the first frame of a certain segment, namely whether the first update of a write cycle is entered, if so, adding 1 new segment record in the segment record area, and filling all fields of the segment record, including: the sequence number is the sequence number of the last fragment record plus 1, the starting time stamp is the I-frame time stamp of the current time, the ending time stamp is the I-frame time stamp of the current time, the video part in the media metadata is updated, the maximum code rate is the currently set maximum code rate, the GOP index starting point is the array number of GOP written in the GOP recording area, the GOP number is 1, the fragment length is the length of the current I-frame data, and the packaging type is the packaging type set by the media area when the current data is written. (media metadata includes video coding mode, resolution, frame rate, gop length, audio coding mode, audio sampling rate, audio bit depth, number of audio channels). If the current frame is not the first frame of a certain section, namely the first cyclic update is not performed, the stop time stamp is updated to be the current frame time stamp in the latest section record, the media metadata field is updated, the audio part in the media metadata is supplemented (only when the audio frame is written for the first time after the new section record is added), the GOP number is updated (only for the situation that the GOP is increased, namely whether the GOP record to be written is an I frame or not), and the update section data length is the sum of the previous value and the current data frame length.
And finally, updating the field of the header area, if 1 new fragment record is added, updating the number of the fragments of the header and the timestamp of the dead point of the hole file, otherwise, only updating the timestamp of the dead point in the field of the timestamp of the start and stop of the hole file.
In general, step S11 is to load the total warehouse index, step S12 is to determine whether the capacity of the hole file medium recording area is sufficient, step S13 is to determine to skip the known bad track, step S14 is to write data sequentially, and step S15 is to update the hole file index recording area information.
When step S12 is executed, if the data to be written is an I frame (GOP head frame), it is evaluated whether the remaining space is enough for GOP storage according to the coding rate of the video capture device, and if it is sufficient, step S13 is executed. If the data to be written is not an I-frame, the space should be theoretically sufficient since the I-frame has been estimated previously as the GOP space. Here only protection is required: and confirming whether the current data is written into the recording area and exceeds the size of the recording area, if so, entering a step S13, and otherwise, returning to the step S11 to open a new file. In addition, when switching to the next hole file to resume step S11, if the next hole file has recorded content, a reclamation operation, that is, reinitializing the index recording area, needs to be performed before jumping to S11. In the specific implementation process, the method for reinitializing the index recording area of the hole file comprises the following steps: and (4) all fields except the file number of the head and the bad track record in the index record area are subjected to 0 setting.
S13, the cross comparison process is that the GOP is written according to the current plan B The offset + the current data frame length in (1) is taken as a section 1, and whether the section 1 intersects with a section 2 formed by the offset address and the corresponding length recorded in the 1 st record in the bad track record is judged. Adjusting GOP if they intersect B The recorded offset address is the offset address of the current record entry in the bad track record + the address after the length in the bad track record, and then compared with the next bad track record. After all bad track record comparisons are completed in sequence, the GOP is completed B Adjustment of recorded offset addresses. It should be noted that the length in the bad track record refers to the length of the suspected bad track, and the bad track record records 2 fields at a time, 1) offset address, and 2) length. The length is calculated by "the write length rounded up according to the size of the local storage device cluster", for example, if the cluster size is 4KB, and the current write exception is 201KB of content to be written, the length in the bad track record is rounded up to 204KB according to the cluster size.
When the sequential writing is performed in step S14, the entire write operation duration is recorded, and the write abnormality is classified. When a forced interruption occurs in writing or the operation recording duration exceeds a certain duration: if the written video exceeds 100ms or the written audio exceeds 40ms, the written area is determined as a suspected bad track, a bad track recording table in the index head is added, the content of the bad track recording table is counted, the current writing offset address and the writing length are rounded up according to the size of the local storage equipment cluster, and the step S13 is returned to for processing again; otherwise, writing feedback, and entering S15 if normal. When the write exception occurs, the write handle exists, but the write operation prompts that the file does not exist, the file update handle is tried to be opened again, and the write is retried.
In one embodiment, reading the index recording area information of the hole file corresponding to the recording hole file serial number in step S11, and determining the index of the current GOP record to be written includes:
acquiring the file number of the hole file of the total warehouse index according to the recorded hole file serial number, then determining an index recording area of the hole file according to the hole file serial number, and positioning the three-level structure of the index recording area from top to bottom, wherein the method specifically comprises the following steps: loading the head of an index recording area, and finding the last effective fragment according to the number of the fragments in the head; then loading the fragment information of the last effective fragment in the fragment recording area, and calculating the last GOP index GOP according to the GOP index starting point and the GOP number in the fragment information A (ii) a Then, the index GOP to be written into the GOP record is obtained according to the last GOP index B ,GOP B =GOP A +1, GOP to be written B Offset of = GOP A Medium offset + GOP A Medium length.
Specifically, the last GOP index is calculated in the following manner: GOP A = GOP index start point + GOP number, if the number of index recording area header segments is 0, the first writing is performed, and the index to be written into the GOP record is also 0 by default.
In one embodiment, step S15 includes: updating is carried out by adopting a sequence from bottom to top, and specifically comprises the following steps: firstly, updating the length of a current GOP record to be written, then updating the information of the segment record, and if the current GOP record to be written is the first frame of a certain segment, synchronously adding a new segment record; otherwise, only updating the GOP number of the segment where the current GOP record to be written is located, and finally updating the segment number of the header region.
EXAMPLE III
Based on the same inventive concept, the present embodiment provides a video capture data management method based on the storage method for local recording by video capture equipment in the first embodiment, including:
s21, reading the total warehouse index, mapping a memory management structure of the hole file, and acquiring a serial number of the recorded hole file according to the memory management structure;
s22, positioning the current recording cavity file according to the serial number of the recording cavity file, starting traversing from the 2 nd file cavity file after the current recording cavity file until the current recording cavity file, inquiring all segments in each cavity file, and combining the segments which contain consistent media metadata and have the interval time less than 1 second.
The purpose of merging is to facilitate reading, since read query accuracy is typically seconds, and fragment records are at least millisecond accurate, so merging is required for 2 fragments read less than 1 second.
Fig. 6 is a flowchart illustrating a process of querying recording information according to an embodiment of the present invention.
Specifically, the recent query recording information is required to be read out from the random time sequence, and the recent query recording information is generally within 10 minutes. The reason why the traversing starting point selects the second 2 nd file hole file of the currently recorded hole file is that 1 hole file needs to be reserved as write preparation, so that read-write conflict is avoided.
Example four
Based on the same inventive concept, the present embodiment provides a video capture data management method based on the storage method for local recording of the video capture device in the first embodiment, including:
s31, reading the total warehouse index, mapping the memory management structure of the void file, and positioning the corresponding void file according to the time to be read;
s32, positioning the fragment records of the corresponding hole file according to the time to be read, and positioning GOP records;
s33, reading the index information recorded by the GOP, completely reading the GOP data at one time, decapsulating the read GOP data frame by frame, and feeding back the decapsulated GOP data to a reading interface;
s34, if the end of one hole file is read, retrieving the memory management structure of the hole file, opening the next hole file with the recorded content to start reading, and re-entering S31; and if the latest GOP of the hole file being recorded is read, reading the end all the time, and ending the reading.
Fig. 7 is a flowchart of reading from a random time sequence according to an embodiment of the present invention.
Specifically, the implementation of S32 is to sequentially locate from top to bottom according to the three-level structure of the index recording area: first three layers of this header are loaded, and the total number of fragments is determined. Then, all clips are queried as to which clip the read time falls within, then this clip information is loaded, and then the GOP closest to the time to be read is queried. Since the clip records and the GOP records are both incremented in time in one direction, a fast lookup method such as, but not limited to, binary lookup may be used. After finding the GOP closest to the time to be read, the process proceeds to S33 with the GOP index as the starting GOP. If the file header or the fragment record is read to be abnormal, a self-checking mechanism is started, the lower-level record information is automatically searched in a traversing mode, and the storage record is repaired. Since the data is stored hierarchically, the upper level corresponds to the generalization of the content of the lower level, and when the information of the header (upper level) region is abnormal, the information stored in the upper level region can be repaired by performing a check by traversing all the information (slice recording region, GOP recording region) of the lower level region.
Referring to fig. 8 and 9, fig. 8 is a schematic diagram illustrating a custom cryptographic package supported in an embodiment of the present invention; FIG. 9 is a diagram of an MPEG PS encapsulation structure supported in an embodiment of the present invention.
The working process of the scheme is described below by taking the recording function of the TF card in the monitoring camera as an example, and reading the TF card after recording, writing and querying.
Firstly, a camera acquisition coding unit continuously generates video and audio, video H.265 coding, resolution 2560x1440, frame rate 20 frames, GOP length 40, maximum code rate 2.5Mbps, minimum code rate 128kbps, sound G711A coding, single sound channel, bit depth 1qubit and 8000 sampling rate. The process is the standard input of the acquisition equipment to the local recording, and does not relate to the technical scheme.
The specific implementation process is as follows:
1. a blank TF card with the size of 64GB is inserted into the camera. And the TF card recording function receives the TF card insertion event, checks whether the TF card format and the TF card have the total warehouse index and the cavity file, and prompts a user to format and pre-allocate if the TF card format and the TF card do not have the total warehouse index and the cavity file. The method comprises the steps of sequentially executing space pre-allocation and hole file initialization after permission of a user, and constructing a hole file management structure, wherein a formatting command is called to format a TF card, space is pre-allocated, the size of each hole file is 256MB, finally an index recording area is initialized in each hole file, the size of the index recording area is 1MB, the number of fragment records is 1024 at most, and the number of GOP records is 8192 at most.
2. And receiving audio and video input by the camera, and after receiving the first video I frame, starting to write data frames into the TF card recording function in sequence. And S11 to S15 are sequentially executed, the offset address of the first I frame is confirmed to be written, then the I frame can be packaged in a self-defined encryption packaging format or a PS packaging format selectively but not limited according to the external configuration of the camera, and the packaged data is written in the media recording area. After the writing is successful, a new segment record is added in the segment record area, a sequence number is created, a start point time stamp is written, a stop point time stamp is written, media metadata is written (video H.265 coding, resolution 2560x1440, frame rate 20 frame, GOP length 40, sound G711A coding, single sound channel, bit depth 16bit,8000 sampling rate), the maximum code rate is written to be 2.5Mbps, the start point of GOP index is written to be 1, the segment data length is written to, and the packaging type is written to.
The basis of the selection of the package is that at least audio or video data in the package format is arranged in sequence, which is convenient for subsequent sequential reading, and meanwhile, the package needs to contain or contain frame type, frame length, PTS time stamp and UTC time stamp through the reserved custom field extension. A custom encryption packaging format is that on the basis of an original ES audio and video stream collected by a camera, a custom header (a version header, a frame type, a frame length, a frame PTS timestamp and a frame UTC timestamp) is additionally added, and then the ES header and the custom version header are encrypted together. The PS encapsulation format is to fill and save UTC timestamp in the PS header part with reserved 7 bits based on standard MPEG PS.
3. Subsequent video I, P frames and audio frames are written. And when a P frame and an audio frame are met, sequentially executing the steps S11 to S15, confirming the offset address to be written in the current frame, then adding in the media region corresponding to the GOP where the I frame is located according to the encapsulation rule, updating GOP information after the successful additional writing, and updating the stop point timestamp and the fragment data length in the fragment. And when I frames are encountered, sequentially executing the steps from S11 to S15, adding new GOPs, calculating new offset addresses to be written, and then after success, updating GOP information, and updating the stop point timestamp, the GOP number and the fragment data length in the fragments.
4. After recording for a period of time, recording conditions are inquired. The steps S21 to S22 are performed in sequence, and according to the combined result, only one complete segment is known, for example, and the segment time range is [2022-06-03 00,2022-06-03 17
5. Randomly selecting the play start point to be 2022-06-039, and executing S31 to S34 in sequence. Positioning to a GOP closest to 2022-06-039. Besides carrying media data, each frame of data feeds back corresponding types (audio, video I frame, video P frame), PTS and UTC timestamps corresponding to the frame of data, and all media metadata of the current segment.
According to experimental verification, the scheme of recording fixed duration and cyclic deletion of the recorded files is compared with the scheme. After the continuous recording is carried out for 30 days, no fragment exists on the TF card; the method comprises the steps of recording the file in a circulating mode for a fixed time length and deleting the recorded file in a circulating mode for 3% of TF card fragments. Then counting the write-in time of 1000 times, wherein the write-in time of the TF card is 5-23 ms, and the average time is 13ms; the cyclic recording fixed time length + cyclic deletion recording file scheme TF card writing time length is 5-43 ms, and the average time is 21ms. The effect of the scheme reaches the design expectation.
EXAMPLE five
Based on the same inventive concept, the embodiment provides a storage device for local recording of a video capture device, which comprises:
the system comprises a space pre-allocation module, a storage management module and a control module, wherein the space pre-allocation module is used for selecting continuous storage spaces on a local storage medium, pre-allocating a plurality of areas with fixed sizes in the selected continuous storage spaces, and creating a hole file according to the pre-allocated areas with fixed sizes;
the memory management structure creating module is used for initializing each cavity file and creating a memory management structure of the cavity file, wherein each cavity file is used as a node by the memory management structure of the cavity file, the nodes are mutually connected to form an annular linked list, and the current writing position and the number of the currently recorded cavity file are recorded;
the system comprises a general warehouse index creating module, a storing module and a storing module, wherein the general warehouse index creating module is used for mapping a memory management structure of the cavity files into a file form to be written into a storage medium to form a general warehouse index, the general warehouse index is of a two-stage structure and comprises a head and a cavity file list, the head is used for recording the total number of the cavity files and recording the serial numbers of the cavity files, the cavity file list is used for storing index information of each cavity file, and the index information of the cavity files comprises file numbers, start and stop timestamps, the number of fragments and the start of the serial numbers of the fragments; each cavity file in the cavity file list is divided into two areas which are an index recording area and a media recording area respectively, wherein the cavity file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the cavity file index recording area is used for recording the general information of the cavity file, and comprises a file number, a start-stop time stamp, the number of segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the cavity file index recording area corresponds to the index information of each cavity file in the cavity list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
Since the device described in the fourth embodiment of the present invention is a device used for implementing the storage method for local recording by the video capture device in the first embodiment of the present invention, based on the method described in the first embodiment of the present invention, those skilled in the art can understand the specific structure and deformation of the device, and thus, details are not described herein again. All the devices adopted in the method in the first embodiment of the invention belong to the protection scope of the invention.
EXAMPLE six
Based on the same inventive concept, the present application further provides a computer device, which includes a storage, a processor, and a computer program stored in the storage and executable on the processor, and when the processor executes the computer program, the method in the first embodiment is implemented.
Since the computer device introduced in the fourth embodiment of the present invention is a computer device used for implementing the storage method for local recording by the video capture device in the first embodiment of the present invention, based on the method introduced in the first embodiment of the present invention, a person skilled in the art can understand the specific structure and deformation of the computer device, and thus details are not described herein. All the computer devices used in the method of the first embodiment of the present invention are within the scope of the present invention.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various modifications and variations can be made in the embodiments of the present invention without departing from the spirit or scope of the embodiments of the invention. Thus, if such modifications and variations of the embodiments of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to encompass such modifications and variations.

Claims (10)

1. A storage method for local recording of video acquisition equipment is characterized by comprising the following steps:
selecting continuous storage space on a local storage medium, pre-allocating a plurality of fixed-size areas in the selected continuous storage space, and creating a hole file according to the pre-allocated fixed-size areas;
initializing each cavity file and creating a memory management structure of the cavity file, wherein the memory management structure of the cavity file takes each cavity file as a node, the nodes are mutually connected to form an annular linked list, and simultaneously, the current writing position and the sequence number of the cavity file are recorded;
mapping a memory management structure of the hole file into a file form to be written into a storage medium to form a total warehouse index, wherein the total warehouse index is of a two-stage structure and comprises a head and a hole file list, the head is used for recording the total number of the hole files and the serial numbers of the hole files, the hole file list is used for storing index information of each hole file, and the index information of the hole files comprises file numbers, starting and stopping time stamps, the number of fragments and the start of the sequence numbers of the fragments; each cavity file in the cavity file list is divided into two areas which are an index recording area and a media recording area respectively, wherein the cavity file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the cavity file index recording area is used for recording the general information of the cavity file, and comprises a file number, a start-stop time stamp, the number of segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the cavity file index recording area corresponds to the index information of each cavity file in the cavity list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
2. The method of claim 1, wherein the storing of the local recording by the video capture device, wherein the profile information in the hole file index record header corresponds to the index information of each hole file in the hole list in the global repository index, comprises:
the file number, start-stop timestamp, number of fragments, and start of sequence number in the header of the hole file index recording area correspond to the file number, start-stop timestamp, number of fragments, and start of sequence number in each hole file index information in the hole list in the total warehouse index one-to-one.
3. The method as claimed in claim 1, wherein the number of segment records in the hole file index recording area is preset according to the recording scene, and the number of GOP records is obtained according to the size of the media recording area in the hole file, the minimum bit rate of video acquisition, the frame rate and the GOP length.
4. A video capture data management method based on the storage method of the local recording of the video capture device of any one of claims 1 to 3, comprising:
s11, reading a total warehouse index, mapping a memory management structure of a cavity file, acquiring a serial number of the recorded cavity file according to the memory management structure, reading index recording area information of the cavity file corresponding to the serial number of the recorded cavity file, and confirming index information of a current GOP record to be written, wherein the index information of the current GOP record to be written comprises offset and length;
s12, judging whether the space capacity of the cavity file media recording area is sufficient, if so, executing S13, otherwise, switching to the next cavity file and restarting to execute the step S11;
s13, cross-comparing the length of the frame to be written with the sum of the offset of the current GOP record to be written with the recorded bad track record, if the cross exists and indicates that the frame to be written may coincide with the known bad track, adjusting the offset in the GOP record to be written to be the address for skipping the bad track record, simultaneously integrally migrating the written frame data in the GOP record to be written, merging the length of the frame data written in the GOP record and the length of the frame to be written into the length of the GOP record to be written, then jumping to S12, if the cross does not exist and indicates that the frame to be written does not coincide with the known bad track, jumping to S14, wherein when the GOP record to be written is written, the frame is written in by taking the frame as a unit;
s14, positioning the offset in the index information of the GOP record to be written into a media recording area to sequentially write an initial address, packaging according to a recording requirement, and writing the packaged data into the media recording area;
and S15, updating the index recording area information of the hollow file.
5. The video capture data management method of claim 4, wherein reading the index recording area information of the hole file corresponding to the recording hole file serial number in step S11, and confirming the index information of the current GOP record to be written, comprises:
acquiring the file number of the hole file of the total warehouse index according to the recorded hole file serial number, then determining an index recording area of the hole file according to the hole file serial number, and positioning the three-stage structure of the index recording area from top to bottom, wherein the method specifically comprises the following steps: loading the head of an index recording area, and finding the last effective fragment according to the number of the fragments in the head; then loading the segment information of the last effective segment in the segment recording area, and calculating the index GOP of the last GOP record according to the GOP index starting point and the GOP number in the segment information A (ii) a Then, the index GOP to be written into the GOP record is obtained according to the index of the last GOP record B ,GOP B =GOP A +1, offset to write GOP record = offset of the last GOP record + length of the last GOP record.
6. The video capture data management method of claim 4, wherein step S15 comprises: updating is carried out in a sequence from bottom to top, and specifically comprises the following steps: firstly, updating field information of a GOP recording area, when written GOP records are I frames, updating three fields of time stamp, offset and length of the GOP recording area, and otherwise, only updating the length field; then updating field information of the segment recording area, if the current GOP record to be written is the first frame of a certain segment, adding 1 new segment record, and updating all field information in the added new segment record, otherwise, only updating the GOP number of the segment in which the current GOP record to be written is located; and finally, updating field information of the header area, and updating the number of fragments and the timestamp of the dead point of the hole file if a new fragment record is added in the fragment record area.
7. A video capture data management method based on the storage method of the local recording of the video capture device of any one of claims 1 to 3, comprising:
s21, reading the total warehouse index, mapping a memory management structure of the cavity file, and acquiring the serial number of the recorded cavity file according to the memory management structure;
s22, positioning the current recording cavity file according to the serial number of the recording cavity file, starting traversing from the 2 nd file cavity file after the current recording cavity file until the current recording cavity file, inquiring all segments in each cavity file, and combining the segments which contain consistent media metadata and have the interval time less than 1 second.
8. A video capture data management method based on the storage method of the local recording of the video capture device of any one of claims 1 to 3, comprising:
s31, reading the total warehouse index, mapping the memory management structure of the void file, and positioning the corresponding void file according to the time to be read;
s32, positioning the corresponding fragment records of the hole file according to the time to be read, and positioning GOP records;
s33, reading the index information recorded by the GOP, completely reading the GOP data at one time, decapsulating the read GOP data frame by frame, and feeding back the decapsulated GOP data to a reading interface;
s34, if the end of one hole file is read, retrieving a memory management structure of the hole file, opening the next hole file with the recorded content to start reading, and entering S31 again; and if the latest GOP of the hole file being recorded is read, reading the end all the time, and ending the reading.
9. A storage device for local recording by a video capture device, comprising:
the system comprises a space pre-allocation module, a storage management module and a control module, wherein the space pre-allocation module is used for selecting continuous storage spaces on a local storage medium, pre-allocating a plurality of areas with fixed sizes in the selected continuous storage spaces, and creating a hole file according to the pre-allocated areas with fixed sizes;
the memory management structure creating module is used for initializing each cavity file and creating a memory management structure of the cavity file, wherein each cavity file is used as a node by the memory management structure of the cavity file, the nodes are mutually connected to form an annular linked list, and the current writing position and the number of the currently recorded cavity file are recorded;
the system comprises a total warehouse index creating module, a storing module and a storing module, wherein the total warehouse index creating module is used for mapping a memory management structure of a hole file into a file form to be written into a storage medium to form a total warehouse index, the total warehouse index is of a two-stage structure and comprises a head and a hole file list, the head is used for recording the total number of the hole files and recording the serial numbers of the hole files, the hole file list is used for storing index information of each hole file, and the index information of the hole files comprises file numbers, starting and stopping numbers, time stamp fragment numbers and starting fragment serial numbers; each hole file in the hole file list is divided into two areas, namely an index recording area and a media recording area, wherein the hole file index recording area is of a three-level structure and comprises a head, a segment record and a GOP record, the head of the hole file index recording area is used for recording the general information of the hole file, and comprises a file number, a start-stop time stamp, the number of the segments, the start of the sequence number of the segments and a bad track record, and the general information in the head of the hole file index recording area corresponds to the index information of each hole file in the hole list in the total warehouse index; the clip records of the hole file index recording region are used for recording information of each clip, the information of each clip comprises a sequence number, a start-stop time stamp, media metadata, a maximum code rate, a GOP index start point, a GOP number, a clip data length and a packaging type, the GOP records of the hole file index recording region are used for recording information of each GOP record, and the index information of each GOP record comprises an offset, a time stamp and a length.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method according to any of claims 1 to 3 when executing the program.
CN202210826895.9A 2022-07-13 2022-07-13 Storage method, device and management method for local recording of video acquisition equipment Pending CN115328391A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210826895.9A CN115328391A (en) 2022-07-13 2022-07-13 Storage method, device and management method for local recording of video acquisition equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210826895.9A CN115328391A (en) 2022-07-13 2022-07-13 Storage method, device and management method for local recording of video acquisition equipment

Publications (1)

Publication Number Publication Date
CN115328391A true CN115328391A (en) 2022-11-11

Family

ID=83917494

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210826895.9A Pending CN115328391A (en) 2022-07-13 2022-07-13 Storage method, device and management method for local recording of video acquisition equipment

Country Status (1)

Country Link
CN (1) CN115328391A (en)

Similar Documents

Publication Publication Date Title
US7155448B2 (en) Method and apparatus for recording data and recovering recorded data
US7984231B2 (en) Information recording medium access device, and data recording method
JP4481889B2 (en) Data recording apparatus and method, program, and recording medium
CN101351845B (en) Recording device, recording method, recording program, imaging device, imaging method, and imaging program
CN107870973A (en) A kind of document storage system accelerated multi-path monitoring and played back simultaneously
JP2002529884A (en) Signal processing on information files to obtain characteristic point information sequences
CN112558873A (en) Embedded audio and video data storage, retrieval and deletion method and device and memory
CN105721809B (en) Storage method and video recording system
JP4513780B2 (en) Information processing apparatus, information processing method, and computer program
US8230125B2 (en) Methods for reserving index memory space in AVI recording apparatus
US8868429B2 (en) Method and device for storing audio data
US8582951B2 (en) Information processing device, information processing method, and computer program
CN115328391A (en) Storage method, device and management method for local recording of video acquisition equipment
US8825723B2 (en) Methods and devices for managing and editing files in a file system
US8369684B2 (en) Data processing apparatus and data processing method
KR20190061549A (en) File system and method of storing files based on the file system
US8037508B2 (en) Video server and file management method
TWI555406B (en) Storage method and processing device and video recording system thereof
US7835614B2 (en) Data recording method, data recording apparatus, and data recording medium
EP1526543A1 (en) Method and apparatus for recording data and recovering recorded data
KR100847757B1 (en) Process and device for recording multimedia digital data, associated hard disk and recording medium
CN110636368B (en) Media playing method, system, device and storage medium
CN100472641C (en) Characteristic point information (CPI) for multilayer video
US20080187281A1 (en) Editing apparatus and editing method
CN113555040B (en) Write method of moov container in multimedia file and computer readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination