MP4 corrupted, how to repair?

2

I recorded two videos on a digital camera. Both videos were saved using identical codecs and settings.

The second video is corrupted, in some way, and I can't open with VLC or video-editing software. (The first video is ok).

I tried to convert video with "video to video" software that says:

#8636.3: [h264 @ 04E10060]AVC: nal size -1920576098
#8636.3: [h264 @ 04E10060]no frame!
#8636.5: [mov,mp4,m4a,3gp,3g2,mj2 @ 04EC4020]decoding for stream 0 failed
#8636.4: [mov,mp4,m4a,3gp,3g2,mj2 @ 04EC4020]Could not find codec parameters 
for stream 0 (Video: h264 (avc1 / 0x31637661), 1920x1080, 11987 kb/s): 
 unspecified pixel format
#8636.4: Consider increasing the value for the 'analyzeduration' and 
 'probesize' options

***File load error: C:\..\PICT0002.MP4: could not find codec parameters

Analyzing with Gspot, on videos (video corrupted on the right: PICT0002):

enter image description here

Can anyone suggest a tool or a method to repair the second video? The size is correct (3 GB), and when I try to open it with VLC, the length seems to be ok (40 min).

Theoretically: Should I change codec-metadata in the file to make it recognizable by software?

UPDATE

tried ffmpeg analysis. command: ffmpeg -analyzeduration 2000000000 -i PICT0002.mp4 -c:v libx264 -c:a copy PICT0002-fixed.mp4

response:

C:\Programmi\ffmpeg\bin>ffmpeg -analyzeduration 2000000000 -i PICT0002.mp4 - 
c:v libx264 -c:a copy PICT0002-fixed.mp4
ffmpeg version N-91398-gd08d4a8c73 Copyright (c) 2000-2018 the FFmpeg         
developers
   built with gcc 7.3.0 (GCC)
   configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable- 
   bzlib --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass 
   --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-amf --enable-ffnvcodec --enable-cuvid --enable-d3d11va --enable- 
   nvenc --enable-nvdec --enable-dxva2 --enable-avisynth
      libavutil      56. 18.102 / 56. 18.102
      libavcodec     58. 20.104 / 58. 20.104
      libavformat    58. 17.101 / 58. 17.101
      libavdevice    58.  4.101 / 58.  4.101
      libavfilter     7. 25.100 /  7. 25.100
      libswscale      5.  2.100 /  5.  2.100
      libswresample   3.  2.100 /  3.  2.100
      libpostproc    55.  2.100 / 55.  2.100
 [h264 @ 000002036235d380] Invalid NAL unit size (-1920576098 > 197632).
 [h264 @ 000002036235d380] Error splitting the input into NAL units.
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000002036234a300] decoding for stream 0 failed
 [mov,mp4,m4a,3gp,3g2,mj2 @ 000002036234a300] Could not find codec 
 parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1920x1080, 
 11987 kb/s): unspecified pixel format
 Consider increasing the value for the 'analyzeduration' and 'probesize' 
  options
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'PICT0002.mp4':
   Metadata:
   major_brand     : avc1
   minor_version   : 0
   compatible_brands: avc1isom
   creation_time   : 2021-06-30T08:32:50.000000Z
   Duration: 00:40:53.45, start: 0.000000, bitrate: 12122 kb/s
   Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1920x1080, 11987 
    kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 180k tbc (default)
   Metadata:
     creation_time   : 2021-06-30T08:32:50.000000Z
     handler_name    :  Ambarella AVC
     encoder         : Ambarella AVC encoder
 Stream mapping:
   Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))
 Press [q] to stop, [?] for help
 [h264 @ 000002036234dd40] Invalid NAL unit size (-1920576098 > 197632).
 [h264 @ 000002036234dd40] Error splitting the input into NAL units.
 [h264 @ 0000020363f92300] Invalid NAL unit size (1565499804 > 10496).
 [h264 @ 0000020363f92300] Error splitting the input into NAL units.
 Error while decoding stream #0:0: Invalid data found when processing input
     Last message repeated one time
 Cannot determine the format of input stream 0:0 after EOF
 Error marking filters as finished
 Conversion failed!

So, the conversion failed.

Marco

Posted 2018-06-30T14:52:00.003

Reputation: 31

Judging by the log output, the software you are using appears to be FFmpeg (or based on FFmpeg). Try to add the flag -analyzeduration 2000000000 to the FFmpeg arguments. It's worth noting the VLC player is also based on FFmpeg... and thus they share similar limitations in their default configurations. – Cliff Armstrong – 2018-06-30T15:43:12.137

how to do in windows 10? (tank you) – Marco – 2018-06-30T16:14:18.993

Well, you said you were using "video to video" software to convert the video. What software is that? Does it have a name? If you want to use FFmpeg directly (high learning curve) you can download the latest windows builds here: https://ffmpeg.zeranoe.com/builds/ . It's a command line tool, so you will have to run the "ffmpeg prompt" and execute the appropriate command. Something like: ffmpeg -analyzeduration 2000000000 -i PICT0002.mp4 -c:v libx264 -c:a copy PICT0002-fixed.mp4 should do it.

– Cliff Armstrong – 2018-06-30T17:13:56.017

http://www.videotovideo.org/ – Marco – 2018-06-30T21:08:40.270

Answers

1

Check out this tool: Video Repair Tool

It is not freeware but it repairs 50% of your video for free so you'll know if it works.

Check also this youtube video: https://www.youtube.com/watch?v=5QK3vizVIds

Ricardo Bohner

Posted 2018-06-30T14:52:00.003

Reputation: 1 256

tank you! this works. – Marco – 2018-07-01T09:46:36.523

1

SOLUTION.

First of all, tank you to Ricardo Bohner. He refers to Video Repair Tool.

Going to that site, you'll find that this tool is not any more available, and you should subscribe to Restore Media.

In alternative you can go here. I followed instruction showed here.

Sadly I recovered only 30:00 mins of 40:00 mins of the video, but the recovered part is perfect.

Hope this can be usefull.

UPDATE: As explained by Riccardo Bonher (see below in comments), it's possible to use a trick (doubling mp4 lenght) and recover it by Repair Tool.

In this way I was able to repair all length of the corrupted-mp4. After doing this I was able to see video with VLC (video-reader)..

..but I was not still able to convert it by editing-softare (as VirtualDub, Video to Video etc.)

So, I used a combinated procedure: A) using Riccardo solution (as explained in comments) for recovreing whole video-length B) repassing recovered video by my original solution (recover-mp4-to-h264.zip), for making it correct and readable by common editing-softwares. Hope this can help people..

Marco

Posted 2018-06-30T14:52:00.003

Reputation: 31

Marco, what do mean with no longer available? I just downloaded it. Here is the direct download link: http://grauonline.de/download/videorepair.zip

– Ricardo Bohner – 2018-07-02T21:58:00.593

I read that version is a demo. It recovers only half video. – Marco – 2018-07-03T12:16:11.713

Yes, but there is trick on how to recover 100% instead of 50%:

Rename your damaged video file to 1.mp4 make a copy of it and name it 2.mp4. Open a command prompt, enter the path where the 2 video files are and type the following command:

copy /b 1.mp4+2.mp4 double.mp4

This will create a video called double.mp4 which will have double the lenght of your original damaged video. Open this file in the Video repair tool and have it fixed, it will recover 100% of your video. – Ricardo Bohner – 2018-07-03T19:52:47.327

Tank you Riccardo, in this way I recovered all the 40 min! I've not your creativity.. – Marco – 2018-07-04T12:51:19.210

Really? I was just up to recall my copy /b tip cause I figured out it doesn't work for mp4 files. When you do the copy /b trick with mp4 files it only doubles the filesize in my test but not the video lenght. I was going to suggest you to use AVIDemux or other video editing software that permits to append a video to another video.

So the tip would be to make a copy of the video then append the two using a video editing software and then use the video repair tool to restrore the damaged video doubled in size (80min).

But happy to know that it worked anyway. – Ricardo Bohner – 2018-07-04T13:41:38.083

Little correction, with your trick the mp4 was repaired entirely (and visible to vlc), but I was not able to convert it (I must convert it with a smaller codec too). So I reused the recover-mp4-to-h264.zip (as my first solution) to pass the recovered version. Now I can use the video with common conversion-tools & sofware (as Virtualdub, videoToVideo etc). – Marco – 2018-07-05T19:48:46.243