Recover MP4s from Canon format

Using PhotoRec to recover lost data
Forum rules
When asking for technical support:
- Search for posts on the same topic before posting a new question.
- Give clear, specific information in the title of your post.
- Include as many details as you can, MOST POSTS WILL GET ONLY ONE OR TWO ANSWERS.
- Post a follow up with a "Thank you" or "This worked!"
- When you learn something, use that knowledge to HELP ANOTHER USER LATER.
Before posting, please read https://www.cgsecurity.org/testdisk.pdf
Locked
Message
Author
hendry
Posts: 5
Joined: 21 Jul 2018, 13:52

Recover MP4s from Canon format

#1 Post by hendry »

Hi there,

I think my Canon G7X mkII formats the sdcard as exfat. After importing the mp4s into FCPX, I format the sdcard. Unfortunately something went wrong with the import.

https://twitter.com/kaihendry/status/10 ... 4167389184

I reached for photorec, and I must say a big thank you already, since it's helped me in the past with deleted JPGs. Thank you Christophe!

However with:

Code: Select all

photorec --version
PhotoRec 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org

Version: 7.0
Compiler: GCC 4.2
Compilation date: 2017-09-21T18:26:54
ext2fs lib: none, ntfs lib: none, ewf lib: none, libjpeg: none, curses lib: ncurses 5.7
Eemed0ae
OS: Darwin, kernel 17.6.0 (Darwin Kernel Version 17.6.0: Tue May  8 15:22:16 PDT 2018; root:xnu-4570.6
I get a bunch of files that look like: https://s.natalian.org/2018-07-21/recovery.txt which don't play.

I searched the forums and found references to this issue like:
viewtopic.php?f=4&t=3096
Chapter 13's https://www.cgsecurity.org/testdisk.pdf
viewtopic.php?t=6294

But I am puzzled, since I don't see the mov/mdat Recover mdat atom as a separate file option in File Opts. Do I need to compile the newer 7.1-WIP version?

I also don't see the consecutive pattern in https://s.natalian.org/2018-07-21/recovery.txt

What am I missing?

I don't mind supplying the 64GB disk dd, since it's content for my public vlog in any case.

Thank you in advance,

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Recover MP4s from Canon format

#2 Post by cgrenier »

Yes you need to use the 7.1-WIP version. Binaries for this version are available.

hendry
Posts: 5
Joined: 21 Jul 2018, 13:52

Re: Recover MP4s from Canon format

#3 Post by hendry »

Thank you for your reply Christophe!

I installed 7.1-WIP via Archlinux's AUR.

Code: Select all

[hendry@t480s day14]$ photorec --version
PhotoRec 7.1-WIP, Data Recovery Utility, June 2018
Christophe GRENIER <grenier@cgsecurity.org>
https://www.cgsecurity.org

Version: 7.1-WIP
Compiler: GCC 8.1
ext2fs lib: 1.44.2, ntfs lib: none, ewf lib: none, libjpeg: libjpeg-turbo-1.5.3, curses lib: ncurses 6.1, zlib: 1.2.11
OS: Linux, kernel 4.17.3-1-ARCH (#1 SMP PREEMPT Tue Jun 26 04:42:36 UTC 2018) x86_64
I am still very puzzled about the link between the mp4 and mov file names. Can you show me an example https://s.natalian.org/2018-07-22/recovery-7.1-WIP.txt ? They don't appear to be consecutive.

I am expecting to recover about 43 mp4s. I do know the name of the files from the failed import. I wonder if that helps me. E.g. MVI_8845.MP4

User avatar
cgrenier
Site Admin
Posts: 5432
Joined: 18 Feb 2012, 15:08
Location: Le Perreux Sur Marne, France
Contact:

Re: Recover MP4s from Canon format

#4 Post by cgrenier »

Usually you have to concat a small file and a big one. The number in the filename of the small mp4 is bigger than the number in the filename of the big mp4.
ie cat f0034304.mp4 f0034048.mp4 > /tmp/playme.mp4

hendry
Posts: 5
Joined: 21 Jul 2018, 13:52

Re: Recover MP4s from Canon format

#5 Post by hendry »

Playback doesn't work unfortunately. ffprobe reports

Code: Select all

[mov,mp4,m4a,3gp,3g2,mj2 @ 0x560f8d1eb300] st: 0 edit list: 1 Missing key frame while searching for timestamp: 1000
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x560f8d1eb300] st: 0 edit list 1 Cannot find an index entry before timestamp: 1000.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x560f8d1eb300] Found duplicated MOOV Atom. Skipped it
[aac @ 0x560f8d1f0d80] channel element 3.6 is not allocated
[h264 @ 0x560f8d1ed5c0] Invalid NAL unit size (0 > 123564).
[h264 @ 0x560f8d1ed5c0] Error splitting the input into NAL units.
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x560f8d1eb300] decoding for stream 0 failed
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x560f8d1eb300] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none(pc, bt709), 1920x1080, 34322 kb/s): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/tmp/playme.mp4':
  Metadata:
    creation_time   : 2018-07-20T01:07:28.000000Z
    major_brand     : mp42
    minor_version   : 1
    make            :
    make-eng        :
    model           :
    model-eng       :
    copyright       :
    copyright-eng   :
    compatible_brands: mp42avc1CAEP
  Duration: 00:00:19.32, start: 0.000000, bitrate: 108 kb/s
    Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none(pc, bt709), 1920x1080, 34322 kb/s, 50 fps, 50 tbr, 50k tbn, 100k tbc (default)
    Metadata:
      creation_time   : 2018-07-20T01:07:28.000000Z
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s (default)
    Metadata:
      creation_time   : 2018-07-20T01:07:28.000000Z
The meta data seem alright. Can't play back the video in mpv.

hendry
Posts: 5
Joined: 21 Jul 2018, 13:52

Re: Recover MP4s from Canon format

#6 Post by hendry »

I got another sdcard, low level formatted it. Then I took a single video and formatted it and ran through the same procedure.

I found this resulting /tmp/w2.mp4 to work:

Code: Select all

[hendry@t480s recup_dir.1]$ file f*
f0040960_mdat.mov: Apple QuickTime movie (unoptimized)
f124700416.mp4:    ISO Media, MP4 v2 [ISO 14496-14]
[hendry@t480s recup_dir.1]$ cat f124700416.mp4 f0040960_mdat.mov > /tmp/w2.mp4
But I am confused. 40960 < 124700416. How am I supposed to figure out the ordering for https://s.natalian.org/2018-07-22/recovery-7.1-WIP.txt ?

hendry
Posts: 5
Joined: 21 Jul 2018, 13:52

Re: Recover MP4s from Canon format

#7 Post by hendry »

I wrote a script that has helped me recover my MP4 files!

Code: Select all

cat check.sh
mp4=$(basename $1)
for i in recup_dir.1/*.mov
do
        cat $1 $i > output/$mp4
        if ! ffprobe output/$mp4 2>&1 | grep -q NAL
        then
                echo bingo $1 $i
                echo mpv output/$mp4
                exit
        fi
done
Thank you for your time!

Also made a video: https://www.youtube.com/watch?v=xRCRg_8nYPQ

Locked