ponchio / untrunc Goto Github PK
View Code? Open in Web Editor NEWRestore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
License: GNU General Public License v2.0
Restore a damaged (truncated) mp4, m4v, mov, 3gp video. Provided you have a similar not broken video.
License: GNU General Public License v2.0
I am running 12.04 x64. It compiled fine (one warning about a deprecated declaration).
When I try it with untrunc, I get an mp4_fixed file with only audio and no video track. The error is:
[aac @ 0xd578a0] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0xd578a0] Not evaluating a further program_config_element as this construct is dubious at best.
[aac @ 0xd578a0] Number of scalefactor bands in group (52) exceeds limit (49).
Begin: ffffffffcf7ca8ff 2fce074b
Invalid length. -1094995529. Wrong match in track: 1
Any help? The reference video plays fine in vlc and movie player. The broken movie is from a recovery off a wiped SD card. Both recorded on a Samsung i777 phone.
Regards,
Gearhead
The old code works fine, but the new code has this error:
untrunc: track.cpp:124: int Codec::getLength(unsigned char*, int): Assertion `length + 4 < maxlength' failed.
Program received signal SIGABRT, Aborted.
0x00007ffff620a425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) bt
#0 0x00007ffff620a425 in raise () from /lib/x86_64-linux-gnu/libc.so.6
#1 0x00007ffff620db8b in abort () from /lib/x86_64-linux-gnu/libc.so.6
#2 0x00007ffff62030ee in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#3 0x00007ffff6203192 in __assert_fail () from /lib/x86_64-linux-gnu/libc.so.6
#4 0x0000000000403aa2 in Codec::getLength(unsigned char*, int) ()
#5 0x000000000040f632 in Mp4::repair(std::string) ()
#6 0x0000000000403130 in main ()
I was trying to process a 4GB file, and had the following error occur:
Reading: /mnt/external/S1360001.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/external/S1360001.MP4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp42avc1
creation_time : 2014-07-24 11:28:08
Duration: 00:00:37.54, start: 0.000000, bitrate: 25176 kb/s
Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25054 kb/s, 50 fps, 50 tbr, 180k tbn, 100 tbc
Metadata:
creation_time : 2014-07-24 11:28:08
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 125 kb/s
Metadata:
creation_time : 2014-07-24 11:28:08
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
I was processing on a laptop with 4GB RAM and a 4GB swap file. I then added an additional 4GB of swap and the process didn't get the error. (It did get a segfault, but I'll post a separate issue for that).
Thus, I think that the entire file being repaired may be stored in memory multiple times. It would be great if this could be changed to streaming data to/from disk.
I build ffmpeg(2.7.1) on snow leopard following these
https://trac.ffmpeg.org/wiki/CompilationGuide/MacOSX
It has been build successfully generated following dylibs.
/usr/local/Cellar/ffmpeg/2.7.1/bin/ffmpeg
ffmpeg version 2.7.1 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.2.1 (GCC) (Apple Inc. build 5666) (dot 3)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.7.1 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=gcc-4.2 --host-cflags= --host-ldflags= --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-libfreetype --enable-libvorbis --enable-libvpx --enable-libfaac --enable-libass --enable-ffplay --enable-libfdk-aac --enable-libopus --enable-libquvi --enable-nonfree --enable-vda
libavutil 54. 27.100 / 54. 27.100
libavcodec 56. 41.100 / 56. 41.100
libavformat 56. 36.100 / 56. 36.100
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 16.101 / 5. 16.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.100 / 1. 2.100
libpostproc 53. 3.100 / 53. 3.100
but when in build my source code using qmake &&make it gives error
"_av_register_all", referenced from:
and warings
ld: warning: in /usr/local/lib/libavcodec.56.41.100.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavdevice.56.4.100.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavfilter.5.16.101.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavformat.56.36.100.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavutil.54.27.100.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libswscale.3.1.101.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
kindly tell me what is the problem with this compilation.
I tried with lower version of ffmpeg but same issue is there
Thanks
Trying to fix a corrupted GoPro MP4 file 2k7 but luckily the device limits file size to 4GB (the file in question is 1.4GB).
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1006420] Non-increasing DTS in stream 3: packet 2 with DTS 0, packet 3 with DTS 0
...
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x1006420] Non-increasing DTS in stream 3: packet 63 with DTS 0, packet 64 with DTS 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GP018642.MP4':
Metadata:
major_brand : mp41
minor_version : 538120216
compatible_brands: mp41
creation_time : 2016-04-08 15:57:16
Duration: 00:02:57.05, start: 0.000000, bitrate: 45106 kb/s
Stream #0.0(eng): Video: h264 (High), yuvj420p, 1920x1440 [PAR 1:1 DAR 4:3], 44959 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
Metadata:
creation_time : 2016-04-08 15:57:16
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, fltp, 127 kb/s
Metadata:
creation_time : 2016-04-08 15:57:16
Stream #0.2(eng): Data: tmcd / 0x64636D74
Metadata:
creation_time : 2016-04-08 15:57:16
Stream #0.3(eng): Data: fdsc / 0x63736466, 9 kb/s
Metadata:
creation_time : 2016-04-08 15:57:16
avc1: failed for not particular reason
mp4a: Success because of large s value
[aac @ 0x10099a0] channel element 2.3 is not allocated
Found 0 packets
Hey, I have a very large (363GB) .mov file with a corrupted header. If I run untrunc against a valid file from the same app it quits with "invalid offset in trunk".
I have tried to debug the issue by printing the values from the if statement:
offsets size: 15784320
i: 1148160
offset: -2117294592
mdat start: 40
mdat length: 28970628568
With the offset being negative the comparison obviously fails. Any ideas?
When I try to compile revision 07be275 on my system (ffmpeg 2.8.6), I get some deprecation warnings, and finally:
track.cpp: In member function ‘int Codec::getLength(unsigned char*, int)’:
track.cpp:204:40: error: ‘avcodec_alloc_frame’ was not declared in this scope
AVFrame *frame = avcodec_alloc_frame();
^
It seems that the function is now named av_frame_alloc
, when I replace it in the code, the build works.
Similar problems will probably happen in the future if the deprecation warnings are not taken care of. See the full build output.
i was unable to tell which license is this code released under. also i made a pkgbuild for arch linux users: https://aur.archlinux.org/packages/untrunc-git/
Hi,
I can compile (apparently) succesfully untrunc, but then when I try to repair a mp4 I get:
elijah@seldon:~/untrunc$ ./untrunc 22340001.mp4 22430004.mp4
Reading: 22340001.mp4
untrunc: atom.cpp:52: void Atom::parse(File&): Assertion `file.pos() == start + length' failed.
Aborted (core dumped)
Thanks for your help!
ps: I am on a 64bits machine, I had to modify the makefile to point to the correct libavformat libavutil libavcodec
I have a number of files that are truncated due to my Sony Action camera having a motherboard issue that saw it turn off randomly when on my bike. They are of either the two file types below (first in "PRO" mode (high bitrate) and the other not)..
`
untrunc C0017.MP4 C0001.MP4
Reading: C0017.MP4
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'C0017.MP4':
Metadata:
major_brand : XAVC
minor_version : 16785407
compatible_brands: XAVCmp42iso2
creation_time : 2015-11-01 06:36:36
Duration: 00:12:26.88, start: 0.000000, bitrate: 51959 kb/s
Stream #0.0(und): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 50011 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc
Metadata:
creation_time : 2015-11-01 06:36:36
Stream #0.1(und): Audio: pcm_s16be, 48000 Hz, 2 channels, s16, 1536 kb/s
Metadata:
creation_time : 2015-11-01 06:36:36
Stream #0.2(und): Data: rtmd / 0x646D7472, 409 kb/s
Metadata:
creation_time : 2015-11-01 06:36:36
Invalid offset in track!
untrunc MAH02067.MP4 MAH02068.MP4
Reading: MAH02067.MP4
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MAH02067.MP4':
Metadata:
major_brand : MSNV
minor_version : 22675568
compatible_brands: MSNVmp42isom
creation_time : 2015-11-01 01:09:37
Duration: 00:00:37.44, start: 0.000000, bitrate: 25108 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 24976 kb/s, 50 fps, 50 tbr, 50k tbn, 100 tbc
Metadata:
creation_time : 2015-11-01 01:09:37
Stream #0.1(und): Audio: aac, 48000 Hz, stereo, s16, 127 kb/s
Metadata:
creation_time : 2015-11-01 01:09:37
Failed to parse atoms in truncated file
`
I did a git clone and built in my /tmp directory and that's since been cleaned, so not sure what version. I built untrunc a few weeks ago.
I'm trying to compile untrunc for windows. I've been successful in using cygwin to do this but not using mingw-w64 or using cross compilation. I keep getting endian.h errors and when I try to include them or their library I get double declaration errors. Any suggestions ? Thank you.
I'm processing a large (~4GB) file which has had the beginning truncated.
I get the following output:
Reading: /mnt/external/S1360001.MP4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/external/S1360001.MP4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp42avc1
creation_time : 2014-07-24 11:28:08
Duration: 00:00:37.54, start: 0.000000, bitrate: 25176 kb/s
Stream #0.0(eng): Video: h264 (High), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 25054 kb/s, 50 fps, 50 tbr, 180k tbn, 100 tbc
Metadata:
creation_time : 2014-07-24 11:28:08
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 125 kb/s
Metadata:
creation_time : 2014-07-24 11:28:08
Begin: 2 9100000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
....
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 211a4bbd fffffffffffffffe: found as mp4a
Begin: 211a4ff6 fffffffffffffffe: found as mp4a
Begin: 211a5475 ffffffff9a0cc844: found as mp4a
Begin: 211a4eff ffffffffeffffffe: found as mp4a
Begin: 211a4dbf 7ffffffe: found as mp4a
Begin: 211a4ffb fffffffffffffffe: found as mp4a
Begin: 211a4f7f ffffffffdf7ffffe: found as mp4a
Begin: 211a4f9f fffffffffffffffe: found as mp4a
Begin: 211a4ffb ffffffffffbffffe: found as mp4a
Begin: 211a4eff fffffffffffffffe: found as mp4a
Begin: 211a4ef7 7ffffffe: found as mp4a
Begin: 211a4ffd ffffffffffbffffe: found as mp4a
Begin: 211a4dfd ffffffffffbffffe: found as mp4a
Begin: 211a4fdd 7f7ffffe: found as mp4a
Begin: 211a4dbd fffffffffffffffe: found as mp4a
Begin: 211a4ffd ffffffffbffffffe: found as mp4a
Begin: 211a4ffd ffffffffdffffffe: found as mp4a
Begin: 211a4fb3 fffffffffffffffe: found as mp4a
Begin: 211a49ff ffffffffb7fffffe: found as mp4a
Begin: 211a4ffe fffffffffdfffffe: found as mp4a
Begin: 211a4c93 ffffffffbffffffa: found as mp4a
Begin: 211a4ef0 6ffffffa: found as mp4a
Begin: 211a4bff fffffffffffffffe: found as mp4a
Begin: 211a49f5 fffffffffffffffe: found as mp4a
Begin: 2 9100000Nal type: 9
: found as avc1
Begin: 2 9300000Nal type: 9
: found as avc1
....
Begin: 2 9300000Nal type: 9
: found as avc1
Begin: 211a4fe7 6f37f7fe: found as mp4a
Begin: 211a4bfb 6a27f1be: found as mp4a
Begin: 211a4ff9 682ff7fe: found as mp4a
Begin: 211a4ffd ffffffffeb3ff7fe: found as mp4a
Begin: 211a4bff ffffffffe3bffffe: found as mp4a
Begin: 211a4fde 6fbffffe: found as mp4a
Begin: 211a4fde ffffffffefbffffe: found as mp4a
Begin: 211a4ffe ffffffffffbffffe: found as mp4a
Begin: 211a4fde fffffffffffffffe: found as mp4a
Begin: 211a4fdf fffffffffffffffe: found as mp4a
Begin: 211a4fdf ffffffffbffffffe: found as mp4a
Begin: 211a54cd ffffffffa5a2a340: found as mp4a
Begin: 211a4fff fffffffffefffffe: found as mp4a
Begin: 211a4bff 3fbffffe: found as mp4a
Begin: 211a4fff 7fbffffe: found as mp4a
Begin: 211a4fdc 7bbffffe: found as mp4a
Begin: 211a4fdc 7eeffffe: found as mp4a
Begin: 211a4fee 3ffffffe: found as mp4a
Begin: 211a4ffd 7ebffffe: found as mp4a
Begin: 211a4fdd 6ffffffe: found as mp4a
Begin: 211a4ddb ffffffffef7ffffe: found as mp4a
Begin: 211a4fdf fffffffffffffffe: found as mp4a
Begin: 211a4fd5 fffffffffffffffe: found as mp4a
Begin: 211a4dfd ffffffffbffff7fe: found as mp4a
Begin: 2 9100000Nal type: 9
: found as avc1
Segmentation fault (core dumped)
(That's after about 100,000 lines of output)
Ubuntu 12.04.03 x64 in VMware 10
When trying to fix the file this error appears:
untrunc: track.cpp:178: void Track::parse(Atom*, Atom*): Assertion `times.size() == sizes.size()' failed.
Tried with both the automatic and manual libav installation, same error... There were a few warnings during compilation, of course, as stated by others.
What should I do? Or... What does this error mean, because I'm not really sure here, I'm pretty much a beginner in C++. Thanks in advance, and I'll make sure to donate for your work when the trouble with this video is resolved!
P.S. If you're interested, here's the whole output. I used a big (602MB) working sample here, but I also have a very small working sample, giving me the same error. The broken file is missing the moov atom due to the recording program hanging the PC entirely when trying to stop the process (will make sure not to use OBS next time, until it goes out of beta!).
Reading: broadcast.mp4
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'broadcast.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
creation_time : 2013-09-27 21:50:05
encoder : Open Broadcaster Software v0.57b
Duration: 01:08:36.26, start: 0.000000, bitrate: 1170 kb/s
Stream #0.0(eng): Audio: aac, 48000 Hz, stereo, s16, 160 kb/s
Metadata:
creation_time : 2013-09-27 21:50:05
Stream #0.1(und): Video: h264 (High), yuv420p, 1280x720, 1000 kb/s, 30 fps, 30 tbr, 1k tbn, 2k tbc
Metadata:
creation_time : 2013-09-27 21:50:05
untrunc: track.cpp:178: void Track::parse(Atom*, Atom*): Assertion `times.size() == sizes.size()' failed.
Aborted (core dumped)
Edit: okay, I've tried to comment the assertions out and all I got was a 70 kb file with seemingly one frame and 1 second of audio. I also tried to intentionally produce a broken video from my phone and trying it on there but there were no assertion errors, and the result was a full file. I guess it's that this particular case of videos is not yet supported... Should I send them to you so you can look into it manually? Thanks again.
Issue: hardcoded limits too low
I was able to recover a 4K video from my Samsung Note3.
There was more audio (3min) than video (27s) in the file which might explain why the phone was unable to finalize it. Luckily for me the 27seconds of video involved the important part.
My initial attempts appeared to run well but resulted in a very short file with only a few seconds of video.
In order to recover the video and audio in the file I had to debug the application:
add to untrunc.pro :
CONFIG +=debug_and_release
which led me to a simple issue - a hardcoded maxlength value wasn't large enough.
make these numeric changes to mp4.cpp:
- if(maxlength > 800000) maxlength = 800000;
+ if(maxlength > 200000000) maxlength = 200000000;
and:
- if(length < -1 || length > 800000) {
+ if(length < -1 || length > 200000000) {
These values worked for me but there should really be a command line option to set this value.
Note: I'm using a 64bit Linux Mint system. libav-0.8.17 qt4.8.6 QtCreator 3.4.0
In case of H264 in some cases it contais I,B,P frames so PTS is not always continous.
In this case i am not able to calculate correct DTS and PTS .So there are some problm in audio and video of .MOV file.
Kindly help me.
thanks
I can do it after brew install ffmpeg --with-libvpx
but not just with brew install libvpx
. Not sure what exactly is blocking.
The error message was
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
track.cpp:40:10: fatal error: 'libavcodec/avcodec.h' file not found
#include "libavcodec/avcodec.h"
track.cpp: In member function 'void Track::parse(Atom_, Atom_)':
track.cpp:211:47: error: 'avcodec_open' was not declared in this scope
if(avcodec_open(codec.context, codec.codec)<0)
^
Commented out 211-212
Hi there, I love your tool, thank you so much.
I have to recover several thousand videos, all the same format, with all the same problem.
untrunc works, but only partially recovers them (stops short for some reason). I believe all the info is in the "corrupt" video, it's size is identical to its correct counterpart.
Is there any possibility that there is a solution to this? It would be incredible if there was.
Below is an example:
Good video:
http://9bf51cec151cfb53116c-b11226a7bb6a3627cdbba551c94163e6.r34.cf2.rackcdn.com/good.mp4
Bad video:
http://9bf51cec151cfb53116c-b11226a7bb6a3627cdbba551c94163e6.r34.cf2.rackcdn.com/bad.mp4
untrunc good.mp4 bad.mp4
avc1: Match with 0 header
Nal type: 5
Length for first packet = 16842 / 800000
avc1: failed for not particular reason
mp4a: Success because of large s value
[aac @ 0x2ad2a00] Reserved bit set.
Invalid length. -1094995529. Wrong match in track: 1
Found 5423 packets
The file to be fixed is 55MB. The output file is only 408KB and won't play in QuickTime ("could not be opened. An unknown error occurred (-12842)").
I used @gavvvr's avcodec-open2
fix when compiling untrunc
Reading: /vagrant/videoplayback.mp4
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/vagrant/videoplayback.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2012-07-16 05:37:19
Duration: 00:09:56.28, start: 0.000000, bitrate: 475 kb/s
Stream #0.0(und): Video: h264 (Constrained Baseline), yuv420p, 480x360, 376 kb/s, 25 fps, 25 tbr, 50 tbn, 50 tbc
Metadata:
creation_time : 1970-01-01 00:00:00
Stream #0.1(und): Audio: aac, 44100 Hz, stereo, fltp, 96 kb/s
Metadata:
creation_time : 2012-07-16 05:37:20
Begin: 900 65888400Nal type: 5
: found as avc1
Begin: 2c9 419a44a2Nal type: 1
: found as avc1
Begin: 765 419a8813Nal type: 1
: found as avc1
Begin: a79 419acc13Nal type: 1
: found as avc1
Begin: 4cd 19f0ed4Nal type: 1
: found as avc1
Begin: e79 419b3413Nal type: 1
: found as avc1
Begin: 10ed 419b7813Nal type: 1
: found as avc1
Begin: 13e5 419bbe13Nal type: 1
: found as avc1
Begin: 1549 419bc413Nal type: 1
: found as avc1
Begin: 600 19fe2d4Nal type: 1
: found as avc1
Begin: 61a 19e06d4Nal type: 1
: found as avc1
Begin: 122c 419a0e13Nal type: 1
: found as avc1
Begin: 13f7 419a3213Nal type: 1
: found as avc1
Begin: 117f 419a5817Nal type: 1
: found as avc1
Begin: 65b 19e76d4Nal type: 1
: found as avc1
Begin: 560 19e9ad4Nal type: 1
: found as avc1
Begin: e1f 419aa217Nal type: 1
: found as avc1
Begin: f35 419ac617Nal type: 1
: found as avc1
Begin: d2d 419ae87aNal type: 1
: found as avc1
Begin: 127e 419b2e17Nal type: 1
: found as avc1
Begin: 1406 419b5217Nal type: 1
: found as avc1
Begin: 10e8 419b7417Nal type: 1
: found as avc1
Begin: c11 19fb6d4Nal type: 1
: found as avc1
Begin: cea 19fdad4Nal type: 1
: found as avc1
Begin: 9ad 19ffed4Nal type: 1
: found as avc1
Begin: a8e 19e02d4Nal type: 1
: found as avc1
Begin: 8aa 19e26d4Nal type: 1
: found as avc1
Begin: 7e8 19e4ad4Nal type: 1
: found as avc1
Begin: 110a 419a5017Nal type: 1
: found as avc1
Begin: 50e 19e92d4Nal type: 1
: found as avc1
Begin: 1a16 419a9c7aNal type: 1
: found as avc1
Begin: 421 19ebad4Nal type: 1
: found as avc1
Begin: 184e 419ac417Nal type: 1
: found as avc1
Begin: 46d 19ee2d4Nal type: 1
: found as avc1
Begin: 494 19f06d4Nal type: 1
: found as avc1
Begin: 18fc 419b1017Nal type: 1
: found as avc1
Begin: 47f 19f2ed4Nal type: 1
: found as avc1
Begin: 47b 19f52d4Nal type: 1
: found as avc1
Begin: 696 19f76d4Nal type: 1
: found as avc1
Begin: 1b2b 419b6017Nal type: 1
: found as avc1
Begin: 63b 19f9ed4Nal type: 1
: found as avc1
Begin: 6d1 19fa2d4Nal type: 1
: found as avc1
Begin: 1dee 419bac7aNal type: 1
: found as avc1
Begin: 83e 19fcad4Nal type: 1
: found as avc1
Begin: 188c 419bf217Nal type: 1
: found as avc1
Begin: 18ce 419a167aNal type: 1
: found as avc1
Begin: 1b94 419a3c17Nal type: 1
: found as avc1
Begin: 620 19e5ad4Nal type: 1
: found as avc1
Begin: 5e4 19e7ed4Nal type: 1
: found as avc1
Begin: 14e5 419a6617Nal type: 1
: found as avc1
Begin: 139e 419a8c17Nal type: 1
: found as avc1
Begin: 1b6 19eaad4Nal type: 1
: found as avc1
Begin: 157 419ad017Nal type: 1
: found as avc1
Begin: 99 419b1417Nal type: 1
: found as avc1
Begin: 1a4c 419b5c17Nal type: 1
: found as avc1
Begin: 526 19f7ad4Nal type: 1
: found as avc1
Begin: 3d8 19f9ed4Nal type: 1
: found as avc1
Begin: 1473 419b887aNal type: 1
: found as avc1
Begin: 336 19fa6d4Nal type: 1
: found as avc1
Begin: 395 19fcad4Nal type: 1
: found as avc1
Begin: e51 419bf017Nal type: 1
: found as avc1
Begin: 996 419a3417Nal type: 1
: found as avc1
Begin: 5 60601c4Nal type: 6
: found as avc1
Begin: 9db 419a9ef9Nal type: 1
: found as avc1
Begin: 2eb 19ebcf2Nal type: 1
: found as avc1
Begin: 28d 19ec0d4Nal type: 1
: found as avc1
Begin: 38f 419aca17Nal type: 1
: found as avc1
Begin: 24b 19ee8d4Nal type: 1
: found as avc1
Begin: 6ac 6d6f6f66
Hi,
I am using ffmpeg .dylibs in my project on Qt. Path of thses dylibs in .pro are /usr/local/lib .
When i create a .exe or dmg it run successfully on all make mac OS but when i create a .pkg for appstore
.pkg it crash giving the following error
...../framework/libavformat.1.dylib: open failed with error no = 13
but when i place these .dylibs manaually on /usr/local/ lib then it runs successfully .
which path i have to give in .pro file to remove this error.
Regards,
Roopa01
Im no C++ developer so I have no idea what caused this. The program run for a good 30 minutes or so before this was thrown. The files are respectively 75MB and 37MB, and the program only used 4 out of the 8GB of RAM i got.
I got two questions. First, how long time is it supposed to take? My files on 75MB and 37MB are not that big? Second, do you think its possible to fix this problem?
Here is the output:
./untrunc ~/Desktop/working.MP4 ~/Desktop/not_working.MP4
Reading: /home/tordly/Desktop/working.MP4
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/home/tordly/Desktop/working.MP4':
Metadata:
major_brand : MSNV
minor_version : 22675568
compatible_brands: MSNVmp42isom
creation_time : 2015-06-11 17:36:58
Duration: 00:00:18.51, start: 0.000000, bitrate: 16204 kb/s
Stream #0.0(und): Video: h264 (Main), yuv420p, 1920x1080 [PAR 1:1 DAR 16:9], 16028 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc
Metadata:
creation_time : 2015-06-11 17:36:58
Stream #0.1(und): Audio: aac, 48000 Hz, stereo, fltp, 127 kb/s
Metadata:
creation_time : 2015-06-11 17:36:58
terminate called after throwing an instance of 'char const*'
Aborted
Hi,
I configured ffmpeg on snow leopard 64 bit gcc 4.2 and xcode 3.2.6. FFmpeg has been configured successfully.i build my qt project on terminal using qmake command then it gives following error
ld: warning: in /usr/local/lib/libavcodec.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavdevice.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavfilter.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavformat.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libavutil.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libpostproc.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: in /usr/local/lib/libswscale.dylib, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols:
"_av_register_all", referenced from:
ld: symbol(s) not found
collect2: ld returned 1 exit status
But when i build it on Qt creator 2.01 it build successfully and works fine.
while it works fine on mavericks when i build on terminal .
Kindly help me to find out the problem with terminal.
Hi,
I am using ffmpeg libs and avcodec.h file on windows XP in Qt. I put all .h files in include folder and libs in libs folder and put these both folders in source code directory . Path given to my .pro file are
FFMPEG_LIBRARY_PATH = /lib
FFMPEG_INCLUDE_PATH = /include
LIBS += -L$$FFMPEG_LIBRARY_PATH
LIBS += -lavcodec -lavdevice -lavfilter -lavformat -lavutil -lswresample -lpostproc -lswscale
INCLUDEPATH += $$FFMPEG_INCLUDE_PATH
But when i build this code it gives error
Error 38 fatal error C1083: Cannot open include file: 'libavcodec/avcodec.h': No such file or directory .
i think it is not getting correct path because when i put these .h files and libs directly in source code directory it build successfully .
kindly tell me which path is correct . I want to put these files in include folder and libs folder as i mentioned above.
Regards,
Roopa saini
Hi,
I am using some ffmpeg dylib in my project when i made exe all dylib are available in application bundle
and exe runs successfully. when i codesigned all dylibs and create pkg for appstore it gives following error
dyld error message:
Library not loaded: @executable_path/.../framworks/libavresample.1.dylib
Reason not suitable image found. Did find
Application/..../content/macOS/.../frameworks/libavresample.1.dylib: open() failed error = 13
When i run exe on terminal it expect libavresample on /usr/local/lib but i placed all dylib on /usr/local/lib using another exe it gives following error
Code Type: X86-64 (Native)
Parent Process: ??? [3819]
User ID: 501
Date/Time: 2015-12-21 11:09:37.771 +0530
OS Version: Mac OS X 10.11.1 (15B42)
Report Version: 11
Anonymous UUID: ADD4504E-07F5-6B74-88BA-4099E1A4E8A4
Time Awake Since Boot: 10000 seconds
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Application Specific Information:
Could not set sandbox profile data: Operation not permitted (1)
Application Specific Signatures:
SYSCALL_SET_PROFILE
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_secinit.dylib 0x00007fff8ed9049c libsecinit_setup_app_sandbox + 768
1 libsystem_secinit.dylib 0x00007fff8ed8fb31 libsecinit_initialize_once + 20
2 libdispatch.dylib 0x00007fff874803c3 dispatch_client_callout + 8
3 libdispatch.dylib 0x00007fff874802bb dispatch_once_f + 67
4 libSystem.B.dylib 0x00007fff990aaa0c libSystem_initializer + 131
5 dyld 0x00007fff62a01f1b ImageLoaderMachO::doModInitFunctions(ImageLoader::LinkContext const&) + 265
6 dyld 0x00007fff62a02094 ImageLoaderMachO::doInitialization(ImageLoader::LinkContext const&) + 40
7 dyld 0x00007fff629fe6cd ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 305
8 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
9 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
10 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
11 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
12 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
13 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
14 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
15 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
16 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
17 dyld 0x00007fff629fe662 ImageLoader::recursiveInitialization(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 198
18 dyld 0x00007fff629fe553 ImageLoader::processInitializers(ImageLoader::LinkContext const&, unsigned int, ImageLoader::InitializerTimingList&, ImageLoader::UninitedUpwards&) + 127
19 dyld 0x00007fff629fe7c3 ImageLoader::runInitializers(ImageLoader::LinkContext const&, ImageLoader::InitializerTimingList&) + 75
20 dyld 0x00007fff629f10f1 dyld::initializeMainExecutable() + 208
21 dyld 0x00007fff629f4d47 dyld::main(macho_header const, unsigned long, int, char const, char const_, char const__, unsigned long_) + 3515
22 dyld 0x00007fff629f0276 dyldbootstrap::start(macho_header const_, int, char const__, long, macho_header const_, unsigned long*) + 512
23 dyld 0x00007fff629f0036 _dyld_start + 54
Thread 0 crashed with X86 Thread State (64-bit):
rax: 0x00007fff8ed90ddd rbx: 0x00007fdc7c800000 rcx: 0xb800629338aaff34 rdx: 0x0000000000000000
rdi: 0x0000000000000000 rsi: 0x00007fff8ed90ddc rbp: 0x00007fff58387000 rsp: 0x00007fff583866e0
r8: 0x0000000000000003 r9: 0x00007fff8ed90ddc r10: 0x0000000000000000 r11: 0xffffffffc95f5a33
r12: 0x00007fdc7bd08180 r13: 0x00007fdc7bd086a0 r14: 0x00007fff583867d0 r15: 0x0000000107a45580
rip: 0x00007fff8ed9049c rfl: 0x0000000000010202 cr2: 0x00007fff768201c0
Logical CPU: 0
Error Code: 0x00000000
Trap Number: 6
Binary Images:
0x107875000 - <9B4F8F7E-46CE-3B74-863C-44CC0355D319> /Applications/.app/Contents/MacOS/.app/Contents/MacOS/
0x107a49000 - 0x10852efff +libavcodec.56.dylib (0) <252A3D76-BA5D-3A7B-BF87-3E42C4FC7773> /Applications/.app/Contents/MacOS/.app/Contents/Frameworks/libavcodec.56.dylib
0x108b2c000 - 0x108b3bff7 +libavdevice.56.dylib (0) /Applications/.app/Contents/MacOS/.app/Contents/Frameworks/libavdevice.56.dylib
0x108b46000 - 0x108c28ff7 +libavfilter.5.dylib (0) <773EF2C4-D7A9-322E-96FF-A2677EDAEB60> /Applications/.app/Contents/MacOS/.app/Contents/Frameworks/libavfilter.5.dylib
0x108c7b000 - 0x108dd0ff7 +libavformat.56.dylib (0) /Applications/.app/Contents/MacOS/.app/Contents/Frameworks/libavformat.56.dylib
0x108e17000 - 0x108e58fff +libavutil.54.dylib (0) /Applications/.app/Contents/MacOS/...app/Contents/Frameworks/libavutil.54.dylib
this problem aries after codesigning and pkg creation because if i run exe on terminal it runs successfully.
Kindly help me what is wrong m i doing. I have run all code signing command successfully on all dylibs and frameworks. How could i check all dylibs are successfully signed or not .Why application is not able to access dylibs from application bundle (Framworks directory) why it search these on usr/local/lib .
kindly help me
Regards,
roopa01
Hi,
Today I tried to compile this script on Linux Arch and got the following error:
[root@aristoteles untrunc-master]# g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
track.cpp: In member function ‘void Track::parse(Atom*, Atom*)’:
track.cpp:211:47: error: ‘avcodec_open’ was not declared in this scope
if(avcodec_open(codec.context, codec.codec)<0)
^
Is there a dependency missing? Should not, as I have ffmpeg installed, what also requires the libs you included for ubuntu.
Ciao Federico,
non riesco a compilare su ubuntu 14.04 mi ritorno l'errore in oggetto.
Ho provato diverse possibilità di cmmpilazione ma niente, sempre lo stesso errore, eccone alcune:
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I /usr/include/libavcodec/ -I /usr/include/libavformat/ -I /usr/include/libavutil/ -L /usr/lib/x86_64-linux-gnu -lavformat -lavcodec -lavutil track.cpp: In member function ‘void Track::parse(Atom_, Atom_)’:
track.cpp:244:47: error: ‘avcodec_open’ was not declared in this scope
if(avcodec_open(codec.context, codec.codec)<0)
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I /usr/include/libavcodec/ -I /usr/include/libavformat/ -I /usr/include/libavutil/ -L /usr/include/libavcodec/ -L /usr/include/libavformat/ -L /usr/include/libavutil/ -lavformat -lavcodec -lavutil
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -I /usr/include/libavcodec/ -I /usr/include/libavformat/ -I /usr/include/libavutil/ -lavformat -lavcodec -lavutil
track.cpp: In member function ‘void Track::parse(Atom_, Atom_)’:
track.cpp:244:47: error: ‘avcodec_open’ was not declared in this scope
if(avcodec_open(codec.context, codec.codec)<0)
Puoi aiutarmi?
Grazie
Paolo
The video shows a grey frame from beginning to end.
Hi!
I created a MP4 file with VLC (desktop's capture) and unfortunately, the file is corrupted.
I tried several tools and none of them worked. So far, I got the best results with your solution.
The output fixed file can be read by VLC, which is a strong progress.
However, the video duration is marked as being 0. And therefore, I cannot navigate in the video file. I suspect this is due to the file size, which is about 3 Gb.
I made the following modifications.
In file.cpp, I replaced...
I also found out that the duration in Track::fixTimes() is negative.
I think the int type is not big enough to store all the information. I tried to replace it by an unsigned integer, but this is probably not enough, as it is still not (completely) working.
To be honest, it has been a long time since I used to code in C/C++.
Some help would be welcome. I cannot upload my video file, but I can test it. I also thought about creating a pull request to discuss my changes, but I think those I did will not work on x32 systems.
Thanks for your help! ✨
PS: for your information, the video file has no audio.
I do not know whether this has an impact or not during the repair process. I don't think so, unless the audio is used to compute the file's duration.
Problem: With new versions of libavcodes the c compiler claims that avcodec_open is undeclared.
Suspected solution: Replace
avcodec_open(codec.context, codec.codec)
by
avcodec_open2(codec.context, codec.codec,NULL)
unfortunately the truncated file I wanted to fix gives out a stdlib error (bad alloc) so I cannot test if the solution works right now.
Hi,
After a recovery, I've ended up with some working files and some that might have been corrupted or truncated.
I've installed untrunc
on my Mac (OS X 10.10). I've followed those instructions : #35
If I try to process any file I get this kind of output, even if both file are perfectly readable.
→ ./untrunc /Volumes/Passport/photorec-output/recup_dir.1/f5415936_mdat.mov /Volumes/Passport/photorec-output/recup_dir.1/f6792128_mdat.mov
Reading: /Volumes/Passport/photorec-output/recup_dir.1/f5415936_mdat.mov
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Passport/photorec-output/recup_dir.1/f5415936_mdat.mov':
Metadata:
creation_time : 2016-01-24 19:10:15
Duration: 00:03:47.00, start: 0.000000, bitrate: 24825 kb/s
Stream #0.0(eng): Video: mjpeg, yuvj420p, 1280x720, 24568 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc
Metadata:
creation_time : 2016-01-24 19:10:15
Stream #0.1(eng): Audio: pcm_s16be, 16000 Hz, 1 channels, s16, 256 kb/s
Metadata:
creation_time : 2016-01-24 19:10:15
This audio codec is EVIL, there is no hope to guess it.
Here is what ffmpeg
sees when reading the working file :
→ ffmpeg -i /Volumes/Passport/photorec-output/recup_dir.1/f5415936_mdat.mov test.mov
ffmpeg version 2.8.5 Copyright (c) 2000-2016 the FFmpeg developers
built with Apple LLVM version 7.0.2 (clang-700.1.81)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.8.5 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libvo-aacenc --enable-libxvid --enable-vda
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mjpeg @ 0x7feaa301f400] Changeing bps to 8
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Volumes/Passport/photorec-output/recup_dir.1/f5415936_mdat.mov':
Metadata:
creation_time : 2016-01-24 19:10:15
Duration: 00:03:47.00, start: 0.000000, bitrate: 24825 kb/s
Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc, bt470bg/unknown/unknown), 1280x720, 24568 kb/s, 24 fps, 24 tbr, 24 tbn, 24 tbc (default)
Metadata:
creation_time : 2016-01-24 19:10:15
encoder : Photo - JPEG
Stream #0:1(eng): Audio: pcm_s16be (twos / 0x736F7774), 16000 Hz, 1 channels, s16, 256 kb/s (default)
Metadata:
creation_time : 2016-01-24 19:10:15
No pixel format specified, yuvj420p for H.264 encoding chosen.
Use -pix_fmt yuv420p for compatibility with outdated media players.
Any help would be immensely appreciated.
Hi,
I am creating a video file using ffmpeg .dylibs . It successfully create a video file but always write trailer at the end of file after writing all(video and audio ) frames. I want to write trailer at start with stream header which is created by avformat_write_header when i call av_write_trailer before writing any audio and video frame or call with avformat_write_header it crash on av_interleaved_write_frame.
kindly help me resolve this issue.
how can i write trailer at start of the or with header.
please help me i want to repair corrupt mov file using this on windows / mac can i do this using this
pls help me ....
thanks.
I recently compiled untruc on Gentoo, using a freshly compiled libav-0.8.7, and found that the compilation was choking on a missing bzip2 library. Adding -lbz2 to the compilation flags seems to have fixed that.
Dear Federico,
I try to use untrunc from current git with ffmpeg 2.7.1 on a capable openSUSE 13.2 x86_64 system in an attempt to repair these files:
The good one: http://treewater.net/DJI_0000.MOV (1.5G)
The bad one: http://treewater.net/DJI_0003-defect.MOV (2.5G)
The first problem is, that untrunc doesn't find a codec, quite possibly due to the fact, that these quicktime footages contain video only, no audio.
Here's the output of just untruncing the good file:
Reading: DJI_0000.MOV
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DJI_0000.MOV':
Metadata:
major_brand : qt
minor_version : 538182144
compatible_brands: qt
creation_time : 2015-07-18 19:50:42
location : +49.945756+7.908624+0.000
location-{ : +49.945756+7.908624+0.000
comment : 0.9.137
Duration: 00:03:36.98, start: 0.000000, bitrate: 59939 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 3840x2160 [SAR 1:1 DAR 16:9], 59936 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
Metadata:
creation_time : 2015-07-18 19:50:42
handler_name : DJI.AVC
encoder : Dji AVC encoder
No codec found!
Using larger reference files result in:
Reading: DJI_0001.MOV
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Terminated
This might be due to the "large file" issues, others noticed already in this forum..
The setup described below generally produces huge file chunks (3.9G), hence this is a great source for getting testing files. I can provide you with them. My C++ brain is rusty at best, but I'm able to debug stuff. Here's the backtrace from above error condition:
(gdb) bt
#0 0x00007ffff567c187 in __GI_raise (sig=sig@entry=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:56
#1 0x00007ffff567d538 in __GI_abort () at abort.c:78
#2 0x00007ffff5f6b145 in __gnu_cxx::__verbose_terminate_handler ()
at ../../../../libstdc++-v3/libsupc++/vterminate.cc:95
#3 0x00007ffff5f692e6 in __cxxabiv1::__terminate (handler=)
at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:38
#4 0x00007ffff5f69313 in std::terminate () at ../../../../libstdc++-v3/libsupc++/eh_terminate.cc:48
#5 0x00007ffff5f69532 in __cxxabiv1::__cxa_throw (obj=0x7fffec000940,
tinfo=0x7ffff61f0b00 <typeinfo for std::bad_alloc>, dest=0x7ffff5f679f0 <std::bad_alloc::~bad_alloc()>)
at ../../../../libstdc++-v3/libsupc++/eh_throw.cc:87
#6 0x00007ffff5f69a1d in operator new (sz=18446744073614107753) at ../../../../libstdc++-v3/libsupc++/new_op.cc:56
#7 0x000000000040b129 in File::read(unsigned long) ()
#8 0x0000000000405898 in Atom::parse(File&) ()
#9 0x0000000000408a9d in Mp4::open(std::string) ()
#10 0x0000000000402877 in main ()
Well, even my system doesn't have this amount of memory available ;)...
The good files can be played with vlc and mplayer(2) without any issues.
For the bad one, ffmpeg and friends spits out:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x121ea00] moov atom not found
DJI_0003-defect.MOV: Invalid data found when processing input
Obviously, it's missing essential metadata (at least).
Be assured, that due to the very subject above, you will have more attention with your project than ever before(!). I hope, you don't mind ;). That copter is great for a couple of reasons, but suffers from several teething troubles at the same time... I harvested the damaged file with a clean landing and shutdown procedure without any signs of technical trouble whatever. Oh well, strange, but I'm not alone.
Hi,
I have build untrunc and run it on Ubuntu 14.10 and here is what I have :
$ untrunc REFERENCE.MOV BAD.MOV
Reading: REFERENCE.MOV
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
When running it without arguments it prints the following usage :
Usage: untrunc [options] <ok.mp4> [<corrupt.mp4>]
Can you tell the possible options for your program to be more verbose ?
Running movdump.exe -i BAD.MOV -o BAD-REPAIRED.MOV -nfd -ref REFERENCE.MOV >> movdump.txt
on Windows repaired the video but I don't want to be stuck to Windows only for that.
UPDATE : My video file is much smaller than 4GiB
Can you help ?
$ ./untrunc 'MVI_5706.MOV' 'f2094516224_ftyp.mov'
Reading: /MVI_5706.MOV
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_5706.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt CAEP
creation_time : 2014-08-21 00:15:22
Duration: 00:09:01.13, start: 0.000000, bitrate: 21520 kb/s
Stream #0.0(eng): Video: h264 (Constrained Baseline), yuvj420p, 1280x720, 20813 kb/s, 30 fps, 3k tbn (default)
Metadata:
creation_time : 2014-08-21 00:15:22
Stream #0.1(eng): Audio: pcm_s16le, 44100 Hz, 1 channels, s16, 705 kb/s (default)
Metadata:
creation_time : 2014-08-21 00:15:22
avc1: failed for not particular reason
Found 0 packets
Hi!
First of all thanks @ponchio for sharing your code! It certainly saved the day...
But getting there wasn't so easy.
Apart from first struggling to compile it on OSX (eventually, I figured out the full list of libraries I needed to link to make it work:
-lavformat -lavcodec -lavutil -lavresample -lz -lbz2
,
and only after that realized @jensp had added some comments about this in another branch...), I got stuck on an issue when trying to parse the 'good' file.
I thought people may be interested in the story, in particular if they encounter the same problem, and perhaps someone will be able to explain what's going on in more detail...
Basically the problem is the mp4 file contains the following bit of data, a 24B tref
thing containing just a sync
atom but of which the size information completely off (0x10'00'00'00 while I would expect 0x10):
00 00 00 18 | 74 72 65 66 (tref) | 10 00 00 00 | 73 79 6E 63 (sync) | 02 00 00 00 | 01 00 00 00
Just after that comes a trak
atom. And the parent of this tref
is actually moov
...
Ok. So your code gets hung up on that and throws
Could not read at position
before terminating. That's because it thinks a tref
atom is supposed to be parent, so it looks for a child, finds the 'sync' atom but gets the size wrong and complains.
On the other hand, if I run AtomicParsley it spits out the structure without complaining. It shows the tref
but not the sync
in it.
I figured it's because it checks who the parent is, which your codes does not seem to do. And in AP_AtomDefinitions.h
, it is specified that tref
is supposed to be child of a trak
, apparently in accordance with the QT standard. So since my video file seems non-standard (the tref
comes just before the trak
atom and is child of a moov
instead), AtomicParsley does not recognise it and thus doesn't look for anything inside it.
If someone knows what all this non-standard atom structure and seemingly wrong size tag is about, I'm curious to hear.
At the end of the day (since no other tref
atom was appearing in the file anyway), the quick and dirty fix was to change PARENT_ATOM
to CHILD_ATOM
in AP_AtomDefinitions.h
and everything else ran fine, perfectly fixing the truncated video.
hi,
I used drag and drop property in application using Qt 4.6.4, I am able to drag and drop files on application window application works fine on all windows OS. But when i give admin right to the application whole application works fine but drag and drop does not work.when i remove admin right drag and drop property again works fine.please tell what is the problem in this admin and what is the solution for drag and drop. Does it will not work on windows higher OS.
Regards
Roopa01
Hello,
With ffmpeg i tried: avconv -i VID_0757.3gp
I got: [mov,mp4,m4a,3gp,3g2,mj2 @ 0xca2840] moov atom not found
VID_0757.3gp: Invalid data found when processing input
I tried to solve my video with untrunc but unfortunatly, the file produceed is too small and doesn't contain my full video.
If I give you samples (2 small files, less than 20Mo), could you give a try please? Where can I contact you?
Hi,
I download your source macdylibundler-master but when i run 'make' it gives follwing error
/usr/include/libkern/i386/OSByteOrder.h:48:12: error: use of undeclared
identifier '_OSSwapInt16'
return _OSSwapInt16(result);
^
/usr/include/libkern/i386/OSByteOrder.h:87:60: error: use of undeclared
identifier '_OSSwapInt16'
_(volatile uint16_t *)((uintptr_t)base + byteOffset) = OSSwapInt16(data);
^
3 errors generated.
make: ** [dylibbundler] Error 1
Kindly tell me to reason of this error how can i resolve this.
Regards,
Roopa01
just wonna let you know I was able to restore an mp4 file without moov atom and it worked! The corrupted file was created by ffmpeg (recording an rtmp live stream) but the server crashed during the process and as a result left me with an unplayable record.
Thank you very much for this tool, I am really grateful!!
Regards Frans
I use untrunc to fix my broken mp4 file. But it didn't work because of the audio type is ulaw.
How to analysis ulaw.
Hi,
I am using ffmpeg avcodec-55.dll , avdevice-55.dll,avfilter-3.dll,avformat-55.dll, avutil-52.dll,avutil.dll,postproc-52.dll, avfilter-4.dll ,swresample-0.dll,swscale-2.dll on windows XP using Qt 4.6.4. if i run .exe wchich is using these dll it give following error. I have no idea about this error.
Kindly help me to find out the problem. I attached the file showing this error.
"The procedure entry point OleflushClipBoard could not be located in the dynamic link library avformat-55.dll"
I tried to fix a file, created by a Nikon D800, when pulling out the SD-Card a bit too early. This is what I got when trying to repair it: (DSC_4493.MOV is a working one and DSC_4495.MOV the non-working, which isn't mentioned here)
Reading: /mnt/DSC_4493.MOV
Composition time offset atom found. Out of order samples possible.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/mnt/DSC_4493.MOV':
Metadata:
major_brand : qt
minor_version : 537331968
compatible_brands: qt niko
creation_time : 2013-09-25 16:36:14
Duration: 00:08:03.20, start: 0.000000, bitrate: 21662 kb/s
Stream #0.0(eng): Video: h264 (High), yuvj420p, 1920x1080 [PAR 1:1 DAR 16:9], 20123 kb/s, 25 fps, 25 tbr, 25k tbn, 50 tbc
Metadata:
creation_time : 2013-09-25 16:36:14
Stream #0.1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s
Metadata:
creation_time : 2013-09-25 16:36:14
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted (core dumped)
Is there any chance someone could help me get the app into some "debug" mode, to provide you with more information, or is this enough to start from? The files (working and broken video) are each 3GB large ...
Hi,
I want to open a file which has the path like C:\Documents and Settings\Administrator\Desktop\新しいフォルダ3\small size\aaaaaa.jpg
i am using Qt 4.6.4 on windows XP amd trying this to open using fopen function.
I have file path in QString but fopen takes argument in const char so i convert it into const char using
fopen((String name).toUtf8(),"rb+");
it always return null due to unicode character are present in string.
But when i use QByteArray str((const char_)(bNewName1.utf16()),bNewName1.size()_2);
it does not return null in every condition does not matter file exist on mention path or not.
Kindly help me how to open a file which have unicode character name.
Regards,
roopa01
Composition time offset atom found. Out of order samples possible.
Sample dependency flag atom found. I and P frames might need to recover that info.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'GOPR0031.MP4':
Metadata:
major_brand : avc1
minor_version : 0
compatible_brands: avc1isom
creation_time : 2012-06-18 08:33:53
Duration: 00:10:17.13, start: 0.000000, bitrate: 30121 kb/s
Stream #0.0(eng): Video: h264 (High), yuvj420p, 1920x1080 [PAR 1:1 DAR 16:9], 29977 kb/s, 23.98 fps, 23.98 tbr, 360k tbn, 47.95 tbc
Metadata:
creation_time : 2012-06-18 08:33:53
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 128 kb/s
Metadata:
creation_time : 2012-06-18 08:33:53
Segmentation fault (core dumped)
I've played a bit with source code and localized a source of error(s). It looks, that for some variables one reads using readInt() int, which for file bigger than MAX_INT, 3.2GB causes a overflow, addresses get mangled and things go wrong.
I've started updating but it's not trivial. What doc/manual/standard did you read when implementing this?
Thank for the amazing work.
Just try to compile the master version and got the following error : track.cpp:108:78: erreur: ‘avcodec_decode_audio4’ was not declared in this scope
I don't see any reason but maybe you can help ?
Thanks a lot again.
I'm trying to recover a video file encoded in Quicktime dialect of mp4. It contains nal units of types 9 and 25 and these seem to be problematic for untrunc. Recovering of the file seems to be possible according to results of http://mp4repair.org test run on it.
If I change track.cpp and mp4.cpp in order to bypass checks around those NAL unit types (and disable attempts to recover the audio track) I manage to recover a single frame.
I recently used photorec to recover my accidentally-deleted mp4 files that I'd taken with a Canon Vixia HF R600 camcorder. For whatever reason, photorec finds *.mp4 files that aren't actually video files, and *.mov files which do seem to contain the video and audio data. Trying to run vlc on one of the recovered .mov files gives a "moov atom not found" error, and Google lead me to untrunc
to try to fix the file:
$ untrunc MVI_0228.MP4 f63066496_mdat.mov
Reading: MVI_0228.MP4
Composition time offset atom found. Out of order samples possible.
Sample dependency flag atom found. I and P frames might need to recover that info.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_0228.MP4':
Metadata:
major_brand : mp42
minor_version : 1
compatible_brands: mp42avc1CAEP
creation_time : 2016-04-03 13:55:23
Duration: 00:00:05.57, start: 0.000000, bitrate: 4233 kb/s
Stream #0.0(eng): Video: h264 (Main), yuv420p, 1280x720, 3916 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 60k tbc
Metadata:
creation_time : 2016-04-03 13:55:23
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 127 kb/s
Metadata:
creation_time : 2016-04-03 13:55:23
avc1: no match because of nal type: 23
Failure because of NULL header
Found 0 packets
A _fixed.mp4 file is created, but it doesn't seem to be useful. I was able to recover the video using the recover_mp4_to_h264
program from http://slydiman.me/eng/mmedia/recover_mp4.htm, so the necessary data was there, but apparently untrunc wasn't doing the right thing with the data. Here's the original files that I fed to untrunc, along with the fixed mp4 that I generated using recover_mp4_to_h264
(and ffmpeg
).
Thanks! Let me know if I may provide any additional information.
i compiled this code but gives error
"_CFDictionaryCreate", referenced from:
_ff_vda_decoder_decode in libavcodec.a(vda.o)
"_CFRelease", referenced from:
_ff_vda_decoder_decode in libavcodec.a(vda.o
i donot know what is the reason for this error
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.