Closed voidgraphics closed 4 years ago
The assertion fails if the very first chunk has size less than 32 bytes.
I think this assertion is reasonable.. probably current_mdat_->contentStart()
is wrong.
Can you send me the files (reference+truncated)?
Of course. They are rather large (over 70gb combined), what would be the best way to get them in your hands?
For the broken file just send me the first 100mb (head -c 100M)
For the healthy file, it is important that the moov
atom is included in the sample.
If untrunc -ia good.mp4
shows mdat
before moov
, please use ffmpeg -i good.mp4 -movflags faststart -c copy good2.mp4
first.
Then send me the first 60mb of both good.mp4 and good2.mp4.
mdat
did show just before moov
, but running the ffmpeg command seems to fail:
ffmpeg -i good.mp4 -movflags faststart -c copy good2.mp4
ffmpeg version git-2020-03-11-36aaee2 Copyright (c) 2000-2020 the FFmpeg developers
built with gcc 9.2.1 (GCC) 20200122
configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf
libavutil 56. 42.100 / 56. 42.100
libavcodec 58. 75.100 / 58. 75.100
libavformat 58. 41.100 / 58. 41.100
libavdevice 58. 9.103 / 58. 9.103
libavfilter 7. 77.100 / 7. 77.100
libswscale 5. 6.100 / 5. 6.100
libswresample 3. 6.100 / 3. 6.100
libpostproc 55. 6.100 / 55. 6.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001a755deac80] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1001
[mov,mp4,m4a,3gp,3g2,mj2 @ 000001a755deac80] st: 0 edit list 1 Cannot find an index entry before timestamp: 1001. [mov,mp4,m4a,3gp,3g2,mj2 @ 000001a755deac80] Drop frame is only allowed with 30000/1001 or 60000/1001 FPS
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'good.mp4':
Metadata:
major_brand : XAVC
minor_version : 16785407
compatible_brands: XAVCmp42iso2
creation_time : 2020-03-07T13:01:38.000000Z
Duration: 01:24:02.04, start: 0.000000, bitrate: 58213 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 56422 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Video Media Handler
encoder : AVC Coding
Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, stereo, s16, 1536 kb/s (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Sound Media Handler
Stream #0:2(und): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Time Code Media Handler
Stream #0:3(und): Data: none (rtmd / 0x646D7472), 245 kb/s (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Timed Metadata Media Handler
timecode : 00:00:00:00
[mp4 @ 000001a756c0cac0] Could not find tag for codec pcm_s16be in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
Last message repeated 1 times
It does create the good2.mp4 file, but it is empty (0 bytes).
Here are the first 60mb of the good file, and the first 100mb of the bad file.
Thanks again for your help.
Try to use .mov
as extension for the output file.
If this still fails, you can try untrunc -ms good.mp4
. It creates a file good.mp4_streamable.mp4
, for the same purpose.
Using .mov worked! Here is the file: https://send.firefox.com/download/feca220533780d84/#O7q80OTxOvzUSd50Xx14UQ
It says This link has expired
. Maybe send me an email or increase download-limit?
Have you had a chance to take a look at it? Sorry to bother. I'll make use of your PayPal link to thank you properly for your help, if that's okay.
Will look into it soon, is it time critical for some reason?
Nothing super crazy, but I do have a rather large crowd of people waiting for their studying material 😄
I have donated a little something to thank you for your help thus far. I do think your open source tool is a godsend - all solutions I have found were super expensive. I can't afford much but I will try to donate again if you can help at least point me in the right direction so I can get this video to these people.
Cheers 👍
Thank you!
it looks like ffmpeg shuffles the streams in such a way that original chunk sizes get lost.
So can you just send me the last ~10mb of good.mp4?
Please post (or send me) the output of untrunc -v -i good.mp4
untrunc -v -i good.MP4
Info: version 'ebeb1a1' using ffmpeg '3.3.4'
Info: reading good.MP4
Info: parsing healthy moov atom ...
Composition time offset atom found. Out of order samples possible.
ftyp_ = 'XAVC'
detected 'XAVC', deactivating 'g_strict_nal_frame_check'
[mov,mp4,m4a,3gp,3g2,mj2 @ 00000000045fc880] Drop frame is only allowed with 30000/1001 or 60000/1001 FPS
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'good.MP4':
Metadata:
major_brand : XAVC
minor_version : 16785407
compatible_brands: XAVCmp42iso2
creation_time : 2020-03-07T13:01:38.000000Z
Duration: 01:24:02.04, start: 0.000000, bitrate: 58213 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 56422 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Video Media Handler
encoder : AVC Coding
Stream #0:1(und): Audio: pcm_s16be (twos / 0x736F7774), 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Sound Media Handler
Stream #0:2(und): Data: none (tmcd / 0x64636D74) (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Time Code Media Handler
Stream #0:3(und): Data: none (rtmd / 0x646D7472), 245 kb/s (default)
Metadata:
creation_time : 2020-03-07T13:01:38.000000Z
handler_name : Timed Metadata Media Handler
timecode : 00:00:00:00
found avcC after: 102
remaining len:169
parsing avcC ...
len_sps: 52
decoding SPS ...
log2_max_frame_num: 6
avcC got decoded
assuming constant duration of 1001 for 'avc1' (x151110)
assuming constant duration of 1 for 'twos' (x242017920)
assuming constant duration of 1001 for 'rtmd' (x151110)
tracks:
[0] vide by 'Video Media Handler' (avc1) <video, h264>
[1] soun by 'Sound Media Handler' (twos) <audio, pcm_s16be>
[2] tmcd by 'Time Code Media Handler' (tmcd) <data, none>
[3] meta by 'Timed Metadata Media Handler' (rtmd) <data, none>
ftyp [0, 28]
uuid [28, 148]
mdat [184, 36687576904]
moov [36687577088, 1674672]
-mvhd "movie header" [36687577096, 108]
Timescale: 90000 Duration: 453783600
-trak [36687577204, 1511843]
--tkhd [36687577212, 92]
Trak: 1 Duration: 453783330
--edts [36687577304, 36]
---elst [36687577312, 28]
--mdia [36687577340, 1511655]
---mdhd "media header" [36687577348, 32]
Timescale: 30000 Duration: 151261110
---hdlr [36687577380, 52]
Type: vide
---minf "media information" [36687577432, 1511563]
----vmhd [36687577440, 20]
----dinf [36687577460, 36]
-----dref [36687577468, 28]
Entries: 1
----stbl [36687577496, 1511499]
-----stsd "sample description" [36687577504, 271]
Entries: 1 codec: avc1
-----stts "sample to decode time" [36687577775, 24]
Entries: 1
samples: 151110 for: 1001
-----ctts "sample to composition time" [36687577799, 805936]
-----stsc "sample to chunk" [36688383735, 28]
Entries: 1
chunk: 1 nsamples: 15 id: 1
-----stsz "sample to size" [36688383763, 604460]
Sample size: 0 Entries: 151110
Size 1513714
Size 82180
Size 78775
Size 235890
Size 96773
Size 95161
Size 321725
Size 115889
Size 114864
Size 360632
-----co64 "chunk to offset 64" [36688988223, 80608]
Entries: 10074
chunk: 15556
chunk: 4077607
chunk: 7391297
chunk: 10914466
chunk: 14607055
chunk: 18245674
chunk: 21875817
chunk: 25508714
chunk: 29138083
chunk: 32765552
-----stss "sync samples" [36689068831, 20164]
Entries: 5037
Keyframe: 1
Keyframe: 31
Keyframe: 61
Keyframe: 91
Keyframe: 121
Keyframe: 151
Keyframe: 181
Keyframe: 211
Keyframe: 241
Keyframe: 271
--uuid [36689088995, 52]
-trak [36689089047, 81092]
--tkhd [36689089055, 92]
Trak: 2 Duration: 453783600
--edts [36689089147, 36]
---elst [36689089155, 28]
--mdia [36689089183, 80904]
---mdhd "media header" [36689089191, 32]
Timescale: 48000 Duration: 242017920
---hdlr [36689089223, 52]
Type: soun
---minf "media information" [36689089275, 80812]
----smhd [36689089283, 16]
----dinf [36689089299, 36]
-----dref [36689089307, 28]
Entries: 1
----stbl [36689089335, 80752]
-----stsd "sample description" [36689089343, 52]
Entries: 1 codec: twos
-----stts "sample to decode time" [36689089395, 24]
Entries: 1
samples: 242017920 for: 1
-----stsc "sample to chunk" [36689089419, 40]
Entries: 2
chunk: 1 nsamples: 24024 id: 1
chunk: 10074 nsamples: 24168 id: 1
-----stsz "sample to size" [36689089459, 20]
Sample size: 4 Entries: 242017920
-----co64 "chunk to offset 64" [36689089479, 80608]
Entries: 10074
chunk: 3966151
chunk: 7279841
chunk: 10803010
chunk: 14495599
chunk: 18134218
chunk: 21764361
chunk: 25397258
chunk: 29026627
chunk: 32654096
chunk: 36286029
--uuid [36689170087, 52]
-trak [36689170139, 490]
--tkhd [36689170147, 92]
Trak: 3 Duration: 453783330
--edts [36689170239, 36]
---elst [36689170247, 28]
--mdia [36689170275, 302]
---mdhd "media header" [36689170283, 32]
Timescale: 30000 Duration: 151261110
---hdlr [36689170315, 56]
Type: tmcd
---minf "media information" [36689170371, 206]
----nmhd [36689170379, 12]
----dinf [36689170391, 36]
-----dref [36689170399, 28]
Entries: 1
----stbl [36689170427, 150]
-----stsd "sample description" [36689170435, 50]
Entries: 1 codec: tmcd
-----stts "sample to decode time" [36689170485, 24]
Entries: 1
samples: 1 for: 151261110
-----stsc "sample to chunk" [36689170509, 28]
Entries: 1
chunk: 1 nsamples: 1 id: 1
-----stsz "sample to size" [36689170537, 20]
Sample size: 4 Entries: 1
-----stco "chunk to offset" [36689170557, 20]
Entries: 1
chunk: 192
--uuid [36689170577, 52]
-trak [36689170629, 81085]
--tkhd [36689170637, 92]
Trak: 4 Duration: 453783330
--tref [36689170729, 20]
---cdsc [36689170737, 12]
--edts [36689170749, 36]
---elst [36689170757, 28]
--mdia [36689170785, 80877]
---mdhd "media header" [36689170793, 32]
Timescale: 30000 Duration: 151261110
---hdlr [36689170825, 61]
Type: meta
---minf "media information" [36689170886, 80776]
----nmhd [36689170894, 12]
----dinf [36689170906, 36]
-----dref [36689170914, 28]
Entries: 1
----stbl [36689170942, 80720]
-----stsd "sample description" [36689170950, 32]
Entries: 1 codec: rtmd
-----stts "sample to decode time" [36689170982, 24]
Entries: 1
samples: 151110 for: 1001
-----stsc "sample to chunk" [36689171006, 28]
Entries: 1
chunk: 1 nsamples: 15 id: 1
-----stsz "sample to size" [36689171034, 20]
Sample size: 1024 Entries: 151110
-----co64 "chunk to offset 64" [36689171054, 80608]
Entries: 10074
chunk: 196
chunk: 4062247
chunk: 7375937
chunk: 10899106
chunk: 14591695
chunk: 18230314
chunk: 21860457
chunk: 25493354
chunk: 29122723
chunk: 32750192
--uuid [36689251662, 52]
-uuid [36689251714, 46]
meta [36689251760, 1514]
created dummy track 'free'
Assertion failed!
Program: H:\untrunc_x64\untrunc.exe
File: src/mp4.cpp, Line 557
Expression: off - current_mdat_->contentStart() >= pat_size_ / 2
And here is the last 10mb https://www.dropbox.com/s/ita4gobp3v14n1y/good-tail-10M.mp4?dl=0
Hope it works now.
The very first chunk was indeed too small, a tmcd
with 4 bytes.
With the current solution the tmcd
of the broken file is not recovered, but I don't think it is a problem.
Thank you, it works!
Hello! Thank you very much for this tool.
I seem to have a problem when running it:
Do you have any ideas what might be going wrong? The reference file does play fine.
Thank you very much for your time.