CN112347043A - File management method, device, equipment and storage medium based on vehicle-mounted SD card - Google Patents

File management method, device, equipment and storage medium based on vehicle-mounted SD card Download PDF

Info

Publication number
CN112347043A
CN112347043A CN202011243809.9A CN202011243809A CN112347043A CN 112347043 A CN112347043 A CN 112347043A CN 202011243809 A CN202011243809 A CN 202011243809A CN 112347043 A CN112347043 A CN 112347043A
Authority
CN
China
Prior art keywords
file
card
vehicle
file management
target
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
CN202011243809.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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202011243809.9A priority Critical patent/CN112347043A/en
Publication of CN112347043A publication Critical patent/CN112347043A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1737Details of further file system functions for reducing power consumption or coping with limited storage space, e.g. in mobile devices
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system
    • G06F16/1744Redundancy elimination performed by the file system using compression, e.g. sparse 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Multimedia (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Television Signal Processing For Recording (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)

Abstract

The invention relates to the technical field of big data, and discloses a file management method, a device, equipment and a storage medium based on a vehicle-mounted SD card, which are applied to the field of intelligent transportation and used for prolonging the service life of the vehicle-mounted SD card. The method comprises the following steps: when the terminal is started, creating a plurality of file storage directories in the vehicle-mounted SD card; when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files; creating a target file management linked list according to the plurality of target video files, wherein the target file management linked list is used for storing the plurality of target video files; the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space; and when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.

Description

File management method, device, equipment and storage medium based on vehicle-mounted SD card
Technical Field
The invention relates to the field of object storage, in particular to a file management method, a device, equipment and a storage medium based on a vehicle-mounted SD card.
Background
With the development of the car networking and the auxiliary driving technology, more and more car-mounted video acquisition devices are provided. The vehicle-mounted video recording equipment collects images in the driving process of the vehicle in real time and encodes the images into video files for storage, so that a large number of video files need to be stored.
For memory cards with limited storage capacity, it is necessary to delete part of the video when the memory card is full, leaving enough space for new video files. In addition, since the number of times of erasing and writing of the memory card is limited, it is impossible to perform high-frequency erasing and writing operations on the same block space. Therefore, for the terminal device class, the writing and overlay scheme for storing the video is a very critical part, and directly influences the service life of the device.
At present, the existing vehicle-mounted SD card is checked, the video file is mostly stored in a 1-section video file in 1 minute, and all files are stored in a root directory of the SD card. Taking H264 encoding as an example, a video file of 720P in 1 minute is about 10M, and a 32G memory card can store 3200 segments of video files at maximum. Therefore, 3200 segments of video files need to be maintained, the data volume is large, the maintenance efficiency is low, and the service life of the memory card is reduced.
Disclosure of Invention
The invention provides a vehicle-mounted SD card-based file management method, device, equipment and storage medium, which are used for reducing the occupied space of a video file in a vehicle-mounted SD card, improving the management efficiency of the video file and prolonging the service life of the vehicle-mounted SD card.
A first aspect of an embodiment of the present invention provides a file management method based on a vehicle-mounted SD card, including: when the terminal is started, creating a plurality of file storage directories in the vehicle-mounted SD card, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period; when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files; creating a target file management linked list according to the target video files, wherein the target file management linked list is used for storing the target video files; the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space; and when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
Optionally, in a first implementation manner of the first aspect of the embodiment of the present invention, the creating a target file management linked list according to the plurality of target video files, where the target file management linked list is used to store the plurality of target video files includes: creating an initial file management linked list, wherein the initial file management linked list is used for storing the plurality of target video files; and associating the target video files to the created initial file management linked list according to the video creation time sequence to obtain a target file management linked list.
Optionally, in a second implementation manner of the first aspect of the embodiment of the present invention, the associating the multiple target video files with the created initial file management linked list according to a video creation time sequence to obtain a target file management linked list includes: traversing a plurality of file storage directories on the vehicle-mounted SD card, wherein each file storage directory is arranged on 1 storage node of the vehicle-mounted SD card, and each storage node comprises a directory name, storage space occupied by all files under the directory and an address of the next storage node; determining the creation time of each file under the corresponding target according to the directory name to obtain the creation time of each target video file; sequencing the plurality of target video files according to the creation time of each target video file and the sequence of time to obtain a video creation time sequence; and sequentially associating the plurality of target video files to the initial file management linked list according to the video creation time sequence to generate the target file management linked list.
Optionally, in a third implementation manner of the first aspect of the embodiment of the present invention, after the sequentially associating the plurality of target video files to the initial file management linked list according to the video creation time sequence and generating the target file management linked list, the file management method based on the vehicle-mounted SD card further includes: renaming the target video files in the target file management linked list according to a preset naming rule, wherein the name of each target video file comprises a file type, a file creation time, a random number and a serial number.
Optionally, in a fourth implementation manner of the first aspect of the embodiment of the present invention, when the terminal is enabled, creating a plurality of file storage directories in the vehicle-mounted SD card, where the file storage directories are used to store videos recorded by the terminal during the enabling period, and the creating includes: when the terminal is started, activating a vehicle-mounted SD card installed on the terminal; determining the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier; and creating a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period.
Optionally, in a fifth implementation manner of the first aspect of the embodiment of the present invention, when it is detected that the remaining space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video file in the first-located file storage directory in the target file management linked list until the remaining space in the vehicle-mounted SD card is greater than or equal to the preset storage space, the method includes: checking the residual space in the vehicle-mounted SD card according to a preset time interval; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, inquiring a plurality of file storage directories of a target file management linked list; sequentially deleting the target video files in the first file storage directory in the target file management linked list according to the file sequence, and detecting the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, stopping deleting the target video file in the first file storage directory in the target file management linked list.
Optionally, in a sixth implementation manner of the first aspect of the embodiment of the present invention, when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files includes: when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of compressed video files; and encrypting the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
A second aspect of the embodiments of the present invention provides a file management device based on a vehicle-mounted SD card, including: the terminal comprises a catalog creation module, a storage module and a storage module, wherein the catalog creation module is used for creating a plurality of file storage catalogs in the vehicle-mounted SD card when the terminal is started, and the file storage catalogs are used for storing videos recorded by the terminal during the starting period; the file compression module is used for compressing the video files in the file storage directories to obtain a plurality of target video files when the file storage directories are full; a linked list creating module, configured to create a target file management linked list according to the multiple target video files, where the target file management linked list is used to store the multiple target video files; the space dividing module is used for dividing the storage space of the vehicle-mounted SD card again to obtain a preset storage space; and the file deleting module is used for sequentially deleting the target video files in the first file storage directory in the target file management linked list when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
Optionally, in a first implementation manner of the second aspect of the embodiment of the present invention, the linked list creating module includes: a creating unit, configured to create an initial file management linked list, where the initial file management linked list is used to store the multiple target video files; and the association unit is used for associating the plurality of target video files to the created initial file management linked list according to the video creation time sequence to obtain a target file management linked list.
Optionally, in a second implementation manner of the second aspect of the embodiment of the present invention, the associating unit includes: the system comprises a traversing subunit, a storage unit and a control unit, wherein the traversing subunit is used for traversing a plurality of file storage directories on the vehicle-mounted SD card, each file storage directory is arranged on 1 storage node of the vehicle-mounted SD card, and each storage node comprises a directory name, storage space occupied by all files under the directory and an address of the next storage node; the determining subunit is used for determining the creation time of each file under the corresponding target according to the directory name to obtain the creation time of each target video file; the sequencing subunit is used for sequencing the plurality of target video files according to the creation time of each target video file and the sequence of time to obtain a video creation time sequence; and the association subunit is used for sequentially associating the plurality of target video files into the initial file management linked list according to the video creation time sequence to generate the target file management linked list.
Optionally, in a third implementation manner of the second aspect of the embodiment of the present invention, the associating unit further includes: and the renaming subunit is used for renaming the target video files in the target file management linked list according to a preset naming rule, wherein the name of each target video file comprises a file type, a file creation time, a random number and a serial number.
Optionally, in a fourth implementation manner of the second aspect of the embodiment of the present invention, the catalog creation module is specifically configured to: when the terminal is started, activating a vehicle-mounted SD card installed on the terminal; determining the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier; and creating a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period.
Optionally, in a fifth implementation manner of the second aspect of the embodiment of the present invention, the file deleting module is specifically configured to: checking the residual space in the vehicle-mounted SD card according to a preset time interval; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, inquiring a plurality of file storage directories of a target file management linked list; sequentially deleting the target video files in the first file storage directory in the target file management linked list according to the file sequence, and detecting the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, stopping deleting the target video file in the first file storage directory in the target file management linked list.
Optionally, in a sixth implementation manner of the second aspect of the embodiment of the present invention, the file compression module is specifically configured to: when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of compressed video files; and encrypting the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
A third aspect of the embodiments of the present invention provides a file management device based on a vehicle-mounted SD card, a memory and at least one processor, where the memory stores instructions, and the memory and the at least one processor are interconnected through a line; the at least one processor calls the instructions in the memory to enable the vehicle-mounted SD card based file management device to execute the vehicle-mounted SD card based file management method.
A fourth aspect of the embodiments of the present invention provides a computer-readable storage medium, where instructions are stored, and when the instructions are executed by a processor, the steps of the vehicle-mounted SD card based file management method according to any one of the above embodiments are implemented.
According to the technical scheme provided by the embodiment of the invention, when the terminal is started, a plurality of file storage directories are created in the vehicle-mounted SD card, and the file storage directories are used for storing videos recorded by the terminal during the starting period; when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files; creating a target file management linked list according to the plurality of target video files, wherein the target file management linked list is used for storing the plurality of target video files; the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space; and when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space. According to the embodiment of the invention, the occupied space of the video file in the vehicle-mounted SD card is reduced, the management efficiency of the video file is improved, and the service life of the vehicle-mounted SD card is prolonged.
Drawings
FIG. 1 is a schematic diagram of an embodiment of a vehicle-mounted SD card-based file management method according to the embodiment of the invention;
FIG. 2 is a schematic diagram of another embodiment of a vehicle-mounted SD card-based file management method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of an embodiment of a vehicle-mounted SD card based file management device in an embodiment of the invention;
FIG. 4 is a schematic diagram of another embodiment of the file management device based on the vehicle-mounted SD card in the embodiment of the invention;
fig. 5 is a schematic diagram of an embodiment of the file management device based on the vehicle-mounted SD card in the embodiment of the present invention.
Detailed Description
The invention provides a vehicle-mounted SD card-based file management method, device, equipment and storage medium, which are used for reducing the occupied space of a video file in a vehicle-mounted SD card, improving the management efficiency of the video file and prolonging the service life of the vehicle-mounted SD card.
In order to make the technical field of the invention better understand the scheme of the invention, the embodiment of the invention will be described in conjunction with the attached drawings in the embodiment of the invention.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims, as well as in the drawings, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," or "having," and any variations thereof, are intended to cover non-exclusive inclusions, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, a flowchart of a file management method based on a vehicle-mounted SD card according to an embodiment of the present invention specifically includes:
101. when the terminal is enabled, a plurality of file storage directories are created in the vehicle-mounted SD card, and the file storage directories are used for storing videos recorded by the terminal during the enabling.
When the terminal is enabled, the terminal creates a plurality of file storage directories in the vehicle-mounted SD card, and the file storage directories are used for storing videos recorded by the terminal during the enabling period.
Specifically, when the terminal is started, the terminal activates a vehicle-mounted SD card installed on the terminal; the terminal determines the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier; the terminal creates a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, and the file storage directories are used for storing videos recorded by the terminal during the starting period.
For example, the preset file naming mode is as follows: video + year, month, day + random number, wherein the random number is a 4-digit random number. In this embodiment, 1 video file is set to be saved for 1 minute, a maximum of 100 video files are saved in each file storage directory, and the file directory is created again after 100 video files are saved.
It is understood that the executing subject of the present invention may be a file management device based on an in-vehicle SD card, and may also be a terminal (i.e. a car recorder), which is not limited herein. The embodiment of the present invention is described by taking a terminal as an execution subject.
102. And when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files.
And when the file storage directories are full, the terminal compresses the video files in the file storage directories to obtain a plurality of target video files.
Specifically, when a plurality of file storage directories are full, the terminal compresses the video files in the plurality of file storage directories to obtain a plurality of compressed video files; and the terminal encrypts the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
The video file is compressed, the disk space occupied by the file can be reduced, so that more running video files can be stored, meanwhile, the video files contain the privacy of a user, encryption processing is needed, and the risk of privacy disclosure is reduced.
103. And creating a target file management linked list according to the plurality of target video files, wherein the target file management linked list is used for storing the plurality of target video files.
Specifically, the terminal creates an initial file management linked list, and the initial file management linked list is used for storing a plurality of target video files; and associating a plurality of target video files to the created initial file management linked list according to the video creation time sequence to obtain the target file management linked list.
It should be noted that, after compressing the video file, when creating the directory file management linked list, the space occupied by the file is changed from 100 traversals to 1 time, and also from 100 deletions to 1 time when deleting, which greatly reduces the time consumption of file deletion and reduces the file management time.
In the target file management linked list, the video file created firstly is stored in front of the target file management linked list, and the directory is used as the minimum granularity for management, so that the longer the continuous driving time of the vehicle is, the shorter the number of the management files is, the less the number of the video file management is, the less the number of the linked list nodes is, the more files can be managed by using fewer linked lists, and the expense in the aspect of linked list management memory is reduced.
104. And the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space.
And the terminal divides the storage space of the vehicle-mounted SD card again to obtain a preset storage space.
For example, the terminal checks the remaining space in the vehicle-mounted SD card at preset time intervals; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, the terminal queries a plurality of video files of the target file management linked list; the terminal deletes the video files in the first file storage directory in the target file management linked list in sequence according to the file sequence, and detects the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, the terminal stops deleting the video file in the first file storage directory in the target file management linked list.
For example, a storage space of 1G is set as a preset storage space, and a maximum of 31G data is stored in an SD card of 32G as an example.
105. And when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
Specifically, the terminal checks the residual space in the vehicle-mounted SD card according to a preset time interval; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, the terminal queries a plurality of file storage directories of the target file management linked list; the terminal deletes the target video files in the first file storage directory in the target file management linked list in sequence according to the file sequence, and detects the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, the terminal stops deleting the target video file in the first file storage directory in the target file management linked list.
The principle of file overwriting is to delete the original file and make room for writing new file. The overall storage space of the SD card is checked at the moment when the terminal is started and the system clock is an integer. Taking the 32G SD card as an example, when the file occupation of the disk is detected to exceed 31G, deleting the directory of the target file management linked list at the head, moving the head of the linked list backwards, and circulating the operation until the residual space of the disk is more than 1G.
It can be understood that through the management of large granularity (taking the file directory as the minimum management unit), the number of linked list files can be reduced, and the management load is reduced. For example, according to the conventional scheme that 31G is the maximum storage, 3100 files need to be managed, and 3100/2 × 3100(480500) comparison operations are needed on the worst average; on the other hand, with the file directory as the minimum management unit, the calculation is carried out for 30 minutes per vehicle row on average, 103 directory files need to be managed, and the calculation amount needs to be reduced by 900 times at worst by 5304 times.
According to the embodiment of the invention, the linked list with large granularity is used for recording and retrieving the video files, the video files are sequenced, the video files can be arranged in sequence, the earliest file is convenient to search and cover, the newer video is reserved, the memory space of the memory card is recycled, the use balance of each section of the memory card is ensured, the occupied space of the video files in the vehicle-mounted SD card is reduced, the management efficiency of the video files is improved, and the service life of the vehicle-mounted SD card is prolonged. And this scheme can be applied to in the wisdom traffic field to promote the construction in wisdom city.
Referring to fig. 2, another flowchart of the file management method based on the vehicle-mounted SD card according to the embodiment of the present invention specifically includes:
201. when the terminal is enabled, a plurality of file storage directories are created in the vehicle-mounted SD card, and the file storage directories are used for storing videos recorded by the terminal during the enabling.
When the terminal is enabled, the terminal creates a plurality of file storage directories in the vehicle-mounted SD card, and the file storage directories are used for storing videos recorded by the terminal during the enabling period.
Specifically, when the terminal is started, the terminal activates a vehicle-mounted SD card installed on the terminal; the terminal determines the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier; the terminal creates a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, and the file storage directories are used for storing videos recorded by the terminal during the starting period.
For example, the preset file naming mode is as follows: video + year, month, day + random number, wherein the random number is a 4-digit random number. In this embodiment, 1 video file is set to be saved for 1 minute, a maximum of 100 video files are saved in each file storage directory, and the file directory is created again after 100 video files are saved.
It is understood that the executing subject of the present invention may be a file management device based on an in-vehicle SD card, and may also be a terminal (i.e. a car recorder), which is not limited herein. The embodiment of the present invention is described by taking a terminal as an execution subject.
202. And when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files.
And when the file storage directories are full, the terminal compresses the video files in the file storage directories to obtain a plurality of target video files.
Specifically, when a plurality of file storage directories are full, the terminal compresses the video files in the plurality of file storage directories to obtain a plurality of compressed video files; and the terminal encrypts the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
The video file is compressed, the disk space occupied by the file can be reduced, so that more running video files can be stored, meanwhile, the video files contain the privacy of a user, encryption processing is needed, and the risk of privacy disclosure is reduced.
203. And creating an initial file management linked list, wherein the initial file management linked list is used for storing a plurality of target video files.
The terminal creates an initial file management linked list, and the initial file management linked list is used for storing a plurality of target video files.
In the target file management linked list, the video file created firstly is stored in front of the target file management linked list, and the directory is used as the minimum granularity for management, so that the longer the continuous driving time of the vehicle is, the shorter the number of the management files is, the less the number of the video file management is, the less the number of the linked list nodes is, the more files can be managed by using fewer linked lists, and the expense in the aspect of linked list management memory is reduced.
204. And associating a plurality of target video files to the created initial file management linked list according to the video creation time sequence to obtain the target file management linked list.
Specifically, the terminal traverses a plurality of file storage directories on the vehicle-mounted SD card, wherein each file storage directory is arranged on 1 storage node of the vehicle-mounted SD card, and each storage node comprises a directory name, a storage space occupied by all files under the directory and an address of the next storage node; the terminal determines the creation time of each file under the corresponding target according to the directory name to obtain the creation time of each target video file; the terminal sorts the target video files according to the creation time of each target video file and the sequence of the creation time to obtain a video creation time sequence; the terminal sequentially associates a plurality of target video files into an initial file management linked list according to a video creation time sequence to generate a target file management linked list; renaming the target video files in the target file management linked list according to a preset naming rule, wherein the name of each target video file comprises a file type, a file creation time, a random number and a serial number.
The video file naming rule is as follows: video + year, month, day + random number + index, where the random number is a 4-bit random number and the indices are sequence numbers starting from 0, arranged in descending order, and expressed as 4-bit numbers, such as 0000, 0001, 0002.
It should be noted that, after compressing the video file, when creating the directory file management linked list, the space occupied by the file is changed from 100 traversals to 1 time, and also from 100 deletions to 1 time when deleting, which greatly reduces the time consumption of file deletion and reduces the file management time.
205. And the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space.
And the terminal divides the storage space of the vehicle-mounted SD card again to obtain a preset storage space.
For example, the terminal checks the remaining space in the vehicle-mounted SD card at preset time intervals; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, the terminal queries a plurality of video files of the target file management linked list; the terminal deletes the video files in the first file storage directory in the target file management linked list in sequence according to the file sequence, and detects the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, the terminal stops deleting the video file in the first file storage directory in the target file management linked list.
For example, a storage space of 1G is set as a preset storage space, and a maximum of 31G data is stored in an SD card of 32G as an example.
206. And when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
Specifically, the terminal checks the residual space in the vehicle-mounted SD card according to a preset time interval; when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, the terminal queries a plurality of file storage directories of the target file management linked list; the terminal deletes the target video files in the first file storage directory in the target file management linked list in sequence according to the file sequence, and detects the size of the residual space in the vehicle-mounted SD card; and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, the terminal stops deleting the target video file in the first file storage directory in the target file management linked list.
The principle of file overwriting is to delete the original file and make room for writing new file. The overall storage space of the SD card is checked at the moment when the terminal is started and the system clock is an integer. Taking the 32G SD card as an example, when the file occupation of the disk is detected to exceed 31G, deleting the directory of the target file management linked list at the head, moving the head of the linked list backwards, and circulating the operation until the residual space of the disk is more than 1G.
It can be understood that through the management of large granularity (taking the file directory as the minimum management unit), the number of linked list files can be reduced, and the management load is reduced. For example, according to the conventional scheme that 31G is the maximum storage, 3100 files need to be managed, and 3100/2 × 3100(480500) comparison operations are needed on the worst average; on the other hand, with the file directory as the minimum management unit, the calculation is carried out for 30 minutes per vehicle row on average, 103 directory files need to be managed, and the calculation amount needs to be reduced by 900 times at worst by 5304 times.
According to the embodiment of the invention, the linked list with large granularity is used for recording and retrieving the video files, the video files are sequenced, the video files can be arranged in sequence, the earliest file is convenient to search and cover, the newer video is reserved, the memory space of the memory card is recycled, the use balance of each section of the memory card is ensured, the occupied space of the video files in the vehicle-mounted SD card is reduced, the management efficiency of the video files is improved, and the service life of the vehicle-mounted SD card is prolonged. And this scheme can be applied to in the wisdom traffic field to promote the construction in wisdom city.
In the above description of the file management method based on the vehicle-mounted SD card in the embodiment of the present invention, referring to fig. 3, a file management device based on the vehicle-mounted SD card in the embodiment of the present invention is described below, and an embodiment of the file management device based on the vehicle-mounted SD card in the embodiment of the present invention includes:
a directory creating module 301, configured to create, when the terminal is enabled, a plurality of file storage directories in the vehicle-mounted SD card, where the file storage directories are used to store videos recorded by the terminal during the enabling period;
a file compression module 302, configured to compress video files in the multiple file storage directories to obtain multiple target video files when the multiple file storage directories are full;
a linked list creating module 303, configured to create a target file management linked list according to the multiple target video files, where the target file management linked list is used to store the multiple target video files;
the space dividing module 304 is configured to divide the storage space of the vehicle-mounted SD card again to obtain a preset storage space;
a file deleting module 305, configured to delete the target video files in the first file storage directory in the target file management linked list in sequence when it is detected that the remaining space in the vehicle-mounted SD card is smaller than the preset storage space, until the remaining space in the vehicle-mounted SD card is greater than or equal to the preset storage space.
According to the embodiment of the invention, the linked list with large granularity is used for recording and retrieving the video files, the video files are sequenced, the video files can be arranged in sequence, the earliest file is convenient to search and cover, the newer video is reserved, the memory space of the memory card is recycled, the use balance of each section of the memory card is ensured, the occupied space of the video files in the vehicle-mounted SD card is reduced, the management efficiency of the video files is improved, and the service life of the vehicle-mounted SD card is prolonged. And this scheme can be applied to in the wisdom traffic field to promote the construction in wisdom city.
Referring to fig. 4, another embodiment of the file management device based on the vehicle-mounted SD card in the embodiment of the present invention includes:
a directory creating module 301, configured to create, when the terminal is enabled, a plurality of file storage directories in the vehicle-mounted SD card, where the file storage directories are used to store videos recorded by the terminal during the enabling period;
a file compression module 302, configured to compress video files in the multiple file storage directories to obtain multiple target video files when the multiple file storage directories are full;
a linked list creating module 303, configured to create a target file management linked list according to the multiple target video files, where the target file management linked list is used to store the multiple target video files;
the space dividing module 304 is configured to divide the storage space of the vehicle-mounted SD card again to obtain a preset storage space;
a file deleting module 305, configured to delete the target video files in the first file storage directory in the target file management linked list in sequence when it is detected that the remaining space in the vehicle-mounted SD card is smaller than the preset storage space, until the remaining space in the vehicle-mounted SD card is greater than or equal to the preset storage space.
Optionally, the linked list creating module 303 includes:
a creating unit 3031, configured to create an initial file management linked list, where the initial file management linked list is used to store the multiple target video files;
an associating unit 3032, configured to associate the multiple target video files with the created initial file management linked list according to a video creation time sequence, so as to obtain a target file management linked list.
Optionally, the associating unit 3032 includes:
a traversal subunit 30321, configured to traverse a plurality of file storage directories on the vehicle-mounted SD card, where each file storage directory is arranged on 1 storage node of the vehicle-mounted SD card, and each storage node includes a directory name, a storage space occupied by all files under the directory, and an address of a next storage node;
a determining subunit 30322, configured to determine, according to the directory name, creation time of each file under a corresponding target, to obtain the creation time of each target video file;
a sequencing subunit 30323, configured to sequence the multiple target video files according to the creation time of each target video file and according to the sequence of time, so as to obtain a video creation time sequence;
an association subunit 30324, configured to associate the multiple target video files sequentially into the initial file management linked list according to the video creation time sequence, and generate the target file management linked list.
Optionally, the associating unit 3032 further includes:
a renaming subunit 30325, configured to rename the target video files in the target file management linked list according to a preset naming rule, where a name of each target video file includes a file type, a file creation time, a random number, and a serial number.
Optionally, the catalog creation module 301 is specifically configured to:
when the terminal is started, activating a vehicle-mounted SD card installed on the terminal;
determining the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier;
and creating a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period.
Optionally, the file deleting module 305 is specifically configured to:
checking the residual space in the vehicle-mounted SD card according to a preset time interval;
when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, inquiring a plurality of file storage directories of a target file management linked list;
sequentially deleting the target video files in the first file storage directory in the target file management linked list according to the file sequence, and detecting the size of the residual space in the vehicle-mounted SD card;
and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, stopping deleting the target video file in the first file storage directory in the target file management linked list.
Optionally, the file compression module 302 is specifically configured to:
when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of compressed video files;
and encrypting the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
According to the embodiment of the invention, the linked list with large granularity is used for recording and retrieving the video files, the video files are sequenced, the video files can be arranged in sequence, the earliest file is convenient to search and cover, the newer video is reserved, the memory space of the memory card is recycled, the use balance of each section of the memory card is ensured, the occupied space of the video files in the vehicle-mounted SD card is reduced, the management efficiency of the video files is improved, and the service life of the vehicle-mounted SD card is prolonged. And this scheme can be applied to in the wisdom traffic field to promote the construction in wisdom city.
Fig. 3 to 4 describe the file management device based on the vehicle-mounted SD card in the embodiment of the present invention in detail from the perspective of the modular functional entity, and the file management device based on the vehicle-mounted SD card in the embodiment of the present invention in detail from the perspective of hardware processing.
Fig. 5 is a schematic structural diagram of a vehicle SD card-based file management device 500 according to an embodiment of the present invention, which may have relatively large differences due to different configurations or performances, and may include one or more processors (CPUs) 510 (e.g., one or more processors) and a memory 520, and one or more storage media 530 (e.g., one or more mass storage devices) for storing applications 533 or data 532. Memory 520 and storage media 530 may be, among other things, transient or persistent storage. The program stored in the storage medium 530 may include one or more modules (not shown), each of which may include a series of instruction operations for the in-vehicle SD card-based file management apparatus 500. Still further, the processor 510 may be configured to communicate with the storage medium 530, and execute a series of instruction operations in the storage medium 530 on the vehicle-mounted SD card based file management apparatus 500.
The in-vehicle SD card based file management device 500 may also include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input-output interfaces 560, and/or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, FreeBSD, and the like. Those skilled in the art will appreciate that the configuration of the vehicle SD card based file management device shown in fig. 5 does not constitute a limitation of the vehicle SD card based file management device, and may include more or less components than those shown, or some components in combination, or a different arrangement of components.
The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium, and may also be a volatile computer-readable storage medium, having stored therein instructions, which, when run on a computer, cause the computer to perform the steps of the vehicle-mounted SD card-based file management method.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a read-only memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present invention, and not for limiting the same; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (10)

1. A file management method based on a vehicle-mounted SD card is characterized by comprising the following steps:
when the terminal is started, creating a plurality of file storage directories in the vehicle-mounted SD card, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period;
when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of target video files;
creating a target file management linked list according to the target video files, wherein the target file management linked list is used for storing the target video files;
the storage space of the vehicle-mounted SD card is divided again to obtain a preset storage space;
and when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video files in the first file storage directory in the target file management linked list until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
2. The vehicle-mounted SD card-based file management method according to claim 1, wherein said creating a target file management linked list according to said plurality of target video files, said target file management linked list being used for storing said plurality of target video files, comprises:
creating an initial file management linked list, wherein the initial file management linked list is used for storing the plurality of target video files;
and associating the target video files to the created initial file management linked list according to the video creation time sequence to obtain a target file management linked list.
3. The vehicle-mounted SD card-based file management method according to claim 2, wherein the associating the plurality of target video files to the created initial file management linked list according to a video creation timing sequence to obtain a target file management linked list comprises:
traversing a plurality of file storage directories on the vehicle-mounted SD card, wherein each file storage directory is arranged on 1 storage node of the vehicle-mounted SD card, and each storage node comprises a directory name, storage space occupied by all files under the directory and an address of the next storage node;
determining the creation time of each file under the corresponding target according to the directory name to obtain the creation time of each target video file;
sequencing the plurality of target video files according to the creation time of each target video file and the sequence of time to obtain a video creation time sequence;
and sequentially associating the plurality of target video files to the initial file management linked list according to the video creation time sequence to generate the target file management linked list.
4. The vehicle-mounted SD card-based file management method according to claim 3, wherein after said associating said plurality of target video files to said initial file management linked list in sequence according to said video creation timing sequence and generating said target file management linked list, said vehicle-mounted SD card-based file management method further comprises:
renaming the target video files in the target file management linked list according to a preset naming rule, wherein the name of each target video file comprises a file type, a file creation time, a random number and a serial number.
5. The vehicle-mounted SD card based file management method according to claim 1, wherein said creating a plurality of file storage directories in the vehicle-mounted SD card when the terminal is enabled, said plurality of file storage directories being used for storing the video recorded by the terminal during the enabling, comprises:
when the terminal is started, activating a vehicle-mounted SD card installed on the terminal;
determining the name of a directory file according to a preset naming mode, wherein the name of the directory file at least comprises a video type identifier and a date identifier;
and creating a plurality of file storage directories in the vehicle-mounted SD card according to the names of the directory files, wherein the file storage directories are used for storing videos recorded by the terminal during the starting period.
6. The vehicle-mounted SD card-based file management method according to claim 1, wherein when it is detected that the remaining space in the vehicle-mounted SD card is smaller than the preset storage space, sequentially deleting the target video file in the first file storage directory in the target file management linked list until the remaining space in the vehicle-mounted SD card is greater than or equal to the preset storage space, includes:
checking the residual space in the vehicle-mounted SD card according to a preset time interval;
when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space, inquiring a plurality of file storage directories of a target file management linked list;
sequentially deleting the target video files in the first file storage directory in the target file management linked list according to the file sequence, and detecting the size of the residual space in the vehicle-mounted SD card;
and when the size of the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space, stopping deleting the target video file in the first file storage directory in the target file management linked list.
7. The vehicle-mounted SD card-based file management method according to any one of claims 1 to 6, wherein when the plurality of file storage directories are full, compressing the video files in the plurality of file storage directories to obtain a plurality of target video files comprises:
when the file storage directories are full, compressing the video files in the file storage directories to obtain a plurality of compressed video files;
and encrypting the plurality of compressed video files by adopting a preset symmetric encryption algorithm to obtain a plurality of target video files.
8. A file management device based on an on-vehicle SD card is characterized by comprising:
the terminal comprises a catalog creation module, a storage module and a storage module, wherein the catalog creation module is used for creating a plurality of file storage catalogs in the vehicle-mounted SD card when the terminal is started, and the file storage catalogs are used for storing videos recorded by the terminal during the starting period;
the file compression module is used for compressing the video files in the file storage directories to obtain a plurality of target video files when the file storage directories are full;
a linked list creating module, configured to create a target file management linked list according to the multiple target video files, where the target file management linked list is used to store the multiple target video files;
the space dividing module is used for dividing the storage space of the vehicle-mounted SD card again to obtain a preset storage space;
and the file deleting module is used for sequentially deleting the target video files in the first file storage directory in the target file management linked list when detecting that the residual space in the vehicle-mounted SD card is smaller than the preset storage space until the residual space in the vehicle-mounted SD card is larger than or equal to the preset storage space.
9. A vehicle SD card based file management device, comprising: a memory having instructions stored therein and at least one processor, the memory and the at least one processor interconnected by a line;
the at least one processor calls the instructions in the memory to cause the vehicle SD card based file management device to execute the vehicle SD card based file management method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium stores instructions which, when executed by a processor, implement the vehicle-mounted SD-card based file management method according to any one of claims 1 to 7.
CN202011243809.9A 2020-11-10 2020-11-10 File management method, device, equipment and storage medium based on vehicle-mounted SD card Pending CN112347043A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011243809.9A CN112347043A (en) 2020-11-10 2020-11-10 File management method, device, equipment and storage medium based on vehicle-mounted SD card

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011243809.9A CN112347043A (en) 2020-11-10 2020-11-10 File management method, device, equipment and storage medium based on vehicle-mounted SD card

Publications (1)

Publication Number Publication Date
CN112347043A true CN112347043A (en) 2021-02-09

Family

ID=74362433

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011243809.9A Pending CN112347043A (en) 2020-11-10 2020-11-10 File management method, device, equipment and storage medium based on vehicle-mounted SD card

Country Status (1)

Country Link
CN (1) CN112347043A (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040199669A1 (en) * 2003-04-04 2004-10-07 Riggs Nicholas Dale Apparatus and method for efficiently and securely transferring files over a communications network
US20060265511A1 (en) * 2005-05-20 2006-11-23 Riggs Nicholas D Apparatus and method for efficiently and securely transferring files over a communications network
JP2010028635A (en) * 2008-07-23 2010-02-04 Mitsubishi Electric Engineering Co Ltd Onboard video recording apparatus
WO2011109727A1 (en) * 2010-03-05 2011-09-09 Eye-Fi, Inc. Endless memory
US8099605B1 (en) * 2006-06-05 2012-01-17 InventSec AB Intelligent storage device for backup system
US8667273B1 (en) * 2006-05-30 2014-03-04 Leif Olov Billstrom Intelligent file encryption and secure backup system
US8732479B1 (en) * 2010-03-12 2014-05-20 Carbonite, Inc. Methods, apparatus and systems for remote file storage using local client status files
CN107609014A (en) * 2017-08-02 2018-01-19 深圳市爱培科技术股份有限公司 A kind of drive recorder and its video storage method, storage medium
CN108932271A (en) * 2017-05-27 2018-12-04 大唐移动通信设备有限公司 A kind of file management method and device
CN108989724A (en) * 2018-07-26 2018-12-11 深圳市安佳威视信息技术有限公司 Embedded video camera videotape storage means

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040199669A1 (en) * 2003-04-04 2004-10-07 Riggs Nicholas Dale Apparatus and method for efficiently and securely transferring files over a communications network
US20060265511A1 (en) * 2005-05-20 2006-11-23 Riggs Nicholas D Apparatus and method for efficiently and securely transferring files over a communications network
US8667273B1 (en) * 2006-05-30 2014-03-04 Leif Olov Billstrom Intelligent file encryption and secure backup system
US8099605B1 (en) * 2006-06-05 2012-01-17 InventSec AB Intelligent storage device for backup system
JP2010028635A (en) * 2008-07-23 2010-02-04 Mitsubishi Electric Engineering Co Ltd Onboard video recording apparatus
WO2011109727A1 (en) * 2010-03-05 2011-09-09 Eye-Fi, Inc. Endless memory
US8732479B1 (en) * 2010-03-12 2014-05-20 Carbonite, Inc. Methods, apparatus and systems for remote file storage using local client status files
CN108932271A (en) * 2017-05-27 2018-12-04 大唐移动通信设备有限公司 A kind of file management method and device
CN107609014A (en) * 2017-08-02 2018-01-19 深圳市爱培科技术股份有限公司 A kind of drive recorder and its video storage method, storage medium
CN108989724A (en) * 2018-07-26 2018-12-11 深圳市安佳威视信息技术有限公司 Embedded video camera videotape storage means

Similar Documents

Publication Publication Date Title
CN108804510B (en) Key value file system
CN108628753B (en) Memory space management method and device
KR101767710B1 (en) Card-based management of discardable files
US7836107B2 (en) Disk seek optimized file system
KR100856245B1 (en) File system device and method for saving and seeking file thereof
US7681010B2 (en) Apparatus and method for a managing file system
KR101708261B1 (en) Managing storage of individually accessible data units
JPS6115243A (en) Self-diffusion memory file
US6636941B1 (en) Enhanced stable disk storage
CN111061752B (en) Data processing method and device and electronic equipment
GB1504112A (en) Interactive enquiry systems
CN101263462A (en) Nonvolatile memory with block management
WO2004055675A1 (en) File management apparatus, file management program, file management method, and file system
EP3788505B1 (en) Storing data items and identifying stored data items
CN108304259B (en) Memory management method and system
CN102257497B (en) Download management of discardable files
CN114936188A (en) Data processing method and device, electronic equipment and storage medium
US10311026B2 (en) Compressed data layout for optimizing data transactions
CN112347043A (en) File management method, device, equipment and storage medium based on vehicle-mounted SD card
US10877881B2 (en) In-place garbage collection of a sharded, replicated distributed state machine based on mergeable operations
CN116467267A (en) Garbage recycling method, device, storage medium and system
CN112269549B (en) Flash memory management method of light embedded system
CN107609038A (en) Data clearing method and device
CN117149724B (en) Method and system for deleting repeated data of cloud environment system
CN111339037B (en) Efficient parallel replication method for parallel distributed file system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210209

RJ01 Rejection of invention patent application after publication