ponchio / untrunc

Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
GNU General Public License v2.0
1.63k stars 230 forks source link

mp4 file generated by untrunc has empty mdat box (tried to recover drone video) #190

Open frostybeard opened 4 years ago

frostybeard commented 4 years ago

So.the.story.is.I.recorded.a.video.using.a.drone.(DJI.Mavic.Mini).and.ended.up.with.a.video.that.had.no.moov.box,.which.was.quite.unfortunate..I.found.a.video.tutorial.on.your.untrunc.tool,.and.decided.to.give.it.a.try..The.file.is.157.MB.and.has.a.big.mdat.box.

What.happened.was.untrunc.seemed.to.be.able.to.generate.a.moov.box.from.the.working.file,.but.didn't.put.anything.into.mdat..I.am.not.sure.why..I.have.not.looked.deeper.into.the.code..I.have.given.hopefully.useful.debug.information.about.the.files.using.AtomicParsley,.which.is.a.good.mp4.file.parser.which.shows.the.structure.of.the.file.

Upon.request.I.can.also.supply.the.videos,.although.they.are.somewhat.large..I.can.share.them.via.Google.Drive.

A.bit.of.info.about.the.file.sizes:.(including.the.generated.file.after.running.untrunc) 592842715.Jun.28.18:02.DJI_0003.MP4...//.broken 157286400.Jul..1.21:26.DJI_0004.MP4.....//.working 3630.Jul..1.22:22.DJI_0004.MP4_fixed.mp4...//.file.generated.by.untrunc

DJI_0004.MP4.is.the.broken.file DJI_0003.MP4.is.a.working.file

AtomicParsley.shows.the.following.structure.in.DJI_0003.MP4: (the.working.file) +++++++++++++++++++++++++++++++++++++++++++++++ AtomicParsley.DJI_0003.MP4.-T.1 Atom.ftyp.@.0.of.size:.28,.ends.@.28 Atom.wide.@.28.of.size:.8,.ends.@.36 .~ Atom.mdat.@.36.of.size:.592804221,.ends.@.592804257 Atom.moov.@.592804257.of.size:.38458,.ends.@.592842715 .....Atom.mvhd.@.592804265.of.size:.108,.ends.@.592804373 .....Atom.udta.@.592804373.of.size:.2048,.ends.@.592806421 .........Atom.©xyz.@.592804381.of.size:.28,.ends.@.592804409 .~ .........Atom.©xsp.@.592804409.of.size:.18,.ends.@.592804427 .~ .........Atom.©ysp.@.592804427.of.size:.18,.ends.@.592804445 .~ .........Atom.©zsp.@.592804445.of.size:.18,.ends.@.592804463 .~ .........Atom.©fpt.@.592804463.of.size:.18,.ends.@.592804481 .~ .........Atom.©fyw.@.592804481.of.size:.20,.ends.@.592804501 .~ .........Atom.©frl.@.592804501.of.size:.18,.ends.@.592804519 .~ .........Atom.©gpt.@.592804519.of.size:.19,.ends.@.592804538 .~ .........Atom.©gyw.@.592804538.of.size:.18,.ends.@.592804556 .~ .........Atom.©grl.@.592804556.of.size:.18,.ends.@.592804574 .~ .........Atom.©rec.@.592804574.of.size:.20,.ends.@.592804594 .~ .........Atom.©res.@.592804594.of.size:.32,.ends.@.592804626 .~ .........Atom.meta.@.592804626.of.size:.256,.ends.@.592804882 .............Atom.hdlr.@.592804638.of.size:.32,.ends.@.592804670 .............Atom.ilst.@.592804670.of.size:.212,.ends.@.592804882 .................Atom.©cmt.@.592804678.of.size:.204,.ends.@.592804882 .....................Atom.data.@.592804686.of.size:.196,.ends.@.592804882 .........Atom.Xtra.@.592804882.of.size:.256,.ends.@.592805138 .~ .........Atom.©uid.@.592805138.of.size:.16,.ends.@.592805154 .~ .........Atom.©mdl.@.592805154.of.size:.32,.ends.@.592805186 .~ .........Atom.©csn.@.592805186.of.size:.48,.ends.@.592805234 .~ .........Atom.©aud.@.592805234.of.size:.40,.ends.@.592805274 .~ .........Atom.©mux.@.592805274.of.size:.128,.ends.@.592805402 .~ .........Atom.©mdt.@.592805402.of.size:.40,.ends.@.592805442 .~ .........Atom.free.@.592805442.of.size:.979,.ends.@.592806421 .....Atom.trak.@.592806421.of.size:.33220,.ends.@.592839641 .........Atom.tkhd.@.592806429.of.size:.92,.ends.@.592806521 .........Atom.edts.@.592806521.of.size:.36,.ends.@.592806557 .............Atom.elst.@.592806529.of.size:.28,.ends.@.592806557 .........Atom.mdia.@.592806557.of.size:.33084,.ends.@.592839641 .............Atom.mdhd.@.592806565.of.size:.32,.ends.@.592806597 .............Atom.hdlr.@.592806597.of.size:.49,.ends.@.592806646 .............Atom.minf.@.592806646.of.size:.32995,.ends.@.592839641 .................Atom.vmhd.@.592806654.of.size:.20,.ends.@.592806674 .................Atom.dinf.@.592806674.of.size:.36,.ends.@.592806710 .....................Atom.dref.@.592806682.of.size:.28,.ends.@.592806710 .........................Atom.alis.@.592806698.of.size:.12,.ends.@.592806710 .................Atom.stbl.@.592806710.of.size:.32931,.ends.@.592839641 .....................Atom.stsd.@.592806718.of.size:.179,.ends.@.592806897 .........................Atom.avc1.@.592806734.of.size:.163,.ends.@.592806897 .............................Atom.avcC.@.592806820.of.size:.77,.ends.@.592806897 .....................Atom.stts.@.592806897.of.size:.24,.ends.@.592806921 .....................Atom.ctts.@.592806921.of.size:.24,.ends.@.592806945 .....................Atom.stsc.@.592806945.of.size:.28,.ends.@.592806973 .....................Atom.stsz.@.592806973.of.size:.16260,.ends.@.592823233 .....................Atom.stco.@.592823233.of.size:.16256,.ends.@.592839489 .....................Atom.stss.@.592839489.of.size:.152,.ends.@.592839641 .....Atom.trak.@.592839641.of.size:.1513,.ends.@.592841154 .........Atom.tkhd.@.592839649.of.size:.92,.ends.@.592839741 .........Atom.mdia.@.592839741.of.size:.1413,.ends.@.592841154 .............Atom.mdhd.@.592839749.of.size:.32,.ends.@.592839781 .............Atom.hdlr.@.592839781.of.size:.49,.ends.@.592839830 .............Atom.minf.@.592839830.of.size:.1324,.ends.@.592841154 .................Atom.gmhd.@.592839838.of.size:.56,.ends.@.592839894 .................Atom.dinf.@.592839894.of.size:.36,.ends.@.592839930 .....................Atom.dref.@.592839902.of.size:.28,.ends.@.592839930 .........................Atom.alis.@.592839918.of.size:.12,.ends.@.592839930 .................Atom.stbl.@.592839930.of.size:.1224,.ends.@.592841154 .....................Atom.stsd.@.592839938.of.size:.32,.ends.@.592839970 .........................Atom.priv.@.592839954.of.size:.16,.ends.@.592839970 .~ .....................Atom.stts.@.592839970.of.size:.24,.ends.@.592839994 .....................Atom.stsc.@.592839994.of.size:.28,.ends.@.592840022 .....................Atom.stsz.@.592840022.of.size:.568,.ends.@.592840590 .....................Atom.stco.@.592840590.of.size:.564,.ends.@.592841154 .....Atom.trak.@.592841154.of.size:.1561,.ends.@.592842715 .........Atom.tkhd.@.592841162.of.size:.92,.ends.@.592841254 .........Atom.edts.@.592841254.of.size:.36,.ends.@.592841290 .............Atom.elst.@.592841262.of.size:.28,.ends.@.592841290 .........Atom.mdia.@.592841290.of.size:.1425,.ends.@.592842715 .............Atom.mdhd.@.592841298.of.size:.32,.ends.@.592841330 .............Atom.hdlr.@.592841330.of.size:.49,.ends.@.592841379 .............Atom.minf.@.592841379.of.size:.1336,.ends.@.592842715 .................Atom.gmhd.@.592841387.of.size:.76,.ends.@.592841463 .................Atom.dinf.@.592841463.of.size:.36,.ends.@.592841499 .....................Atom.dref.@.592841471.of.size:.28,.ends.@.592841499 .........................Atom.alis.@.592841487.of.size:.12,.ends.@.592841499 .................Atom.stbl.@.592841499.of.size:.1216,.ends.@.592842715 .....................Atom.stsd.@.592841507.of.size:.32,.ends.@.592841539 .........................Atom.text.@.592841523.of.size:.16,.ends.@.592841539 .....................Atom.stts.@.592841539.of.size:.24,.ends.@.592841563 .....................Atom.stsc.@.592841563.of.size:.28,.ends.@.592841591 .....................Atom.stsz.@.592841591.of.size:.564,.ends.@.592842155 .....................Atom.stco.@.592842155.of.size:.560,.ends.@.592842715

.~.denotes.an.unknown.atom

Total.size:.592842715.bytes;.88.atoms.total. Media.data:.592804221.bytes;.38494.bytes.all.other.atoms.(0.006%.atom.overhead). Total.free.atom.space:.979.bytes;.0.000%.waste.

AtomicParsley.version:.0.9.6.(utf8)

Movie.duration:.135.469.seconds.(02:15.47).-.35007.60.kbp/sec.bitrate.(=approximate) Low-level.details..Total.tracks:.3 Trk..Type..Handler....................Kind..Lang..Bytes 1....vide..DJI.AVC....................avc1.....592503040 .....34989.82*.kbp/s..135.469.sec..AVC.High.Profile,..Level.4..1920x1080..(8040.macroblocks) 2....meta..DJI.Meta...................priv.....266357 3....text..DJI.Subtitle...............text..```...34816

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ AtomicParsley.shows.this.structure.in.the.broken.file: AtomicParsley.DJI_0004.MP4.-T.1 Atom.ftyp.@.0.of.size:.28,.ends.@.28 Atom.wide.@.28.of.size:.8,.ends.@.36 .~ Atom.mdat.@.36.of.size:.157286364.(0),.ends.@.157286400 .()denotes.length.of.atom.goes.to.End-of-File

.~.denotes.an.unknown.atom

Total.size:.157286400.bytes;.2.atoms.total. Media.data:.157286364.bytes;.36.bytes.all.other.atoms.(0.000%.atom.overhead). Total.free.atom.space:.0.bytes;.0.000%.waste.

AtomicParsley.version:.0.9.6.(utf8)

Low-level.details..Total.tracks:.0 Trk..Type..Handler....................Kind..Lang..Bytes

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Then.finally.in.the.file.generated.by.untrunc,.AtomicParsley.gives.the.following.output:

AtomicParsley.DJI_0004.MP4_fixed.mp4.-T.1 Atom.ftyp.@.0.of.size:.28,.ends.@.28 Atom.moov.@.28.of.size:.3594,.ends.@.3622 .....Atom.mvhd.@.36.of.size:.108,.ends.@.144 .....Atom.udta.@.144.of.size:.2048,.ends.@.2192 .........Atom.©xyz.@.152.of.size:.28,.ends.@.180 .~ .........Atom.©xsp.@.180.of.size:.18,.ends.@.198 .~ .........Atom.©ysp.@.198.of.size:.18,.ends.@.216 .~ .........Atom.©zsp.@.216.of.size:.18,.ends.@.234 .~ .........Atom.©fpt.@.234.of.size:.18,.ends.@.252 .~ .........Atom.©fyw.@.252.of.size:.20,.ends.@.272 .~ .........Atom.©frl.@.272.of.size:.18,.ends.@.290 .~ .........Atom.©gpt.@.290.of.size:.19,.ends.@.309 .~ .........Atom.©gyw.@.309.of.size:.18,.ends.@.327 .~ .........Atom.©grl.@.327.of.size:.18,.ends.@.345 .~ .........Atom.©rec.@.345.of.size:.20,.ends.@.365 .~ .........Atom.©res.@.365.of.size:.32,.ends.@.397 .~ .........Atom.meta.@.397.of.size:.256,.ends.@.653 .............Atom.hdlr.@.409.of.size:.32,.ends.@.441 .............Atom.ilst.@.441.of.size:.212,.ends.@.653 .................Atom.©cmt.@.449.of.size:.204,.ends.@.653 .....................Atom.data.@.457.of.size:.196,.ends.@.653 .........Atom.Xtra.@.653.of.size:.256,.ends.@.909 .~ .........Atom.©uid.@.909.of.size:.16,.ends.@.925 .~ .........Atom.©mdl.@.925.of.size:.32,.ends.@.957 .~ .........Atom.©csn.@.957.of.size:.48,.ends.@.1005 .~ .........Atom.©aud.@.1005.of.size:.40,.ends.@.1045 .~ .........Atom.©mux.@.1045.of.size:.128,.ends.@.1173 .~ .........Atom.©mdt.@.1173.of.size:.40,.ends.@.1213 .~ .........Atom.free.@.1213.of.size:.979,.ends.@.2192 .....Atom.trak.@.2192.of.size:.556,.ends.@.2748 .........Atom.tkhd.@.2200.of.size:.92,.ends.@.2292 .........Atom.edts.@.2292.of.size:.36,.ends.@.2328 .............Atom.elst.@.2300.of.size:.28,.ends.@.2328 .........Atom.mdia.@.2328.of.size:.420,.ends.@.2748 .............Atom.mdhd.@.2336.of.size:.32,.ends.@.2368 .............Atom.hdlr.@.2368.of.size:.49,.ends.@.2417 .............Atom.minf.@.2417.of.size:.331,.ends.@.2748 .................Atom.vmhd.@.2425.of.size:.20,.ends.@.2445 .................Atom.dinf.@.2445.of.size:.36,.ends.@.2481 .....................Atom.dref.@.2453.of.size:.28,.ends.@.2481 .........................Atom.alis.@.2469.of.size:.12,.ends.@.2481 .................Atom.stbl.@.2481.of.size:.267,.ends.@.2748 .....................Atom.stsd.@.2489.of.size:.179,.ends.@.2668 .........................Atom.avc1.@.2505.of.size:.163,.ends.@.2668 .............................Atom.avcC.@.2591.of.size:.77,.ends.@.2668 .....................Atom.stts.@.2668.of.size:.16,.ends.@.2684 .....................Atom.stsc.@.2684.of.size:.28,.ends.@.2712 .....................Atom.stsz.@.2712.of.size:.20,.ends.@.2732 .....................Atom.stco.@.2732.of.size:.16,.ends.@.2748 .....Atom.trak.@.2748.of.size:.409,.ends.@.3157 .........Atom.tkhd.@.2756.of.size:.92,.ends.@.2848 .........Atom.mdia.@.2848.of.size:.309,.ends.@.3157 .............Atom.mdhd.@.2856.of.size:.32,.ends.@.2888 .............Atom.hdlr.@.2888.of.size:.49,.ends.@.2937 .............Atom.minf.@.2937.of.size:.220,.ends.@.3157 .................Atom.gmhd.@.2945.of.size:.56,.ends.@.3001 .................Atom.dinf.@.3001.of.size:.36,.ends.@.3037 .....................Atom.dref.@.3009.of.size:.28,.ends.@.3037 .........................Atom.alis.@.3025.of.size:.12,.ends.@.3037 .................Atom.stbl.@.3037.of.size:.120,.ends.@.3157 .....................Atom.stsd.@.3045.of.size:.32,.ends.@.3077 .........................Atom.priv.@.3061.of.size:.16,.ends.@.3077 .~ .....................Atom.stts.@.3077.of.size:.16,.ends.@.3093 .....................Atom.stsc.@.3093.of.size:.28,.ends.@.3121 .....................Atom.stsz.@.3121.of.size:.20,.ends.@.3141 .....................Atom.stco.@.3141.of.size:.16,.ends.@.3157 .....Atom.trak.@.3157.of.size:.465,.ends.@.3622 .........Atom.tkhd.@.3165.of.size:.92,.ends.@.3257 .........Atom.edts.@.3257.of.size:.36,.ends.@.3293 .............Atom.elst.@.3265.of.size:.28,.ends.@.3293 .........Atom.mdia.@.3293.of.size:.329,.ends.@.3622 .............Atom.mdhd.@.3301.of.size:.32,.ends.@.3333 .............Atom.hdlr.@.3333.of.size:.49,.ends.@.3382 .............Atom.minf.@.3382.of.size:.240,.ends.@.3622 .................Atom.gmhd.@.3390.of.size:.76,.ends.@.3466 .................Atom.dinf.@.3466.of.size:.36,.ends.@.3502 .....................Atom.dref.@.3474.of.size:.28,.ends.@.3502 .........................Atom.alis.@.3490.of.size:.12,.ends.@.3502 .................Atom.stbl.@.3502.of.size:.120,.ends.@.3622 .....................Atom.stsd.@.3510.of.size:.32,.ends.@.3542 .........................Atom.text.@.3526.of.size:.16,.ends.@.3542 .....................Atom.stts.@.3542.of.size:.16,.ends.@.3558 .....................Atom.stsc.@.3558.of.size:.28,.ends.@.3586 .....................Atom.stsz.@.3586.of.size:.20,.ends.@.3606 .....................Atom.stco.@.3606.of.size:.16,.ends.@.3622 Atom.mdat.@.3622.of.size:.8,.ends.@.3630

.~.denotes.an.unknown.atom

Total.size:.3630.bytes;.85.atoms.total. Media.data:.0.bytes;.3630.bytes.all.other.atoms.(100.000%.atom.overhead). Total.free.atom.space:.979.bytes;.26.970%.waste..Padding.available:.979.bytes.

AtomicParsley.version:.0.9.6.(utf8)

Movie.duration:.0.000.seconds.(0:0.00).-.-nan.kbp/sec.bitrate.(=approximate) Low-level.details..Total.tracks:.3 Trk..Type..Handler....................Kind..Lang..Bytes 1....vide..DJI.AVC....................avc1.....0 .....-nan*.kbp/s..0.000.sec..AVC.High.Profile,..Level.4..1920x1080..(8040.macroblocks) 2....meta..DJI.Meta...................priv.....0 3....text..DJI.Subtitle...............text..```...0

frostybeard commented 4 years ago

Oh no, The editor here removed all the tabs from AtomicParsley. Now it will be difficult to see the file structure.

frostybeard commented 4 years ago

GitHub seems to have a lot of surprises when editing a comment....

nloveladyallen commented 4 years ago

I had the same issue and this program restored the video: http://djifix.live555.com/