CN110798730A - MP4 file recording and repairing method - Google Patents

MP4 file recording and repairing method Download PDF

Info

Publication number
CN110798730A
CN110798730A CN201911110575.8A CN201911110575A CN110798730A CN 110798730 A CN110798730 A CN 110798730A CN 201911110575 A CN201911110575 A CN 201911110575A CN 110798730 A CN110798730 A CN 110798730A
Authority
CN
China
Prior art keywords
audio
video
area
data
data index
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
CN201911110575.8A
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.)
SHENZHEN LANGTAO TECHNOLOGY Co Ltd
Original Assignee
SHENZHEN LANGTAO 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 LANGTAO TECHNOLOGY Co Ltd filed Critical SHENZHEN LANGTAO TECHNOLOGY Co Ltd
Priority to CN201911110575.8A priority Critical patent/CN110798730A/en
Publication of CN110798730A publication Critical patent/CN110798730A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/80Generation or processing of content or additional data by content creator independently of the distribution process; Content per se
    • H04N21/85Assembly of content; Generation of multimedia applications
    • H04N21/854Content authoring
    • H04N21/85406Content authoring involving a specific file format, e.g. MP4 format
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/432Content retrieval operation from a local storage medium, e.g. hard-disk
    • H04N21/4325Content retrieval operation from a local storage medium, e.g. hard-disk by playing back content from the storage medium
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4334Recording operations

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The invention relates to a method for recording and repairing an MP4 file, which specifically comprises the following steps: the audio and video data generating device comprises an audio and video generating area and a data indexing area, wherein the audio and video generating area is used for storing audio and video data, the data indexing area is used for storing audio and video metadata information, the audio and video area can store the audio and video data in real time, and the data indexing area can store the audio and video metadata information at regular time. According to the MP4 file recording and repairing method provided by the invention, when the MP4 file is damaged due to unexpected interruption in the recording process, the damaged MP4 file can be quickly and automatically repaired, and the loss caused by the damage of the MP4 file is avoided.

Description

MP4 file recording and repairing method
Technical Field
The invention relates to the technical field of data processing, in particular to a method for recording and repairing an MP4 file.
Background
In the prior art, for intelligent education or education informatization, video recording and video on demand and playback in the teaching process are commonly used and also important applications, but when MP4 files are recorded in classroom teaching, abnormal interruption of the recording process due to power failure, equipment failure and the like can be possibly caused, so that the MP4 file is damaged, and the MP4 file information is incompletely stored and cannot be used, namely, the video recording process is abnormally stopped, so that the video recording video files cannot be normally played and used.
Disclosure of Invention
The invention provides a method for recording and repairing an MP4 file, which solves the problems that an MP4 file is damaged when interruption occurs in the process of recording an MP4 file, and the recording needs to be carried out again when the situation is serious.
In order to achieve the purpose, the invention provides the following technical scheme:
an MP4 file recording method is applied to recording audio and video, and the method specifically comprises the following steps:
s1, generating an audio and video area for storing audio and video data and generating a data index area for storing audio and video metadata information;
s2, recording audio and video data according to an MP4 file packaging format, storing the audio and video data in the audio and video area in real time, and storing the audio and video metadata information in the data index area at regular time;
and S3, when the recording is normally finished, writing the audio and video metadata information in the data index area into the audio and video area, deleting the data index area, and renaming the audio and video area as a recording area.
Preferably, after the step S2, before the step S3, the method further includes a step S21 of generating a second data index area, updating the audio/video metadata information to the second data index area in real time, and renaming the second data index area as a data index area after the updating is completed.
Preferably, S22 is further included after the step S21, the data index is divided into a first part and a second part, the first part is the first 8 bytes and stores effective audio/video data length information, and the second part is the last byte and stores the audio/video metadata information.
Preferably, S31 is further included after the step S3, and when the recording process of the MP4 file abnormally ends, the audio video area and the data index area are simultaneously reserved.
An MP4 file repairing method specifically comprises the following steps:
s1, searching the damaged audio and video area, searching the data index area corresponding to the damaged audio and video area, reading the effective audio and video data length information in the first 8 bytes from the first part of the data index area, wherein the second part of the data index area is effective audio and video metadata information;
s2, searching the audio and video area, positioning the effective position of audio and video data in the audio and video area according to the length information of the effective audio and video data, and discarding the audio and video data at the position;
s3, writing the audio and video metadata information in the data index area into the audio and video area;
and S4, renaming the audio and video area as a recording area, deleting the data index area, and completing audio and video repair.
Through implementing above technical scheme, have following technological effect: according to the MP4 file recording and repairing method, when the MP4 file is damaged due to unexpected interruption in the recording process, the damaged MP4 file can be automatically repaired, and loss caused by damage of the MP4 file is avoided.
Drawings
Fig. 1 is a flow chart of MP4 file recording provided by the present invention;
fig. 2 is a flowchart of MP4 file repair provided by the present invention.
Detailed Description
In order to better understand the technical scheme of the invention, the following detailed description is made on the embodiments provided by the invention in combination with the accompanying drawings.
Example 1: an MP4 file recording method is applied to recording audio and video, and the method specifically comprises the following steps:
s1, generating an audio and video area for storing audio and video data and generating a data index area for storing audio and video metadata information;
s2, recording audio and video data according to an MP4 file packaging format, storing the audio and video data in the audio and video area in real time, and storing the audio and video metadata information in the data index area at regular time;
and S3, when the recording is normally finished, writing the audio and video metadata information in the data index area into the audio and video area, deleting the data index area, and renaming the audio and video area as a recording area.
In this embodiment, the recording of the MP4 file is applied to the recording of teaching videos, when an audio/video is recorded, an audio/video area and a data index area are generated first, the audio/video area is a folder or an audio/video storage area for storing audio/video data, the audio/video data is recorded teaching videos or other MP4 video data, the data index area is a folder or an audio/video metadata information storage area for storing audio/video metadata information, the audio/video metadata information is index information of the audio/video data, the audio/video area can store the recorded audio/video data, such as teaching videos or other MP4 videos, in real time, and does not interrupt the audio/video data, the audio/video metadata information is stored in the data index area at regular time, and a plurality of interrupts occur in the middle, such as every 10s, The method is mainly characterized in that certain time is needed for generating the audio and video metadata information, certain resources are consumed, the storage of audio and video data is affected too frequently, when a recording process is not accidental, after the recording process is normally finished, the audio and video metadata information in the data index area is written into the audio and video area, the data index area is deleted, the audio and video area is renamed to be the recording area, the whole recording process is finished, when the MP4 file recording process is abnormally finished, the audio and video area and the data index area are simultaneously reserved, and the audio and video data in the audio and video area are repaired by utilizing the audio and video data information in the data index area.
Example 2: an MP4 file recording method is applied to recording audio and video, and the method specifically comprises the following steps:
s1, generating an audio and video area for storing audio and video data and generating a data index area for storing audio and video metadata information;
s2, recording audio and video data according to an MP4 file packaging format, storing the audio and video data in the audio and video area in real time, and storing the audio and video metadata information in the data index area at regular time;
and S3, when the recording is normally finished, writing the audio and video metadata information in the data index area into the audio and video area, deleting the data index area, and renaming the audio and video area as a recording area.
After the step S2, before the step S3, the method further includes a step S21 of generating a second data index area, updating the audio/video metadata information to the second data index area in real time, and renaming the second data index area as a data index area after the updating is completed.
In this embodiment, in order to prevent that the recording process is unexpected in the interval time of updating the audio/video metadata information, the audio/video data stored in the audio/video area is damaged, and meanwhile, the audio/video metadata information stored in the data index area is also damaged, so that the audio/video data cannot be recovered, and therefore, the audio/video metadata information is updated into a temporary second data index area first, and is renamed into the data index area after the audio/video metadata information is updated successfully, so that the original data index area is covered, and the phenomenon that the audio/video data are damaged and cannot be recovered in the audio/video area is avoided.
Example 3: an MP4 file recording method is applied to recording audio and video, and the method specifically comprises the following steps:
s1, generating an audio and video area for storing audio and video data and generating a data index area for storing audio and video metadata information;
s2, recording audio and video data according to an MP4 file packaging format, storing the audio and video data in the audio and video area in real time, and storing the audio and video metadata information in the data index area at regular time;
and S3, when the recording is normally finished, writing the audio and video metadata information in the data index area into the audio and video area, deleting the data index area, and renaming the audio and video area as a recording area.
After the step S2, before the step S3, the method further includes a step S21 of generating a second data index area, updating the audio/video metadata information to the second data index area in real time, and renaming the second data index area to a data index area after the updating is completed, and after the step S21, the method further includes a step S22 of dividing the data index area into a first part and a second part, where the first part is the first 8 bytes and stores the valid audio/video data length information, and the second part is the following bytes and stores the audio/video metadata information.
In this embodiment, the data index area is divided into two parts, the first part is the first 8 bytes for storing effective audio and video data length information, so as to be convenient for rapidly positioning the length of effective audio and video data in the MP4 file repair, the second part is the later bytes for storing audio and video metadata information, and when the audio and video data stored in the audio and video area is damaged, the audio and video data in the audio and video area can be recovered through the audio and video metadata information in the data index area.
On the basis of the foregoing embodiments, in other embodiments, further, after the step S3, S31 is included, and when the MP4 file recording process abnormally ends, the audio video area and the data index area are reserved.
In this embodiment, when recording is finished due to an accident occurring during the recording process of the MP4 file, such as a power failure or a machine failure, the audio and video area and the data index area are simultaneously reserved, so that the recorded MP4 file can be recovered when damaged, thereby reducing loss and secondary recording, and saving cost.
The embodiment of the invention also provides an MP4 file repairing method, which is applied to repairing any MP4 file in the above embodiments, and the method specifically comprises the following steps:
s1, searching the damaged audio and video area, searching the data index area corresponding to the damaged audio and video area, reading the effective audio and video data length information in the first 8 bytes from the first part of the data index area, wherein the second part of the data index area is effective audio and video metadata information;
s2, searching the audio and video area, positioning the effective position of audio and video data in the audio and video area according to the length information of the effective audio and video data, and discarding the audio and video data at the position;
s3, writing the audio and video metadata information in the data index area into the audio and video area;
and S4, renaming the audio and video area as a recording area, deleting the data index area, and completing audio and video repair.
In this embodiment, when the recording process is abnormally finished, the system is in a normal operation state after the abnormal recovery, if the system is idle, that is, in a non-recording state, the audio-video area is searched in the magnetic disk, if an area of this type exists, which represents that the video recording is abnormally stopped, audio-video data needs to be repaired, at this time, two areas of the audio-video area and the data index area are retained in the system, the data index area corresponding to the damaged audio-video area is searched, the effective audio-video data length information in the first 8 bytes is read from the first part of the data index area, the second part of the data index area is effective audio-video metadata information, then the audio-video area is opened, and the complete position of the audio-video data in the audio-video area can be quickly located according to the effective audio-video data length information of the first part of the data index area, and deleting the audio and video data after the position, writing effective audio and video metadata information in the second part of the data index area into the position where the audio and video data are complete in the audio and video area, completing the repair of the audio and video data in the audio and video area, finally renaming the audio and video area as a recording area, deleting the data index area, and completing the repair of the audio and video data.
While the MP4 file recording and repairing method provided by the embodiment of the present invention has been described in detail, for those skilled in the art, the idea of the embodiment of the present invention may be changed in the specific implementation and application scope, and in summary, the present disclosure should not be construed as limiting the present invention.

Claims (5)

1. An MP4 file recording method is applied to recording audio and video, and the method specifically comprises the following steps:
s1, generating an audio and video area for storing audio and video data and generating a data index area for storing audio and video metadata information;
s2, recording audio and video data according to an MP4 file packaging format, storing the audio and video data in the audio and video area in real time, and storing the audio and video metadata information in the data index area at regular time;
and S3, when the recording is normally finished, writing the audio and video metadata information in the data index area into the audio and video area, deleting the data index area, and renaming the audio and video area as a recording area.
2. The MP4 file recording method according to claim 1, further comprising, after the step S2 and before the step S3, a step S21 of generating a second data index area, updating the av metadata information to the second data index area in real time, and renaming the second data index area as a data index area after the updating is completed.
3. The MP4 file recording method according to claim 1, further comprising, after the step S21, S22, dividing the data index into a first part and a second part, wherein the first part is the first 8 bytes and stores valid audio/video data length information, and the second part is the last bytes and stores the audio/video metadata information.
4. The MP4 file recording method as claimed in claim 1, further comprising step S31 after the step S3, wherein the audio video area and the data index area are reserved when the recording process of the MP4 file is abnormally terminated.
5. An MP4 file repairing method, applied to the repairing of the MP4 file as claimed in any one of claims 1-4, the method specifically includes the following steps:
s1, searching the damaged audio and video area, searching the data index area corresponding to the damaged audio and video area, reading the effective audio and video data length information in the first 8 bytes from the first part of the data index area, wherein the second part of the data index area is effective audio and video metadata information;
s2, searching the audio and video area, positioning the effective position of audio and video data in the audio and video area according to the length information of the effective audio and video data, and discarding the audio and video data at the position;
s3, writing the audio and video metadata information in the data index area into the audio and video area;
and S4, renaming the audio and video area as a recording area, deleting the data index area, and completing audio and video repair.
CN201911110575.8A 2019-11-14 2019-11-14 MP4 file recording and repairing method Pending CN110798730A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911110575.8A CN110798730A (en) 2019-11-14 2019-11-14 MP4 file recording and repairing method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911110575.8A CN110798730A (en) 2019-11-14 2019-11-14 MP4 file recording and repairing method

Publications (1)

Publication Number Publication Date
CN110798730A true CN110798730A (en) 2020-02-14

Family

ID=69444653

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911110575.8A Pending CN110798730A (en) 2019-11-14 2019-11-14 MP4 file recording and repairing method

Country Status (1)

Country Link
CN (1) CN110798730A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114173075A (en) * 2021-10-22 2022-03-11 广州市奥威亚电子科技有限公司 Mp4 file saving method and device for recording, electronic equipment and storage medium
CN116860509A (en) * 2023-09-04 2023-10-10 深圳麦风科技有限公司 PST file repairing method, device and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104980786A (en) * 2015-07-01 2015-10-14 广东工业大学 Multi-path audio and video stream storage method with function of accidental stopping prevention
CN105847724A (en) * 2016-04-12 2016-08-10 深圳市极酷威视科技有限公司 Method and apparatus protecting video recording against outage
CN105872484A (en) * 2016-06-04 2016-08-17 武汉诚迈科技有限公司 Protection method of monitoring video abnormity
CN108322808A (en) * 2018-02-28 2018-07-24 珠海全志科技股份有限公司 A kind of video record processing method and processing device, computer installation, storage medium
CN108521551A (en) * 2018-05-14 2018-09-11 河北远东通信***工程有限公司 A kind of network real-time video recording and storing method and system and file access pattern method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104980786A (en) * 2015-07-01 2015-10-14 广东工业大学 Multi-path audio and video stream storage method with function of accidental stopping prevention
CN105847724A (en) * 2016-04-12 2016-08-10 深圳市极酷威视科技有限公司 Method and apparatus protecting video recording against outage
CN105872484A (en) * 2016-06-04 2016-08-17 武汉诚迈科技有限公司 Protection method of monitoring video abnormity
CN108322808A (en) * 2018-02-28 2018-07-24 珠海全志科技股份有限公司 A kind of video record processing method and processing device, computer installation, storage medium
CN108521551A (en) * 2018-05-14 2018-09-11 河北远东通信***工程有限公司 A kind of network real-time video recording and storing method and system and file access pattern method

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114173075A (en) * 2021-10-22 2022-03-11 广州市奥威亚电子科技有限公司 Mp4 file saving method and device for recording, electronic equipment and storage medium
CN114173075B (en) * 2021-10-22 2024-01-30 广州市奥威亚电子科技有限公司 MP4 file storage method and device for recording, electronic equipment and storage medium
CN116860509A (en) * 2023-09-04 2023-10-10 深圳麦风科技有限公司 PST file repairing method, device and storage medium
CN116860509B (en) * 2023-09-04 2023-12-26 深圳麦风科技有限公司 PST file repairing method, device and storage medium

Similar Documents

Publication Publication Date Title
US10255235B2 (en) Database storage system based on jukebox and method using the system
US20160259694A1 (en) Method and device for organizing and restoring file indexeses
CN104811645B (en) A kind of embedded Video data storage method
CN104063187B (en) Hard disk file system suitable for security application and operation method thereof
CN110798730A (en) MP4 file recording and repairing method
CN103034592A (en) Data processing method and device
CN109542842B (en) Video sequence storage and query method compatible with fat32 file system and device thereof
US9858287B2 (en) Storage system
WO2020077534A1 (en) Disk management method, disk management apparatus, and electronic device
US7234078B2 (en) Data recovery method and data recording apparatus
CN100440352C (en) Power failure recovery method
CN105302488A (en) Data writing method and system for storage system
US20100174880A1 (en) Method for fast format of a fully allocated volume when copied from a space efficient volume
CN103092719B (en) A kind of power-off protection method of file system
US20050262033A1 (en) Data recording apparatus, data recording method, program for implementing the method, and program recording medium
US9009430B2 (en) Restoration of data from a backup storage volume
CN105653385B (en) A kind of vehicle-mounted kinescope method
CN102419995A (en) Information access device and information access method
US20160253247A1 (en) Method and device for restoring system file indexes
CN105744200A (en) Video monitoring video storage method and device
CN105830067A (en) Document information processing method, apparatus, and document processing apparatus and system
CN109040827A (en) A kind of playback method of video file, storage medium and intelligent terminal
US8760781B2 (en) System utility for controling data synchronization in a tape data storage system
CN107122257B (en) Method for repairing NO _ HOST and 3005_ ERROR faults simultaneously occurring on Seagate hard disk
US20060239656A1 (en) Recording medium for storing video file and method for editing video file

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

Application publication date: 20200214