anthwlock / untrunc

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

Opus support #90

Open LukeLR opened 3 years ago

LukeLR commented 3 years ago

Hi everyone,

I use ffmpeg to record my screen, my microphone and my computer audio to an MP4 file with a libx265 and two libopus tracks. However, my battery died during recording, and a recording got corrupt now, as the moov atom appears to be missing. I tried to use untrunc to fix the file using another known-good file recorded with the exact same settings, but apparently it does not support opus. See the output below:

$ untrunc -v 2021-05-04_17-00-20.mp4 2021-05-04_16-02-59.mp4
Info: version '3cf5947' using ffmpeg 'n4.4'
Info: reading 2021-05-04_17-00-20.mp4
Info: parsing healthy moov atom ... 
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.
ftyp_ = 'isom'
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '2021-05-04_17-00-20.mp4':
  Metadata:
    major_brand     : isom
    minor_version   : 512
    compatible_brands: isomiso2mp41
    encoder         : Lavf58.76.100
  Duration: 00:57:58.23, start: 0.000000, bitrate: 459 kb/s
  Stream #0:0(und): Video: hevc (Rext) (hev1 / 0x31766568), gbrp(pc, gbr/unknown/unknown, progressive), 1920x1080, 290 kb/s, 30 fps, 30 tbr, 15360 tbn, 30 tbc (default)
    Metadata:
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 69 kb/s (default)
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
  Stream #0:2(und): Audio: opus (Opus / 0x7375704F), 48000 Hz, stereo, fltp, 89 kb/s
    Metadata:
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
assuming constant duration of 512 for 'hev1' (x104347)
ss: hev1 is_stable: 0
ss: using f=7 span
ss: Opus is_stable: 0
ss: using f=7 span
ss: Opus is_stable: 0
ss: using f=7 span

Info: unknown track 'Opus' found -> fallback to dynamic stats
created dummy track 'free'
removed dummy track 'free'
first_failed: 9 of 101
simpleOrder: 0 1 2 
order ( 101): (0, 2) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (0, 1) (1, 1) (2, 1) (1, 1) 
isTrackOrderEnough: 0  (sz=0)
genPatternPerm of: hev1
0 hev1 -1 0
1 Opus 0 1
2 Opus 0 1
genPatternPerm of: Opus
0 hev1 1 2
1 Opus -1 0
2 Opus 0 1
genPatternPerm of: Opus
0 hev1 0.918296 3
1 Opus 0 1
2 Opus -1 0
has_zero_transitions_: 0
Error: bad track: 'Opus'

Would it be possible to add opus support to this awesome piece of software? Thanks a lot in advance!

Vitor-RT commented 2 months ago

same problem here :/

anthwlock commented 2 months ago

Hey - please send me the files (healthy+broken) and I might take a look at some point (could take a while though). You can upload them on wetransfer (2GB limit) or dropmefiles.net (100GB limit). If you think they are too big, you can use untrunc -sh file.mp4. In case you want to keep the link private, you can send me an email - see my Profile page. Thank you!

Vitor-RT commented 2 months ago

Hey - please send me the files (healthy+broken) and I might take a look at some point (could take a while though). You can upload them on wetransfer (2GB limit) or dropmefiles.net (100GB limit). If you think they are too big, you can use untrunc -sh file.mp4. In case you want to keep the link private, you can send me an email - see my Profile page. Thank you!

I have emailed you the requested files, thank you very much! PS: The files were created with GPU Screen Recorder.