Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Yesterday I was filming a scene with my phone but suddenly the application crashed and when I try to open the m4v generated it says that is corrupted.

I have downloaded the video files (around 36MB) on my PC and I am trying to open and repair it. Can you suggest me a way to do it?

FFMPEG info

As suggested in comments I try check what FFMPEG says me about that file with this command

ffmpeg.exe -i VID_20120425_144739.m4v -c:v copy -c:a copy out.mp4 2> log.txt

Here it is the result:

ffmpeg version N-40126-ga4b58fd Copyright (c) 2000-2012 the FFmpeg developers
  built on Apr 26 2012 03:29:50 with gcc 4.6.3
  configuration: --enable-gpl --enable-version3 --disable-w32threads --enable-runtime-cpudetect --enable-avisynth --enable-bzlib --enable-frei0r --enable-libass --enable-libcelt --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libnut --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libutvideo --enable-libvo-aacenc --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib
  libavutil      51. 47.100 / 51. 47.100
  libavcodec     54. 15.100 / 54. 15.100
  libavformat    54.  3.100 / 54.  3.100
  libavdevice    53.  4.100 / 53.  4.100
  libavfilter     2. 72.100 /  2. 72.100
  libswscale      2.  1.100 /  2.  1.100
  libswresample   0. 11.100 /  0. 11.100
  libpostproc    52.  0.100 / 52.  0.100
[mov,mp4,m4a,3gp,3g2,mj2 @ 003fc940] moov atom not found
VID_20120425_144739.m4v: Invalid data found when processing input

Latest two lines are displayed in red.

share|improve this question
    
My OS is Windows 7 but if necessary I can prepare a virtual machine with Linux-based distro. –  Drake Apr 26 '12 at 12:29
    
@slhck Thank you for help, I did what you suggested and updated question. –  Drake Apr 26 '12 at 12:42
4  
Ah, that's what I expected. The MOOV atom is a piece of data that's needed to access the raw video streams inside the MP4/M4V container. There are plenty of "video repair" tools online, but I wouldn't trust most of them. You can certainly give them a shot though – just don't pay for anything. What looks promising is Untrunk, which seems to be coded for this exact problem (namely a missing MOOV atom). Or AtomicParsley. Good luck! –  slhck Apr 26 '12 at 12:46
add comment

4 Answers

It is possible to repair the broken mp4 or m4v file using Untrunc.

For this method you need:

  • another video file which isn't broken

  • a linux installation (I used Ubuntu 12.04) and basic ability to use a command line.

This is what to do:

  1. Install some pre-requisite libraries with this command:

    sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev

  2. Download the source code for Untrunc from the link above, or use this command:

    wget http://vcg.isti.cnr.it/~ponchio/coding/untrunc_1.0.tgz

  3. Unzip the source code:

    tar xvf untrunc_1.0.tgz

    and then go into the directory where it's been unzipped:

    cd untrunc_1.0

  4. Compile the source code using this command (all one line):

    g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil

    (you can try skipping this step and using the ready-provided executable, but it didn't work for me)

  5. Then you can actually fix the video. You need both the broken video and an example working video.

    Ideally the video should be from the same camera & have the same resolution (mine was but it might work without). Also if it is at least as long as the broken one (preferably roughly the same) this may help.

    Run this command in the folder where you have unzipped and compiled Untrunc but replace the /path/to/... bits with your 2 video files:

    ./untrunc /path/to/working-video.m4v /path/to/broken-video.m4v

    Then it should churn away and hopefully produce a playable file called broken-video_fixed.m4v

That's it you're done!

VLC Media Player should now be able to play the file. However it may be reporting the wrong length information (Untrunc tries to guess/work this out, but doesn't always get it right). To fix this try re-encoding the video through another program.

[Thanks to slhck's comment for the suggestion to try Untrunc.]

[Many thanks to Federico Ponchio for coding Untrunc in the first place, to solve this exact problem.]

share|improve this answer
    
Cool, thanks for providing the full instructions here! –  slhck May 16 '13 at 16:55
add comment

I had the same problem solved using the sparrowt's answer but I had to rebuild i-frames and b-frames using avidemux. So if the video from untrunc recovery opens in vlc but has other problems (mine was no video only audio) just open it in avidemux and go to tools>rebuild...

share|improve this answer
add comment

If someone else stumbles on this, I also tried the app sparrowt was talking about, but it didn't work for me (see some bug-reports I created in the developers repository). Maybe this was because it wasn't a mp4 file but a MOV file ...

What helped for me was this post: http://muzso.hu/2012/11/14/how-to-fix-a-broken-mp4-mov-video-ffmpeg-reports-moov-atom-not-found

They link to a program called "HD Video Repair Utility" (http://grauonline.de/cmsimple2_6/en/?Solutions:HD_Video_Repair_Utility), which is far cheaper than Treasured (http://aeroquartet.com/movierepair/repair). They even pointed out, that there was an earlier version of it (version 1.5) that didn't cost anything (http://lorienart.pl/videorepair1.5.zip)!

I tried repairing the file using the version 1.5 and got it partly working. After re-encoding with ffmpeg (got some errors there), I realized, that a part of the audio was gone. In the logs (gladly the Video Repair Utility has some), there was no further mentioning of audio after a given time. I'll take it as-is ...

share|improve this answer
add comment

Have you tried to open the file with VLC Player? It is usually quite good at repairing damaged files.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.