anthwlock / untrunc

Restore a truncated mp4/mov. Improved version of ponchio/untrunc
GNU General Public License v2.0
1.9k stars 182 forks source link

Error: unable to find correct codec -> premature end (~0%) #51

Closed xdli16 closed 4 years ago

xdli16 commented 4 years ago

Info: version '71d1a65' using ffmpeg '3.3.4' Info: reading ok.mp4 Info: parsing healthy moov atom ... Composition time offset atom found. Out of order samples possible.

Info: reading mdat from truncated file ... Error: unable to find correct codec -> premature end (~0%) try '-s' to skip unknown sequences

Warning: guessed frame durations of 'mp4a' will probably be wrong! Warning: guessed frame durations of 'avc1' will probably be wrong! Info: Found 0 packets ( mp4a: 0 avc1: 0 avc1-keyframes: 0 ) Info: Duration of mp4a: (0 ms) Info: Duration of avc1: (0 ms) Info: pruned empty 'mp4a' track Info: pruned empty 'avc1' track Info: saving no.mp4_fixed.mp4

xdli16 commented 4 years ago

I repair videos on Windows 10

anthwlock commented 4 years ago

Make sure that no.mp4 actually contains some data (by using hexeditor). If so, please send me the flies (healthy+broken).

How to upload https://wetransfer.com/ offers hosting <2GB files for 7days, without registration. If your files are larger, `untrunc -sh file.mp4` lets you extract the first 200MB. Either post the resulting link here, or send me an email.
xdli16 commented 4 years ago

broken video https://send.firefox.com/download/3435e58b19ddedcf/#XcBGvd1SM2N_s4PiawlK9w healthy video https://send.firefox.com/download/69b3df691c456d40/#f6y_LVdtCPXXajygGKE8mQ

anthwlock commented 4 years ago

What software did you used to create those files? It looks like metadata got packed into avc1 samples.. Do you know something about Hi3518?

anthwlock commented 4 years ago

Btw, the download of the broken 2.1GB file stops at 1.1GB. I tried multiple times and with different browsers. But 1.1GB is probably enough anyway.

xdli16 commented 4 years ago

I use ffmpeg to record m3u8 live link,like ffmpeg -i "http://xxx.m3u8" -vcodec copy -acodec copy -absf aac_adtstoasc "xxx.mp4" I don't know HI3518.

xdli16 commented 4 years ago

I uploaded the broken video files again. This time, I compressed them into multiple compressed packages. If you need, you can download them again https://send.firefox.com/download/06a198da8e19ed01/#OeI7OW2oNO6ztQjEg8fBNg https://send.firefox.com/download/69982cfa1afb86e3/#cJ2koXa_OI0OK_Y82uohDA https://send.firefox.com/download/ed62abaeeb109128/#UUanGayDSUgYu8AySNbS_g

anthwlock commented 4 years ago

Just to make sure.. is the following md5sum correct? a984f3ad141cccdaef5e850e6d96897c no.mp4

xdli16 commented 4 years ago

a984f3ad141cccdaef5e850e6d96897c no.mp4

anthwlock commented 4 years ago

The metadata was packed in nal-units with nal_type=31, fixed with 907fbb59435b96e5c77a90894f1206ec1058f8d7.

Additionally ffmpeg3.4+ failed to decode some mp4a samples, because internal decoder state was not reset after 'gaps' in the audio-stream. These gaps may be caused by network transmission errors. This got fixed with 56aee28f1edf686abaefd31f295130bebd2c9cf1.

Tip When using ffmpeg you can avoid corrupt files by using -f mpegts. This will create .ts instead of .mp4. It also allows you to watch the stream while downloading. Later you can use ffmpeg -i file.ts -c copy file.mp4.