Search

CN-122019807-A - Method, device, medium and equipment for acquiring MP4 file key metadata

CN122019807ACN 122019807 ACN122019807 ACN 122019807ACN-122019807-A

Abstract

The application provides a method, a device, a medium and equipment for acquiring key metadata of MP4 files, wherein the method comprises the steps of acquiring key metadata of MP4 files when recording and generating MP4 files, serializing and checking the key metadata into first data blocks with preset first byte lengths, writing the first data blocks into a disk together with standard data of the MP4 files, wherein the first data blocks are stored before the standard data of the MP4 files, acquiring the first data blocks corresponding to the MP4 files for each MP4 file stored in the disk when scanning the disk, and performing deserializing and checking on the first data blocks, and if successful, extracting the key metadata of the MP4 files from a processing result. The application can greatly improve the acquisition efficiency of the MP4 file key metadata, improve the user experience and greatly reduce the occupation of the input and output resources and the computing resources of the equipment.

Inventors

  • LU SONG
  • Lv Taichao
  • ZHU ZHUANGHUI

Assignees

  • 上海七十迈数字科技有限公司

Dates

Publication Date
20260512
Application Date
20260122

Claims (20)

  1. 1. A method for acquiring key metadata of an MP4 file, applied to an audio-video recording device, the method comprising: When an MP4 file is recorded and generated, key metadata of the MP4 file is obtained, and is processed into a first data block with a preset first byte length through serialization and verification, and the first data block and standard data of the MP4 file are written into a disk, wherein the first data block is stored before the standard data of the MP4 file; When the magnetic disk is scanned, a first data block corresponding to each MP4 file stored in the magnetic disk is obtained, the first data block is subjected to deserialization and verification, and if successful, key metadata of the MP4 file are extracted from a processing result.
  2. 2. The method of claim 1, wherein the serializing and verifying process into the first data block of the predetermined first byte length comprises: Carrying out serialization processing on the key metadata of the MP4 file; after the serialized data are adjusted to be the preset second byte length, a preset check algorithm is adopted to calculate the check code of the adjusted data; And adding the check code to the tail end of the adjusted data to obtain a first data block with a preset first byte length.
  3. 3. The method of claim 1, wherein the de-serializing and verifying the first data block further comprises: if the MP4 file fails, acquiring the key metadata of the MP4 file from the standard data of the MP4 file.
  4. 4. A method according to claim 3, characterized in that the method further comprises: and carrying out serialization and verification processing on key metadata obtained from standard data of the MP4 file to obtain a second data block with the preset first byte length, and overwriting the second data block in a storage area of a first data block corresponding to the MP4 file in a magnetic disk to update the first data block of the MP4 file.
  5. 5. A method for acquiring key metadata of an MP4 file, applied to an audio-video recording device, the method comprising: When an MP4 file is recorded and generated, key metadata of the MP4 file is obtained, and is processed into a first data block with a preset first byte length through serialization and verification, and the first data block and standard data of the MP4 file are written into a disk, wherein the first data block is stored before the standard data of the MP4 file; When the magnetic disk is scanned, acquiring file information of each MP4 file stored in the magnetic disk based on a file system of the magnetic disk, wherein the file information at least comprises a storage path and update time of the MP4 file; Comparing the file information of the MP4 files in the disk with the file information of the MP4 files stored in a local database, and marking the related MP4 files stored in the disk according to the comparison result, wherein the local database records the file information and key metadata of each MP4 file stored in the disk during the last scanning; and for each marked MP4 file, acquiring a first data block corresponding to the MP4 file, performing deserialization and verification processing on the first data block, and if successful, extracting key metadata of the MP4 file.
  6. 6. The method of claim 5, wherein the associated MP4 file stored on the disk comprises at least one of: MP4 files stored in the disk but not recorded in a local database; the disc is stored and has records in the local database, but the update time is later than the MP4 files recorded in the local database.
  7. 7. The method of claim 5, wherein said de-serializing and verifying the first data block further comprises: if the MP4 file fails, acquiring the key metadata of the MP4 file from the standard data of the MP4 file.
  8. 8. The method of claim 7, wherein the method further comprises: and carrying out serialization and verification processing on key metadata obtained from standard data of the MP4 file to obtain a second data block with the preset first byte length, and overwriting the second data block in a storage area of a first data block corresponding to the MP4 file in a magnetic disk to update the first data block of the MP4 file.
  9. 9. The method of claim 5, wherein the method further comprises: For each MP4 file that is not marked, key metadata of the MP4 file is obtained from a local database.
  10. 10. The method of claim 5, wherein the method further comprises: the file information and key metadata of each MP4 file marked are written into a local database.
  11. 11. An apparatus for obtaining key metadata of an MP4 file, deployed on an audio-visual recording device, the apparatus comprising: The first module is used for obtaining key metadata of the MP4 file when the MP4 file is recorded and generated, and performing serialization and verification processing to obtain a first data block with a preset first byte length, and writing the first data block and standard data of the MP4 file into a disk, wherein the first data block is stored before the standard data of the MP4 file; And the second module is used for acquiring a first data block corresponding to each MP4 file stored in the disk when the disk is scanned, performing deserialization and verification processing on the first data block, and extracting key metadata of the MP4 file from a processing result if the first data block is successful.
  12. 12. The apparatus of claim 11, wherein the second module is further configured to: if the MP4 file fails, acquiring the key metadata of the MP4 file from the standard data of the MP4 file.
  13. 13. The apparatus of claim 11, wherein the apparatus further comprises: And the third module is used for carrying out serialization and verification processing on the key metadata obtained from the standard data of the MP4 file to obtain a second data block with the preset first byte length, and overwriting the second data block in a storage area of a first data block corresponding to the MP4 file in a magnetic disk so as to update the first data block of the MP4 file.
  14. 14. An apparatus for obtaining key metadata of an MP4 file, deployed on an audio-visual recording device, the apparatus comprising: The first module is used for obtaining key metadata of the MP4 file when the MP4 file is recorded and generated, and performing serialization and verification processing to obtain a first data block with a preset first byte length, and writing the first data block and standard data of the MP4 file into a disk, wherein the first data block is stored before the standard data of the MP4 file; The second module is used for acquiring file information of each MP4 file stored in the disk based on a file system of the disk when the disk is scanned, wherein the file information at least comprises a storage path and update time of the MP4 file; A third module, configured to compare file information of the MP4 files in the disk with file information of the MP4 files stored in the local database, and mark related MP4 files stored in the disk according to a comparison result, where the local database records file information and key metadata of each MP4 file stored in the disk when scanned last time; And a fourth module, configured to obtain, for each marked MP4 file, a first data block corresponding to the MP4 file, and perform deserialization and verification processing on the first data block, and if successful, extract key metadata of the MP4 file from the first data block.
  15. 15. The apparatus of claim 14, wherein the fourth module is further configured to: if the MP4 file fails, acquiring the key metadata of the MP4 file from the standard data of the MP4 file.
  16. 16. The apparatus of claim 15, wherein the apparatus further comprises: And a fifth module, configured to perform serialization and verification processing on key metadata obtained from standard data of the MP4 file, obtain a second data block with the preset first byte length, and overwrite the second data block into a storage area of a first data block corresponding to the MP4 file in a disk, so as to update the first data block of the MP4 file.
  17. 17. The apparatus of claim 14, wherein the apparatus further comprises: And a sixth module, configured to obtain, for each MP4 file that is not marked, key metadata of the MP4 file from the local database.
  18. 18. The apparatus of claim 14, wherein the apparatus further comprises: and a seventh module for writing the file information and key metadata of each MP4 file marked into the local database.
  19. 19. A computer-readable medium comprising, Having stored thereon computer readable instructions which are executed by a processor to implement part or all of the method of any of claims 1 to 10.
  20. 20. An audio-visual recording apparatus, said apparatus comprising: One or more processors, and A memory storing computer readable instructions that, when executed, cause the processor to perform part or all of the operations of the method of any one of claims 1 to 10.

Description

Method, device, medium and equipment for acquiring MP4 file key metadata Technical Field The application relates to the technical field of video and audio data storage and processing, in particular to a technology for acquiring MP4 file key metadata. Background Video and audio recording devices, such as automobile recorders, law enforcement recorders, etc., typically encode recorded video and audio into MP4 files, which are stored on a magnetic disk (e.g., a memory card of the type such as SD card, TF card, etc., or a micro-information hard disk, etc.). MP4 files are based on box (box) structures, and the box structures of standard data of MP4 files generally include ftyp (file type) boxes, mdat (media data) boxes, and moov (movie) boxes in sequence, wherein atom data in ftyp boxes are used to indicate related information referenced by MP4 files, mdat boxes store actual video and audio atom data, and moov boxes contain all metadata describing media data (such as creation time, duration, media stream type, resolution, etc.), and cannot play MP4 files without it. In the standard recording generation flow of MP4 files, the ftyp box is written to the disk as the file header for storage first, while the moov box is usually required to be completely generated after all video and audio data are written, and is usually placed at the end of the file. If a user needs to acquire key metadata of an MP4 file (such as total duration of the MP4 file, total number of video frames, total number of audio frames, video encoding format, resolution, etc.) as related information of the MP4 file for viewing or displaying on a device screen, the MP4 file must generally be traversed and the whole moov box must be located, read and parsed, and this acquisition mode needs to occupy a large input/output cost and a large computing cost, which is inefficient, especially for a large-capacity disk, if the MP4 file stored in the disk occupies a large number of software and hardware resources of the video/audio recording device for processing, the related information of one MP4 file can be acquired only after the processing is occupied, which not only affects other response performance of the device, but also affects user experience. Therefore, how to quickly and efficiently obtain the key metadata of the MP4 file, and avoid occupying a large amount of software and hardware resources of the device is a technical problem to be solved currently. Disclosure of Invention In order to at least partially solve the above technical problems, the present application aims to provide a method, an apparatus, a medium and a device for obtaining key metadata of an MP4 file. According to one aspect of the present application, there is provided a method for acquiring key metadata of an MP4 file, applied to an audio-visual recording device, wherein the method includes: When an MP4 file is recorded and generated, key metadata of the MP4 file is obtained, and is processed into a first data block with a preset first byte length through serialization and verification, and the first data block and standard data of the MP4 file are written into a disk, wherein the first data block is stored before the standard data of the MP4 file; When the magnetic disk is scanned, a first data block corresponding to each MP4 file stored in the magnetic disk is obtained, the first data block is subjected to deserialization and verification, and if successful, key metadata of the MP4 file are extracted from a processing result. Optionally, the serializing and checking process is performed to form a first data block with a preset first byte length, including: Carrying out serialization processing on the key metadata of the MP4 file; after the serialized data are adjusted to be the preset second byte length, a preset check algorithm is adopted to calculate the check code of the adjusted data; And adding the check code to the tail end of the adjusted data to obtain a first data block with a preset first byte length. Optionally, the performing deserialization and verification processing on the first data block further includes: if the MP4 file fails, acquiring the key metadata of the MP4 file from the standard data of the MP4 file. Optionally, the method for obtaining the MP4 file key data further includes: and carrying out serialization and verification processing on key metadata obtained from standard data of the MP4 file to obtain a second data block with the preset first byte length, and overwriting the second data block in a storage area of a first data block corresponding to the MP4 file in a magnetic disk to update the first data block of the MP4 file. According to another aspect of the present application, there is provided a method for acquiring key metadata of an MP4 file, applied to an audio-visual recording device, wherein the method includes: When an MP4 file is recorded and generated, key metadata of the MP4 file is obtained, and is processed into a first data block with