1 year ago

#306131

test-img

hackt

How to repair corrupted .mkv

Situation

I have accidentally overwrote .mkv file and luckily restored it by using PhotoRec.

Now I have a large size (4.9GB, about 1 hour) file named "f1.mkv" but cannot play it.

To be precise, only about the first second of the video is played, after which the screen remains still and only the current time on the timeline continues to advance.

If I try to jump ahead a few minutes, I get a dialog box that says "Output stream cannot be retrieved".

I'm using ubuntu20.04 desktop and its default media player.

What I have tried

  • Play it using VLC -> Same result as above
  • ffmpeg -i f1.mkv -> No error, showing apparently correct information as below:
 Input #0, matroska,webm, from 'f1.mkv':
      Metadata:
        ENCODER         : Lavf58.29.100
      Duration: 00:56:20.67, start: 0.000000, bitrate: 12264 kb/s
        Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1920x1080, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
        Metadata:
          DURATION        : 00:56:20.666000000
        Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
        Metadata:
          title           : Track1
          DURATION        : 00:56:20.672000000
        Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
        Metadata:
          title           : Track2
          DURATION        : 00:56:20.650000000

  • ffmpeg -i f1.mkv f1.mp4 -> Huge amount of errors as below
[h264 @ 0x55d7ff486440] Invalid NAL unit 0, skipping.
    Last message repeated 77 times
[matroska,webm @ 0x55d7ff42d6c0] Length 5 indicated by an EBML number's first byte 0x0a at pos 2105851 (0x2021fb) exceeds max length 4.
[h264 @ 0x55d7ff486440] Invalid NAL unit 0, skipping.
    Last message repeated 22 times
[h264 @ 0x55d7ff486440] negative number of zero coeffs at 108 45
[h264 @ 0x55d7ff486440] error while decoding MB 108 45
[h264 @ 0x55d7ff486440] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x55d7ff486440] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel@ffmpeg.org)
[h264 @ 0x55d7ff486440] non-existing PPS 5 referenced
[h264 @ 0x55d7ff486440] decode_slice_header error
[h264 @ 0x55d7ff486440] Frame num change from 4 to 22
[h264 @ 0x55d7ff486440] decode_slice_header error
[h264 @ 0x55d7ff486440] Frame num change from 4 to 22
[h264 @ 0x55d7ff486440] decode_slice_header error
...
[matroska,webm @ 0x55d7ff42d6c0] 0x00 at pos 429923807 (0x19a01ddf) invalid as first byte of an EBML number
frame=  153 fps= 17 q=29.0 size=    1024kB time=00:00:05.52 bitrate=1518.2kbits/s dup=60 drop=0 speed=0.614xf108855296.mkv: corrupt decoded frame in stream 0
More than 1000 frames duplicated
frame=70202 fps=421 q=29.0 size=   92160kB time=00:39:00.22 bitrate= 322.6kbits/s dup=70093 drop=0 speed=  1[h264 @ 0x55d7ff5cdb80] out of range intra chroma pred mode
[h264 @ 0x55d7ff5cdb80] error while decoding MB 64 42
[h264 @ 0x55d7ff5cdb80] concealing 3105 DC, 3105 AC, 3105 MV errors in P frame
[matroska,webm @ 0x55d7ff42d6c0] Element at 0x9f1f763c ending at 0xa0cc7e77 exceeds containing master element ending at 0x9f24b2cb
frame=70328 fps=393 q=29.0 size=   92160kB time=00:39:04.34 bitrate= 322.0kbits/s dup=70093 drop=123 speed=1f108855296.mkv: corrupt decoded frame in stream 0
frame=70334 fps=393 q=-1.0 Lsize=   93350kB time=00:39:04.38 bitrate= 326.2kbits/s dup=70093 drop=130 speed=13.1x    
video:92446kB audio:74kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.896887%
[libx264 @ 0x55d7ff4560c0] frame I:283   Avg QP:14.61  size:305979
[libx264 @ 0x55d7ff4560c0] frame P:17727 Avg QP:15.49  size:   214
[libx264 @ 0x55d7ff4560c0] frame B:52324 Avg QP:21.34  size:    82
[libx264 @ 0x55d7ff4560c0] consecutive B-frames:  0.8%  0.0%  0.0% 99.2%
[libx264 @ 0x55d7ff4560c0] mb I  I16..4:  8.0% 48.9% 43.2%
[libx264 @ 0x55d7ff4560c0] mb P  I16..4:  0.0%  0.0%  0.0%  P16..4:  0.3%  0.0%  0.0%  0.0%  0.0%    skip:99.6%
[libx264 @ 0x55d7ff4560c0] mb B  I16..4:  0.0%  0.0%  0.0%  B16..8:  0.2%  0.0%  0.0%  direct: 0.0%  skip:99.8%  L0:24.6% L1:75.1% BI: 0.3%
[libx264 @ 0x55d7ff4560c0] 8x8 transform intra:48.9% inter:55.1%
[libx264 @ 0x55d7ff4560c0] coded y,uvDC,uvAC intra: 86.3% 73.0% 64.4% inter: 0.0% 0.1% 0.0%
[libx264 @ 0x55d7ff4560c0] i16 v,h,dc,p: 33% 53% 10%  3%
[libx264 @ 0x55d7ff4560c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 21% 15%  7%  9%  6% 10%  7% 13%
[libx264 @ 0x55d7ff4560c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 30%  9%  5%  7%  6%  8%  5%  9%
[libx264 @ 0x55d7ff4560c0] i8c dc,h,v,p: 47% 34% 12%  6%
[libx264 @ 0x55d7ff4560c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 @ 0x55d7ff4560c0] ref P L0: 88.0%  3.6%  6.7%  1.7%
[libx264 @ 0x55d7ff4560c0] ref B L0: 74.5% 24.6%  0.8%
[libx264 @ 0x55d7ff4560c0] ref B L1: 98.8%  1.2%
[libx264 @ 0x55d7ff4560c0] kb/s:323.02
[aac @ 0x55d7ff459440] Qavg: 29327.965

Now I can see f1.mp4 for few more seconds with stuttering screen.

Is there I can do more?

ffmpeg

corrupt

mkv

0 Answers

Your Answer

Accepted video resources