CN109062989B - Vehicle-mounted monitoring data storage method - Google Patents

Vehicle-mounted monitoring data storage method Download PDF

Info

Publication number
CN109062989B
CN109062989B CN201810716700.9A CN201810716700A CN109062989B CN 109062989 B CN109062989 B CN 109062989B CN 201810716700 A CN201810716700 A CN 201810716700A CN 109062989 B CN109062989 B CN 109062989B
Authority
CN
China
Prior art keywords
data
file
audio
vehicle
video
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.)
Active
Application number
CN201810716700.9A
Other languages
Chinese (zh)
Other versions
CN109062989A (en
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.)
Shenzhen Wisdom Gps Technology Co ltd
Original Assignee
Shenzhen Wisdom Gps Technology 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 Shenzhen Wisdom Gps Technology Co ltd filed Critical Shenzhen Wisdom Gps Technology Co ltd
Priority to CN201810716700.9A priority Critical patent/CN109062989B/en
Publication of CN109062989A publication Critical patent/CN109062989A/en
Application granted granted Critical
Publication of CN109062989B publication Critical patent/CN109062989B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Signal Processing For Digital Recording And Reproducing (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a vehicle-mounted monitoring data storage method which is characterized by comprising the following steps: step 1, pre-creating a data file and an index file with fixed sizes in a storage device; the index files comprise a normal index file I1 and an alternative index file I2; step 2, creating a time linked list according to the index file; step 3, starting audio and video storage; step 4, storing audio and video data; step 5, judging whether to stop; and 6, ending. The vehicle-mounted monitoring data storage method can provide data export in any time period, the vehicle state and the audio and video can be accurately synchronized, and the file access efficiency is high.

Description

Vehicle-mounted monitoring data storage method
Technical Field
The invention relates to the field of vehicle-mounted monitoring data, in particular to a vehicle-mounted monitoring data storage method.
Background
The vehicle-mounted monitoring data comprises audio data and video data in a camera on the vehicle and state data of the vehicle body, wherein the state data comprises: vehicle speed, heading, longitude, latitude, alarm status, vehicle diagnostic information, etc. With the evolution of vehicle-mounted devices such as traditional automobile data recorders, GPS video terminals, entertainment systems, and the like, in order to remotely monitor vehicles in motion in real time and provide more powerful materials for investigators in case of accidents, the demands of people on vehicle-mounted remote real-time video, remote video playback, multi-view monitoring, and long-time data storage are further increasing.
The traditional vehicle-mounted monitoring data information is that audio and video media data and vehicle state information are stored separately: and encapsulating the audio and video data of each channel camera into an avi or MP4 video file format, closing the video file after the video file is stored to a certain size, and creating another new file to continue the writing of the audio and video data. When the memory is full, the file which is written at the earliest is found and deleted, and the file is recreated and new data is written. Meanwhile, the vehicle state data is stored in another file, and the audio and video data and the vehicle state data are stored separately.
The conventional vehicle-mounted device has the following disadvantages in data storage:
1. when multiple cameras are used for storing simultaneously, audio and video data are discontinuous, and long-term operation affects the performance of a memory.
2. When the memory is full, the file is continuously and repeatedly deleted and created, which is easy to damage the file system, and the mechanical hard disk also generates hard disk fragments, thereby reducing the performance of the hard disk.
3. The audio and video data and the vehicle state information data are stored separately, and the audio and video data and the vehicle state data are difficult to be accurately synchronized, so that the recovery of an accident site is not facilitated.
4. The audio and video data are stored in an audio and video file format and can only be exported in the form of a whole file, and the export of data in any time period cannot be realized.
5. When multi-channel data are required to be displayed on multiple pictures at the same time, the data time synchronization of each channel is inaccurate, and the field condition cannot be accurately restored.
Disclosure of Invention
Aiming at the defects of the prior art, the invention aims to provide a storage mode which can export data in any time period, can accurately synchronize the vehicle state and the audio and video and has high file access efficiency.
In the storage method of the invention, the main adopted means are as follows:
1. pre-creating a data file and an index file with fixed sizes in a storage device;
2. if the data of k paths of cameras needs to be stored, after data acquisition is started, circularly detecting whether the data in the k paths of cameras are ready, if the data are ready, packaging audio data, video data and vehicle state data in the time period into a data packet by taking a group of pictures (GOP) as a unit group of pictures (GOP), and then writing the data packet into a file. The data of the k paths of cameras are written into the same file, the data are sequentially written into the data file according to the sequence that the data are written first, and after each packet of data is written, the information of the generation time, the writing position and the like of the packet of data is recorded into the index file of the partition.
In order to solve the technical problems, the technical scheme of the invention is as follows:
a vehicle-mounted monitoring data storage method comprises the following steps:
step 1, pre-creating a data file and an index file with fixed sizes in a storage device;
the index files comprise a normal index file I1 and an alternative index file I2;
step 2, creating a time linked list according to the index file;
step 3, starting audio and video storage;
step 4, storing audio and video data;
step 5, judging whether to stop;
and 6, ending.
Wherein, the step 1 comprises the following operations:
(1) formatting the storage device, and dividing the storage device into S partitions according to the capacity of the storage device: p1,P2,P3……PS
(2) Creating two index files I1 and I2 with the same size in each partition, wherein I1 is a normally used index file, I2 is a standby index file, and when an I1 file is abnormal, an I2 index file is used;
(3) creating N data files of fixed size M in each partition: f1,F2,F3……FNAnd the data file is used for storing audio and video data and vehicle state information.
Wherein, the step 2 comprises the following operations: and reading index file information of each partition in the S partitions, and establishing a time linked list in a device memory by taking time as a unit for the S x N data files in the storage device.
Wherein, the step 3 comprises the following operations: and judging whether the encoder is ready, and starting audio and video data storage after the encoder is ready.
Wherein, the step 4 comprises the following operations:
1) a file F that can be used is found from the time-linked list, assuming that the found file is the F1 file partitioned at P1. When the storage device is not fully written, the searched file is an unused file, and when the storage device is fully written, the searched file is a file with the earliest writing end time in the memory;
2) if the storage of K paths of audio and video data is started, inquiring whether channel audio and video data in K paths of channels are ready, if the video data are ready, reading a frame of video data, and if the audio data are ready, reading the audio data;
3) reading a frame of video data, adding frame header information to the frame data, and storing the data into a third cache;
the frame header information comprises the data type and the data length of the frame data;
4) judging whether the number of the video frames stored in the third buffer memory reaches J × GOP number or not,
j is an integer larger than 0, and GOP is a unit picture group; if the result is reached, entering the next step; if not, returning to execute the step 2);
5) acquiring vehicle state information: the longitude value and the latitude value of the current position are read from the GPS module, the vehicle speed and other vehicle body diagnosis information are obtained from the CAN bus, and a user CAN select state information to be recorded according to actual requirements;
6) and adding a data header to the vehicle state information, wherein the data header comprises the length and the data type of the vehicle state information. Putting the vehicle state data added with the data header information into a second cache;
7) packaging the data in the second cache and the third cache into a data packet, and adding a packet header for the data, wherein the packet header data is stored in the first cache; then writing the data packet to an F1 file of a P1 partition found in a time chain table; the packet header data comprises a packet label, a state data length and an audio/video data length;
8) updating the data generation time and the offset position written into the F1 file in the last step 7) to the index table I1 of the P1 partition, and updating the time linked list in the memory.
Wherein, the step 5 comprises the following operations:
judging whether to stop data storage, if so, quitting the audio and video data storage; if not, judging whether the F1 file of the P1 partition is written to M, if so, returning to the step 1 of searching the file F from the time chain table, and if not, returning to the step 2) of reading the audio and video data.
Wherein, the step 6 comprises the following operations:
and exiting the audio and video data storage.
The invention has the beneficial effects that:
(1) for a hard disk storage device with large capacity, the magnetic head does not need to jump back and forth frequently, which is beneficial to prolonging the service life of the hard disk storage device.
(2) The audio and video data and the vehicle state data are simultaneously written into the file in real time, and a user can rapidly export and display the vehicle state information and the audio and video data at the same time point on the terminal equipment synchronously according to actual requirements. Meanwhile, the vehicle state can be used as an extended attribute of audio and video data, such as an alarm state, longitude, latitude and vehicle speed, and can be covered according to different attributes when being covered. For example, an alarm state or audio-video data in a certain area cannot be covered.
(3) By adopting the storage method, when exporting, the partition and the data file where the time period data is needed to be exported can be quickly positioned according to the index file, and then the data can be directly shifted to the position where the time period data is needed to be exported according to the position of each packet of data recorded in the index file in the file to export the data. The method does not need to traverse the file, has high exporting speed and occupies less system resources.
However, the conventional audio/video file is stored in an MP4 or AVI file format, and if data in a certain time period in a file is to be derived, it needs to gradually calculate the data start position and end position of the time period to be derived according to the start time of the file, so that the time accuracy of the derived data is not high, and the file access efficiency is low because the file needs to be traversed.
Drawings
The following describes embodiments of the present invention in further detail with reference to the accompanying drawings.
Fig. 1 is a schematic overall flow chart of a vehicle-mounted monitoring data storage method.
Fig. 2 is a schematic diagram of an audio and video data storage process.
Fig. 3 is a schematic diagram of the distribution of the Ps partition files.
Fig. 4 is a schematic diagram of Fn-th file storage.
Fig. 5 is a schematic diagram of the storage of the first cache (packet header data Buf 1).
Fig. 6 is a schematic diagram of the storage of the second cache (state data Buf 2).
Fig. 7 is a schematic diagram of the storage of the buffer three (audio/video data Buf 3).
Fig. 8 is a schematic diagram of packet storage.
Detailed Description
In order to make the technical problems, technical solutions and technical effects solved by the present invention easy to understand, the following description further describes specific embodiments of the present invention with reference to the specific drawings.
As shown in fig. 1 to 8, a method for storing vehicle-mounted monitoring data includes the following steps:
a vehicle-mounted monitoring data storage method comprises the following steps:
step 1, pre-creating a data file and an index file with fixed sizes in a storage device;
(1) formatting the storage device, and dividing the storage device into S partitions according to the capacity of the storage device: p1,P2,P3……PS
(2) Creating two index files I1 and I2 with the same size in each partition, wherein I1 is a normally used index file, I2 is a standby index file, and when an I1 file is abnormal, an I2 index file is used;
(3) creating N data files of fixed size M in each partition: f1,F2,F3……FNAnd the data file is used for storing audio and video data and vehicle state information.
Step 2, creating a time linked list according to the index file;
and reading index file information of each partition in the S partitions, and establishing a time linked list in a device memory by taking time as a unit for the S x N data files in the storage device.
Step 3, starting audio and video storage;
and judging whether the encoder is ready, and starting audio and video data storage after the encoder is ready.
Step 4, storing audio and video data;
1) searching a file F from a time chain table;
a file F that can be used is found from the time-linked list, assuming that the found file is the F1 file partitioned at P1. When the storage device is not fully written, the searched file is an unused file, and when the storage device is fully written, the searched file is a file with the earliest writing end time in the memory;
2) reading audio data;
if the storage of K paths of audio and video data is started, inquiring whether channel audio and video data in K paths of channels are ready, if the video data are ready, reading a frame of video data, and if the audio data are ready, reading the audio data;
3) reading a frame of video data, adding frame header information to the frame data, and storing the data into a third cache;
the frame header information comprises the data type and the data length of the frame data;
4) judging whether the number of the video frames stored in the third cache reaches J × GOP number, wherein J is an integer larger than 0, and GOP is a unit picture group; if the result is reached, entering the next step; if not, returning to execute the step 2);
5) acquiring vehicle state information: the longitude value and the latitude value of the current position are read from the GPS module, the vehicle speed and other vehicle body diagnosis information are obtained from the CAN bus, and a user CAN select state information to be recorded according to actual requirements;
6) and adding a data header to the vehicle state information, wherein the data header comprises the length and the data type of the vehicle state information. Putting the vehicle state data added with the data header information into a second cache;
7) packaging the data in the second cache and the third cache into a data packet, and adding a packet header for the data, wherein the packet header data is stored in the first cache; then writing the data packet to an F1 file of a P1 partition found in a time chain table; the packet header data comprises a packet label, a state data length and an audio and video data length.
8) Updating the data generation time and the offset position written into the F1 file in the last step 7) to the index table I1 of the P1 partition, and updating the time linked list in the memory.
Suppose the data were generated at a time point of 08:32:56 on day 2018.04.03, with an offset of 0xFFF in the file; when exporting, according to the time point of 08:32:56 on 2018.04.03, the written data at the time point is the 0xFFF position of the F1 file of the P1 partition;
step 5, judging whether to stop;
judging whether the F1 files of the P1 partition are written to M, wherein M is a fixed value of the file size, if so, returning to the step 1), and if not, returning to the step 2); if yes, exiting the audio and video data storage, and if not, entering the next step;
step 6, ending;
and exiting the audio and video data storage.
Referring to fig. 5-8, wherein 1 packet is provided with 3 buffers: the method comprises a first cache, a second cache and a third cache.
Cache one, for storing the packet header data Buf1,
a second cache for storing state data Buf2,
and a third buffer for storing the audio and video data Buf 3.
The vehicle-mounted monitoring data storage method has the main advantages that:
(1) for a mechanical hard disk storage device, because no file is created or deleted, the generation of disk fragments can be avoided, and the performance of the hard disk does not decline with the increase of time.
(2) For other types of storage devices, because there is no file creation and deletion operation, the size of the file is not changed, the name of the file is not changed, and the location of the file in the storage is not changed, the file system can be more stable and reliable.
(3) For a hard disk storage device with large capacity, the magnetic head does not need to jump back and forth frequently, which is beneficial to prolonging the service life of the hard disk storage device.
(4) The audio and video data and the vehicle state data are simultaneously written into the file in real time, and a user can synchronously export and display the state of the vehicle and the audio and video on the terminal equipment according to actual requirements, so that the visualization degree is high.
(5) When multi-channel data are required to be displayed on multiple screens at the same time, because the multi-channel data are written into the same file in sequence at the same time, the time of each channel data is completely synchronous, and the scene conditions of each angle of a vehicle can be truly and accurately restored.
(6) The method does not need to traverse the file during exporting, the exporting speed is high, and the occupied system resources are less.
However, if a conventional audio/video file stores data in a certain time period in a file in an MP4 or AVI file format, it needs to gradually calculate the start position and the end position of the data in the time period that needs to be exported according to the start time of the file, so that the time accuracy of the exported data is not high, and the file access efficiency is low because the file needs to be traversed.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention. Therefore, the protection scope of the present invention should be subject to the protection scope of the claims.

Claims (6)

1. A vehicle-mounted monitoring data storage method is characterized by comprising the following steps:
step 1, pre-creating a data file and an index file with fixed sizes in a storage device;
the index files comprise a normal index file I1 and an alternative index file I2;
step 2, creating a time linked list according to the index file;
step 3, starting audio and video storage;
step 4, storing audio and video data;
the step 4 comprises the following operations:
1) searching a usable file F from the time chain table, and assuming that the searched file is an F1 file in a P1 partition, when the storage device is not full, the searched file is an unused file, and when the storage device is full, the searched file is a file with the earliest write end time in the memory;
2) if the storage of K paths of audio and video data is started, inquiring whether channel audio and video data in K paths of channels are ready, if the video data are ready, reading a frame of video data, and if the audio data are ready, reading the audio data;
3) reading a frame of video data, adding frame header information to the frame data, and storing the data into a third cache;
the frame header information comprises the data type and the data length of the frame data;
4) judging whether the number of the video frames stored in the third buffer memory reaches J × GOP number or not,
j is an integer larger than 0, and GOP is a unit picture group; if the result is reached, entering the next step; if not, returning to execute the step 2);
5) acquiring vehicle state information: the longitude value and the latitude value of the current position are read from the GPS module, the vehicle speed and other vehicle body diagnosis information are obtained from the CAN bus, and a user CAN select state information to be recorded according to actual requirements;
6) adding a data head to the vehicle state information, wherein the data head comprises the length and the data type of the vehicle state information; putting the vehicle state data added with the data header information into a second cache;
7) packaging the data in the second cache and the third cache into a data packet, and adding a packet header for the data, wherein the packet header data is stored in the first cache; then writing the data packet to an F1 file of a P1 partition found in a time chain table; the packet header data comprises a packet label, a state data length and an audio/video data length;
8) updating the data generation time and the offset position written into the F1 file in the last step 7) to an index table I1 of the P1 partition, and updating a time linked list in a memory;
step 5, judging whether to stop;
and 6, ending.
2. The on-vehicle monitoring data storage method according to claim 1, characterized in that the step 1 comprises the following operations:
(1) formatting the storage device, and dividing the storage device into S partitions according to the capacity of the storage device: p1, P2, P3 … … P S;
(2) creating two index files I1 and I2 with the same size in each partition, wherein I1 is a normally used index file, I2 is a standby index file, and when an I1 file is abnormal, an I2 index file is used;
(3) creating N data files of fixed size M in each partition: f1, F2, F3 … … F N, the data file is used for storing audio and video data and vehicle state information.
3. The on-vehicle monitoring data storage method according to claim 1, characterized in that the step 2 comprises the following operations: and reading index file information of each partition in the S partitions, and establishing a time linked list in a device memory by taking time as a unit for the S x N data files in the storage device.
4. The on-vehicle monitoring data storage method according to claim 1, characterized in that in the step 3, the following operations are included: and judging whether the encoder is ready, and starting audio and video data storage after the encoder is ready.
5. The on-vehicle monitoring data storage method according to claim 1, characterized in that, in the step 5, the following operations are included:
judging whether to stop data storage, if so, quitting the audio and video data storage; if not, judging whether the F1 file of the P1 partition is written to M, if so, returning to the operation 1 of the step 4 of searching the file F from the time chain table, and if not, returning to the operation 2 of the step 4 of reading the audio and video data.
6. The on-vehicle monitoring data storage method according to claim 1, characterized in that, in the step 6, the following operations are included:
and exiting the audio and video data storage.
CN201810716700.9A 2018-07-03 2018-07-03 Vehicle-mounted monitoring data storage method Active CN109062989B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810716700.9A CN109062989B (en) 2018-07-03 2018-07-03 Vehicle-mounted monitoring data storage method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810716700.9A CN109062989B (en) 2018-07-03 2018-07-03 Vehicle-mounted monitoring data storage method

Publications (2)

Publication Number Publication Date
CN109062989A CN109062989A (en) 2018-12-21
CN109062989B true CN109062989B (en) 2022-05-17

Family

ID=64819044

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810716700.9A Active CN109062989B (en) 2018-07-03 2018-07-03 Vehicle-mounted monitoring data storage method

Country Status (1)

Country Link
CN (1) CN109062989B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625425B (en) * 2020-12-09 2023-09-29 博泰车联网科技(上海)股份有限公司 Audio playing method, system and equipment based on hard isolation

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750164A (en) * 2005-07-20 2006-03-22 杭州海康威视数字技术有限公司 Digital hard disc recorder file managing method for preventing file fragment production
CN1822174A (en) * 2005-12-08 2006-08-23 杭州海康威视数字技术有限公司 Method for protecting hardware key information area in embedded device
CN102750213A (en) * 2012-06-18 2012-10-24 深圳市锐明视讯技术有限公司 Disc detecting and processing method and detecting and processing system
CN103123645A (en) * 2012-11-28 2013-05-29 无锡港湾网络科技有限公司 Method for reducing disk fragments
CN103474087A (en) * 2013-09-06 2013-12-25 南京南自信息技术有限公司 Video recording file management method and device for easily preventing disk fragments from being generated
CN104966528A (en) * 2015-06-25 2015-10-07 广东工业大学 Multi-path audio/video stream storage method for preventing disk fragments from formation
CN105975401A (en) * 2016-04-29 2016-09-28 郑州天迈科技股份有限公司 Sequential writing and quick recovery system and method of vehicle-mounted disk
CN106682232A (en) * 2017-01-13 2017-05-17 西安电子科技大学 Statistical statement generating method of vehicle monitoring system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1750164A (en) * 2005-07-20 2006-03-22 杭州海康威视数字技术有限公司 Digital hard disc recorder file managing method for preventing file fragment production
CN1822174A (en) * 2005-12-08 2006-08-23 杭州海康威视数字技术有限公司 Method for protecting hardware key information area in embedded device
CN102750213A (en) * 2012-06-18 2012-10-24 深圳市锐明视讯技术有限公司 Disc detecting and processing method and detecting and processing system
CN103123645A (en) * 2012-11-28 2013-05-29 无锡港湾网络科技有限公司 Method for reducing disk fragments
CN103474087A (en) * 2013-09-06 2013-12-25 南京南自信息技术有限公司 Video recording file management method and device for easily preventing disk fragments from being generated
CN104966528A (en) * 2015-06-25 2015-10-07 广东工业大学 Multi-path audio/video stream storage method for preventing disk fragments from formation
CN105975401A (en) * 2016-04-29 2016-09-28 郑州天迈科技股份有限公司 Sequential writing and quick recovery system and method of vehicle-mounted disk
CN106682232A (en) * 2017-01-13 2017-05-17 西安电子科技大学 Statistical statement generating method of vehicle monitoring system

Also Published As

Publication number Publication date
CN109062989A (en) 2018-12-21

Similar Documents

Publication Publication Date Title
JP5580734B2 (en) Method and apparatus for acquiring, recording and processing data captured in an aircraft
JP2010528925A5 (en)
JP2008262686A (en) Method and device for recording broadcast data
CN104581406A (en) Network video recording and playback system and method
CN101132508A (en) Method and apparatus for recording and reproducing, method and device for acquiring and recording image
CN105872484A (en) Protection method of monitoring video abnormity
CN110456749B (en) Nuclear power plant DCS platform based engineer station software historical data processing method
CN104104904A (en) Data recording method, data recording system, mobile phone, glasses and watch
CN109062989B (en) Vehicle-mounted monitoring data storage method
CN105100716A (en) Safe memory cell used for network video monitoring and system thereof
CN101895736B (en) Media stream data processing method and device thereof
CN105975401A (en) Sequential writing and quick recovery system and method of vehicle-mounted disk
CN104104895A (en) Method for carrying out video playback on video data and hard-disk video recorder
CN103974013A (en) Method for playing back video recording and video recording device
CN103501469A (en) Method for adding geographic position information to tail part of video file
CN102231827A (en) Indexing method capable of supporting direct and accurate positioning of frame of program stream (PS) media file
CN110555890A (en) Memory management method and system
CN104376093A (en) Searching method and device for video files
CN114741552A (en) Video file storage method and medium with custom format
US20170329795A1 (en) Electronic device and database constructing method
CN101373546A (en) Device for recording and storing accidents for automobile
CN102801946A (en) High-reliability vehicle-mounted video storage device and video storage method
CN114143486A (en) Video stream synchronization method and device, computer equipment and storage medium
CN107393052A (en) A kind of recorder date storage method and its storage device
EP2200039A1 (en) Method for recording AV data, AV data recording apparatus, data recording medium, program, and program recording 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
GR01 Patent grant
GR01 Patent grant