CN105847724A - Method and apparatus protecting video recording against outage - Google Patents

Method and apparatus protecting video recording against outage Download PDF

Info

Publication number
CN105847724A
CN105847724A CN201610225402.0A CN201610225402A CN105847724A CN 105847724 A CN105847724 A CN 105847724A CN 201610225402 A CN201610225402 A CN 201610225402A CN 105847724 A CN105847724 A CN 105847724A
Authority
CN
China
Prior art keywords
box
file
video
mdat
write
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.)
Granted
Application number
CN201610225402.0A
Other languages
Chinese (zh)
Other versions
CN105847724B (en
Inventor
唐耿红
杨自和
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen A Very Cool Granville Technology Co Ltd
Original Assignee
Shenzhen A Very Cool Granville 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 A Very Cool Granville Technology Co Ltd filed Critical Shenzhen A Very Cool Granville Technology Co Ltd
Priority to CN201610225402.0A priority Critical patent/CN105847724B/en
Publication of CN105847724A publication Critical patent/CN105847724A/en
Application granted granted Critical
Publication of CN105847724B publication Critical patent/CN105847724B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/76Television signal recording

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Management Or Editing Of Information On Record Carriers (AREA)
  • Television Signal Processing For Recording (AREA)

Abstract

The invention discloses a method and apparatus protecting video recording against outage. The method comprises the following steps: recording a video, setting an MP4 file, and writing the file header ftyp into the MP4 file; setting an Amoove box and a Bmoov box, both of which occupy the same space as a moov box; making a mdat box with unchangeable size and writing video data into the mdat box; and conducting data writing into the Amoov box and Bmoov box alternatively at regular intervals, moov type data for the Amoov box and free type data for the other. The apparatus comprises an MP4 file creating unit, an index information creating unit, a media data write-in unit and a cycle unit. According to the invention, the alternative storage of moov information and the storage of a plurality of pieces of mdat information means that even during a sudden power outage or halting, it is still possible to ensure the integrity of an MP4 file and so, allows video recording to go on smoothly. The method and the apparatus provided by the invention find wide applications in the technical field of video recording.

Description

A kind of video record power-off protection method and device
Technical field
The present invention relates to video record technical field, particularly relate to a kind of video record power-off protection method and device.
Background technology
MP4 file is by several box(Box=BoxHeader+BoxData; BoxHeader = BoxSize +BoxType;) composition.
Video record refers to record and comes from computer hardware terminal, the video of computer viewing window environment, common recording mode includes catching the hardware video such as camera, video camera, digital camera, TV card, DVR, records the game video of computer viewing window, QQ video, records film etc..Athletic-type camera be integrate high definition dynamically take pictures, extensive angle video recording, the camera of the waterproof shatter-resistant of stabilization.Use crowd typically likes outdoor exercises, photography, extreme sport, it is mainly used in taking photo by plane, racing car, skiing, bungee jumping, parachutes, dive under water, travel, in every motion such as recording of growing up, owing to using out of doors, can not get charging in time when battery electric quantity is low when, so being easy to that video record when unexpected power-off or card machine occur, causing video file to be recorded to make mistakes, video file is imperfect, it is impossible to normal play.Current video record, general employing reserve battery or the reset mode that powers on preserve video file to prevent the situation of unexpected power-off or card machine, it is impossible to accomplish power-off and the timely preservation when machine.
Summary of the invention
In order to solve above-mentioned technical problem, it is an object of the invention to provide one and work as equipment accident power-off, work as machine, ensure the integrality of video file during the situations such as card is wrong, it is ensured that the video record power-off protection method of energy normal play of recording a video and device.
The technical solution adopted in the present invention is: a kind of video record power-off protection method, and including MP4 document recording, described MP4 file includes: ftyp box, free box, moov box and mdat box, comprising:
Step A: video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Step B: create Amoov box and Bmoov box, described Amoov box and Bmo box all account for a moov box space size, and its box type is respectively moov and free;
Step C: the size of fixing mdat box, writes video file in mdat box;
Step D: be alternately written into Amoov box and the Bmoov box of establishment at regular intervals: a write moov type and data wherein, another writes free type and data;Step C and step D are carried out simultaneously.
Further, described moov box is used for depositing media index information.
Further, described mdat box is owing to depositing media data.
Further, described step C specifically includes sub-step:
C1: the size of fixing mdat box, at the BoxSize of this size write mdat box, starts simultaneously at write video data;
C2: when the video data size of write mdat box is more than the BoxSize of mdat box, then writes new mdat box, repeat step C1.
Further, according to described mdat box size, the size of current video recording code stream estimates the video data size that certain time records a video.
Further, described certain time is 5 minutes.
A kind of video record power-off protection apparatus, comprising:
MP4 file creating unit: for video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Index information file creating unit: create Amoov box and Bmoov box, described Amoov box and Bmoov box all account for a moov box space size, and its box type is respectively moov and free;
Media data writing unit: the size of fixing mdat box, writes video data in mdat box;
Cycling element: the most alternately write Amoov box and the Bmoov box of establishment, wherein a write moov type and data, another write free type and data.
Further, comprising:
Second media data writing unit: when the video file size of write mdat box is more than the BoxSize of mdat box, then write new mdat box.
The invention has the beneficial effects as follows: the present invention, by alternately preserving the information of moov, preserves multiple mdat information so that occur unexpected power-off or card machine video record when, still can guarantee that the integrality of mp4 file so that video recording can normal play.
Accompanying drawing explanation
Below in conjunction with the accompanying drawings the detailed description of the invention of the present invention is described further:
Fig. 1 is the flow chart of the specific embodiment of the invention.
Detailed description of the invention
It should be noted that in the case of not conflicting, the embodiment in the application and the feature in embodiment can be mutually combined.
A kind of video record power-off protection method, including MP4 document recording, described MP4 file includes: ftyp box, free box, moov box and mdat box,
As it is shown in figure 1, comprising:
Step A: video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Step B: create Amoov box and Bmoov box, described Amoov box and Bmoov box all account for a moov box space size, and its box type is respectively moov and free;
Step C: the size of fixing mdat box, writes video data in mdat box;
Step D: the most alternately write Amoov box and the Bmoov box of establishment, wherein a write moov type and data, another write free type and data;Step C and step D are carried out simultaneously.
Ftyp is as the mark of MP4 form and comprises some information about file.If normally stopping video recording, then guarantee in Amoov and Bmoov one for moov, another one is renamed as free, first revise the BoxData of Amoov, then the BoxType revising Amoov is moov, and the BoxType finally revising Bmoov is free, or first revises the BoxData of Bmoov, then the BoxType revising Bmoov is moov, and the BoxType finally revising Amoov is free.Rewrite the BoxSize of mdat box simultaneously, thus normal video file will not be produced impact;If because of accidental cause power-off, the most necessarily have a correct moov box, it is thus possible to ensure the integrality of video file, it is ensured that video recording can normal play.
Being further used as preferred embodiment, described moov box is used for depositing media index information.
Being further used as preferred embodiment, described mdat box is owing to depositing media data.
Being further used as preferred embodiment, described step C specifically includes sub-step:
C1: the size of fixing mdat box, at the BoxSize of this size write mdat box, starts simultaneously at write video data;
C2: when the video file size of write mdat box is more than the BoxSize of mdat box, then writes new mdat box, repeat step C1.
A MP4 file may be likely to occur multiple mdat box simultaneously, if because of accidental cause power-off, the most necessarily have a correct mdat box, it is thus possible to ensure the integrality of video file, it is ensured that video recording can normal play.
Being further used as preferred embodiment, according to described mdat box size, the size of current video recording frame per second estimates the video file size that certain time records a video.
Being further used as preferred embodiment, described certain time is 5 minutes.This time can regulate according to user preferences, can be controlled the size of mdat box by regulation this time, and mdat box is the least, and it is the fewest that power-off protection loses the video gone.
If normally stopping video recording, then guaranteeing up-to-date in Amoov and Bmoov to be renamed as moov, another one is renamed as free, rewrites the BoxSize of mdat box simultaneously, thus normal video file will not be produced impact;If because of accidental cause power-off, the most necessarily have a correct moov box, it is thus possible to ensure the integrality of video file, it is ensured that video recording can normal play.
A kind of video record power-off protection apparatus, comprising:
MP4 file creating unit: for video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Index information file creating unit: creating Amoov box and Bmoov box, described Amoov box and Bmoov box all account for a moov box space size;
Media data writing unit: the size of fixing mdat box, writes video data in mdat box;
Cycling element: the most alternately writing Amoov box and the Bmoov box of establishment, wherein a write moov type file, another writes free type file.
It is further used as preferred embodiment, comprising:
Second media data writing unit: when the video data size of write mdat box is more than the BoxSize of mdat box, then write new mdat box.
It is above the preferably enforcement of the present invention is illustrated, but the invention is not limited to described embodiment, those of ordinary skill in the art also can make all equivalent variations or replacement on the premise of spirit of the present invention, and deformation or the replacement of these equivalents are all contained in the application claim limited range.

Claims (6)

1. a video record power-off protection method, including MP4 document recording, described MP4 file includes: ftyp box, free box, moov box and mdat box, it is characterised in that comprising:
Step A: video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Step B: creating Amoov box and Bmoov box, described Amoov box and Bmoov box all account for a moov box space size;
Step C: the size of fixing mdat box, writes video file in mdat box;
Step D: be alternately written into Amoov box and Bmoov box at regular intervals: a write moov type and data wherein, another writes free type and data;
Step C and the parallel running of step D.
Video record power-off protection method the most according to claim 1, it is characterised in that: described step C specifically includes sub-step:
C1: the size of fixing mdat box, at the BoxSize of this size write mdat box, starts simultaneously at write video data;
C2: when the video file size of write mdat box is more than the BoxSize of mdat box, then writes new mdat box, repeat step C1.
Video record power-off protection method the most according to claim 1 and 2, it is characterised in that: according to described mdat box size, the size of current video recording frame per second estimates the video file size that certain time records a video.
Video record power-off protection method the most according to claim 3, it is characterised in that: described certain time is 5 minutes.
5. a video record power-off protection apparatus, it is characterised in that comprising:
MP4 file creating unit: for video record, creates mp4 file, by mp4 file newly created for file header ftyp write;
Index information file creating unit: create Amoov box and Bmoov box, described Amoov box and Bmoov box all account for a moov box space size, and its box type is respectively moov and free;
Media data writing unit: the size of fixing mdat box, writes video data in mdat box;
Cycling element: the most alternately write Amoov box and the Bmoov box of establishment, wherein a write moov type and data, another write free type and data.
Video record power-off protection apparatus the most according to claim 5, it is characterised in that comprising:
Second media data writing unit: when the video data size of write mdat box is more than the BoxSize of mdat box, then write new mdat box.
CN201610225402.0A 2016-04-12 2016-04-12 A kind of video record power-off protection method and device Active CN105847724B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610225402.0A CN105847724B (en) 2016-04-12 2016-04-12 A kind of video record power-off protection method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610225402.0A CN105847724B (en) 2016-04-12 2016-04-12 A kind of video record power-off protection method and device

Publications (2)

Publication Number Publication Date
CN105847724A true CN105847724A (en) 2016-08-10
CN105847724B CN105847724B (en) 2018-12-07

Family

ID=56597273

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610225402.0A Active CN105847724B (en) 2016-04-12 2016-04-12 A kind of video record power-off protection method and device

Country Status (1)

Country Link
CN (1) CN105847724B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106935252A (en) * 2017-02-08 2017-07-07 苏州科达科技股份有限公司 A kind of MP4 document generating methods and device
CN109167951A (en) * 2018-09-13 2019-01-08 深圳市信丰伟业科技有限公司 Powered-off fault based on Android framework automobile data recorder can play video method
CN109936715A (en) * 2017-12-19 2019-06-25 华为技术有限公司 A kind of processing method and its relevant device of MP4 file
CN110798730A (en) * 2019-11-14 2020-02-14 深圳市浪涛科技有限公司 MP4 file recording and repairing method
CN110798712A (en) * 2019-11-28 2020-02-14 苏州长风航空电子有限公司 Lightweight compression video packaging method
CN111063380A (en) * 2020-01-02 2020-04-24 南京美乐威电子科技有限公司 MP4 file generation method, processing device, equipment and storage medium
CN111385508A (en) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 Video processing method, device, equipment and storage medium
CN111835993A (en) * 2020-09-16 2020-10-27 深圳市阿达视高新技术有限公司 Damage-proof video storage method, device, equipment and medium
CN111885331A (en) * 2020-07-25 2020-11-03 徐州云创电子科技有限公司 Novel mp4 packaging method for automatic storage of video interruption
CN112732180A (en) * 2020-12-29 2021-04-30 哈尔滨海能达科技有限公司 Information processing method, processing device, electronic equipment and storage medium
CN114374875A (en) * 2021-12-31 2022-04-19 浙江大华技术股份有限公司 MP4 file recording method and device and readable storage medium
CN115589480A (en) * 2022-10-09 2023-01-10 深圳市巨龙创视科技有限公司 MOov-based MP4 video restoration method and system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1642221A (en) * 2004-01-15 2005-07-20 松下电器产业株式会社 Multiplex scheme conversion apparatus
CN1868210A (en) * 2003-10-10 2006-11-22 索尼株式会社 File reproduction device, file reproduction method, file reproduction method program, and recording medium containing the file reproduction method program
CN1881452A (en) * 2005-06-17 2006-12-20 索尼公司 Recording apparatus, recording method, program, recording medium, and data recording medium
US20130064286A1 (en) * 2011-09-14 2013-03-14 Mobitv, Inc. Weighted encoder fragment scheduling
CN103165155A (en) * 2011-12-14 2013-06-19 佳能株式会社 Recording apparatus and control method thereof
CN103688532A (en) * 2011-07-29 2014-03-26 索尼公司 Streaming distribution device and method, streaming receiving device and method, streaming system, program, and recording medium
CN104063447A (en) * 2014-06-17 2014-09-24 惠州华阳通用电子有限公司 Monitoring video file restoring method
CN104253999A (en) * 2009-10-15 2014-12-31 索尼公司 Method and apparatus for transmitting content, method and apparatus for receiving content, method and apparatus for encoding content, method and apparatus for decoding content

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1868210A (en) * 2003-10-10 2006-11-22 索尼株式会社 File reproduction device, file reproduction method, file reproduction method program, and recording medium containing the file reproduction method program
CN1642221A (en) * 2004-01-15 2005-07-20 松下电器产业株式会社 Multiplex scheme conversion apparatus
CN1881452A (en) * 2005-06-17 2006-12-20 索尼公司 Recording apparatus, recording method, program, recording medium, and data recording medium
CN104253999A (en) * 2009-10-15 2014-12-31 索尼公司 Method and apparatus for transmitting content, method and apparatus for receiving content, method and apparatus for encoding content, method and apparatus for decoding content
CN103688532A (en) * 2011-07-29 2014-03-26 索尼公司 Streaming distribution device and method, streaming receiving device and method, streaming system, program, and recording medium
US20130064286A1 (en) * 2011-09-14 2013-03-14 Mobitv, Inc. Weighted encoder fragment scheduling
CN103165155A (en) * 2011-12-14 2013-06-19 佳能株式会社 Recording apparatus and control method thereof
CN104063447A (en) * 2014-06-17 2014-09-24 惠州华阳通用电子有限公司 Monitoring video file restoring method

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106935252A (en) * 2017-02-08 2017-07-07 苏州科达科技股份有限公司 A kind of MP4 document generating methods and device
CN109936715A (en) * 2017-12-19 2019-06-25 华为技术有限公司 A kind of processing method and its relevant device of MP4 file
CN109936715B (en) * 2017-12-19 2021-09-03 华为技术有限公司 MP4 file processing method and related equipment thereof
US11100956B2 (en) 2017-12-19 2021-08-24 Huawei Technologies Co., Ltd. MP4 file processing method and related device
CN109167951A (en) * 2018-09-13 2019-01-08 深圳市信丰伟业科技有限公司 Powered-off fault based on Android framework automobile data recorder can play video method
CN111385508A (en) * 2018-12-28 2020-07-07 广州市百果园信息技术有限公司 Video processing method, device, equipment and storage medium
CN110798730A (en) * 2019-11-14 2020-02-14 深圳市浪涛科技有限公司 MP4 file recording and repairing method
CN110798712A (en) * 2019-11-28 2020-02-14 苏州长风航空电子有限公司 Lightweight compression video packaging method
CN111063380A (en) * 2020-01-02 2020-04-24 南京美乐威电子科技有限公司 MP4 file generation method, processing device, equipment and storage medium
CN111885331A (en) * 2020-07-25 2020-11-03 徐州云创电子科技有限公司 Novel mp4 packaging method for automatic storage of video interruption
CN111835993A (en) * 2020-09-16 2020-10-27 深圳市阿达视高新技术有限公司 Damage-proof video storage method, device, equipment and medium
CN112732180A (en) * 2020-12-29 2021-04-30 哈尔滨海能达科技有限公司 Information processing method, processing device, electronic equipment and storage medium
CN114374875A (en) * 2021-12-31 2022-04-19 浙江大华技术股份有限公司 MP4 file recording method and device and readable storage medium
CN114374875B (en) * 2021-12-31 2024-05-28 浙江大华技术股份有限公司 MP4 file recording method, device and readable storage medium
CN115589480A (en) * 2022-10-09 2023-01-10 深圳市巨龙创视科技有限公司 MOov-based MP4 video restoration method and system

Also Published As

Publication number Publication date
CN105847724B (en) 2018-12-07

Similar Documents

Publication Publication Date Title
CN105847724A (en) Method and apparatus protecting video recording against outage
CN105872484B (en) A kind of abnormal guard method of monitoring video
US11343474B2 (en) Image capture based on action recognition
CN101351845B (en) Recording device, recording method, recording program, imaging device, imaging method, and imaging program
CN106937090A (en) The method and device of a kind of video storage
US9264646B2 (en) Electronic device and video playing method
EP3490194B1 (en) Method and device for playing video
CN103222261B (en) Method in video system based on semantic special effects mode play
CN106027935A (en) Frame-missing-free segmental video-recording system and implementation method
CN104980681A (en) Video acquisition method and video acquisition device
CN106303729A (en) Exchange method based on barrage, interactive device and subscriber equipment
CN107743264A (en) Video recording method and equipment
CN105100716A (en) Safe memory cell used for network video monitoring and system thereof
CN114390209A (en) Photographing method, photographing apparatus, electronic device, and readable storage medium
CN101873456B (en) Video recording data reproduction device on digital video recorder and method thereof
CN111063380A (en) MP4 file generation method, processing device, equipment and storage medium
CN103716573A (en) Video playback method and device
CN110401869A (en) A kind of net cast method, system and electronic equipment and storage medium
US8209328B2 (en) Electronic device and method for seeking file position
CN104954718A (en) Mobile intelligent terminal and image recording method thereof
CN104023179A (en) Imaging control method and equipment
CN104394453B (en) video prerecording method and device
CN109040848A (en) Barrage is put upside down method, apparatus, electronic equipment and storage medium
CN109246468A (en) A kind of list of videos switching method, equipment and storage medium based on educational system
CN107861841A (en) The management method and system that data map in a kind of SSD Cache

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant