anthwlock / untrunc

Restore a truncated mp4/mov. Improved version of ponchio/untrunc
GNU General Public License v2.0
1.9k stars 182 forks source link

No codec found! #30

Closed maxbiostat closed 5 years ago

maxbiostat commented 5 years ago

I'm getting the following message, which I assume is an error. bad-fixed.mp4is never created.

$ untrunc -v good.mp4 bad.mp4 
Info: version '53e3ce1' using ffmpeg '3.3.9'
Info: reading good.mp4
Info: parsing healthy moov atom ... 
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x563244680da0] Using non-standard frame rate 29/1
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'good.mp4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    creation_time   : 2019-06-24T07:21:48.000000Z
    firmware        : HD7.01.01.70.00
  Duration: 00:00:29.16, start: 0.000000, bitrate: 45334 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 45078 kb/s, 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc (default)
    Metadata:
      creation_time   : 2019-06-24T07:21:48.000000Z
      handler_name    : GoPro AVC  
      encoder         : GoPro AVC encoder
      timecode        : 07:36:34:20
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-06-24T07:21:48.000000Z
      handler_name    : GoPro AAC  
      timecode        : 07:36:34:20
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2019-06-24T07:21:48.000000Z
      handler_name    : GoPro TCD  
      timecode        : 07:36:34:20
    Stream #0:3(eng): Data: none (gpmd / 0x646D7067), 39 kb/s (default)
    Metadata:
      creation_time   : 2019-06-24T07:21:48.000000Z
      handler_name    : GoPro MET  
    Stream #0:4(eng): Data: none (fdsc / 0x63736466), 10 kb/s (default)
    Metadata:
      creation_time   : 2019-06-24T07:21:48.000000Z
      handler_name    : GoPro SOS  
found avcC after: 121
remaining len:75
parsing avcC ...
len_sps: 52
decoding SPS ...
log2_max_frame_num: 5
Info: avcC got decoded
No codec found!

I can email the relevant files.

skoopy-de commented 5 years ago

I have this issue as well. According to ffmpeg it is an H264 - MPEG 4 - AVC avc1 part 10) recorded with 2,7k and 50 fps from a GoPro 6. Can I provide you with a small chunk of this file (first 10MB)?

anthwlock commented 5 years ago

@skoopy-de sure (e.g. via email). As long as the healthy one has its moov atom at front, you can also chop up the healthy one. If that's not the case, you can use tools like these first

ollypsilon commented 5 years ago

@skoopy-de sure (e.g. via email). As long as the healthy one has its moov atom at front, you can also chop up the healthy one. If that's not the case, you can use tools like these first

@anthwlock fyi, if I tried with just a chunk (no matter the size) and run untrunc -a on it I get Info: version '' using ffmpeg '4.1' Info: reading unknown_codec.mp4 Info: parsing healthy moov atom ... Missing movie header atom

Only with the whole file it can be read until "No codec found!" message. Info: version '' using ffmpeg '4.1' Info: reading unknown_codec.mp4 Info: parsing healthy moov atom ... Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'unknown_codec.mp4': Metadata: major_brand : mp41 minor_version : 538120216 compatible_brands: mp41 creation_time : 2019-06-24T11:07:15.000000Z firmware : HD6.01.02.01.00 Duration: 00:00:16.79, start: 0.000000, bitrate: 66501 kb/s Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 66276 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default) Metadata: creation_time : 2019-06-24T11:07:15.000000Z handler_name : GoPro AVC encoder : GoPro AVC encoder timecode : 11:07:15:07 Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default) Metadata: creation_time : 2019-06-24T11:07:15.000000Z handler_name : GoPro AAC timecode : 11:07:15:07 Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default) Metadata: creation_time : 2019-06-24T11:07:15.000000Z handler_name : GoPro TCD timecode : 11:07:15:07 Stream #0:3(eng): Data: bin_data (gpmd / 0x646D7067), 35 kb/s (default) Metadata: creation_time : 2019-06-24T11:07:15.000000Z handler_name : GoPro MET Stream #0:4(eng): Data: none (fdsc / 0x63736466), 12 kb/s (default) Metadata: creation_time : 2019-06-24T11:07:15.000000Z handler_name : GoPro SOS found avcC after: 121 remaining len:74 parsing avcC ... len_sps: 51 decoding SPS ... log2_max_frame_num: 6 Info: avcC got decoded No codec found!

anthwlock commented 5 years ago

@ollypsilon You can use for example qt-faststart <original.mp4> <original_out.mp4>. qt-faststart ships with FFmpeg ships. There are also other tools which do the same. After this you should be able to chop it up.

ollypsilon commented 5 years ago

@anthwlock unfortunately result is the same, tried that already. Next I tried to just extract the video/audio part:

ffmpeg -y -i GH015334.MP4 -codec copy extract.mp4
Output #0, mp4, to 'extract.mp4':
  Metadata:
    major_brand     : mp41
    minor_version   : 538120216
    compatible_brands: mp41
    firmware        : HD6.01.02.01.00
    encoder         : Lavf58.20.100
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], q=2-31, 66276 kb/s, 0.02 fps, 50 tbr, 90k tbn, 90k tbc (default)
    Metadata:
      creation_time   : 2019-06-24T11:07:15.000000Z
      handler_name    : GoPro AVC
      encoder         : GoPro AVC encoder
      timecode        : 11:07:15:07
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      creation_time   : 2019-06-24T11:07:15.000000Z
      handler_name    : GoPro AAC
      timecode        : 11:07:15:07
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
  Stream #0:1 -> #0:1 (copy)
Press [q] to stop, [?] for help
frame=  839 fps=0.0 q=-1.0 Lsize=  136160kB time=00:00:16.76 bitrate=66520.7kbits/s speed=  76x
video:135756kB audio:388kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.011446%

Then I ran untrunc with the new file:

Info: version '' using ffmpeg '4.1'
Info: reading extract.mp4
Info: parsing healthy moov atom ...
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'extract.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2avc1mp41
    encoder         : Lavf58.20.100
  Duration: 00:00:16.79, start: 0.000000, bitrate: 66433 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuvj420p(pc, bt709), 2704x1520 [SAR 1:1 DAR 169:95], 66276 kb/s, 50 fps, 50 tbr, 90k tbn, 100 tbc (default)
    Metadata:
      handler_name    : GoPro AVC
      timecode        : 11:07:15:07
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 189 kb/s (default)
    Metadata:
      handler_name    : GoPro AAC
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s
    Metadata:
      handler_name    : GoPro AVC
      timecode        : 11:07:15:07
found avcC after: 102
remaining len:90
parsing avcC ...
len_sps: 51
decoding SPS ...
log2_max_frame_num: 6
Info: avcC got decoded
No codec found!
anthwlock commented 5 years ago

@ollypsilon @skoopy-de So what's up with the samples? Will you send some or not? I currently only have 1 working GoPro Video, the more the better.

ollypsilon commented 5 years ago

@anthwlock I'll send you some links to download files, way too big for email. The link will also contain the files from @skoopy-de . If you need more samples or specific files (resolution, frame rate etc.) let me know.

ollypsilon commented 5 years ago

As the error is raised by ffmpeg module is it simply that ffmpeg is by default missing x264 support and I should compile my own version?

ollypsilon commented 5 years ago

Ok, doesn't matter if it is ffmpeg with x264 or not. I'm quite sure error is raised because of GoPro specific streams in file as ffprobe also returns warnings for these streams: Unsupported codec with id 0 for input stream 2 Unsupported codec with id 100359 for input stream 3 Unsupported codec with id 0 for input stream 4

With this command you can extract just the video and audio portion: ffmpeg -y -i -codec copy -map 0:0 -map 0:1 -write_tmcd 0 I can play the resulting video but untrunc gives errors like: detected keyframe: 0 true: 1 keyframe not detected! Hit enter to continue.

anthwlock commented 5 years ago

Seems to work now, though not perfectly.. You may want to try different step_size values when using -s. For example: untrunc -st 4 -s ok.mp4 bad.mp4

maxbiostat commented 5 years ago

I'm still getting the same error. Can you offer some guidance?

anthwlock commented 5 years ago

@maxbiostat After you have updated your untrunc compilation, it should be as easy as untrunc -s ok.mp4 bad.mp4. As I said, you may want to try different -st values..

The error No codec found! was removed, so it is impossible that you still got that error..

maxbiostat commented 5 years ago

@anthwlock , you are, of course, absolutely correct. Thanks a lot for all the effort. Will consider making a donation.

anthwlock commented 5 years ago

thanks, greatly appreciated!