Recovering from Canon's Quick Initalize

Discussion in 'Digital Video' started by excommie, Aug 22, 2016.

  1. excommie macrumors regular

    May 12, 2009
    I did something really stupid. I imported my clips from Canon Vixia into iMovie. Without checking to see if the footage imported, I grabbed the camera and performed "Quick Initilize" on the camcorder. Later I found out that iMovie crashed and my footage was not in the library.

    Anyway, I downloaded photorec and testdisk. Scanned the contents of the card and found the TS files. There is hundreds of them, spread across 30 folders or so. I tried some freebie tool to combine the TS in a coupple of folders but it seems to be combining them out of sequence.

    Any ideas how to convert the TS to avi or mp4? Could I just use a unix/shell script to list the files in each folder and create 1 TS file per folder? Not sure if this will work or if the files will still be out of sequence.

    I'm really not sure how Canon stores the TS files...

    Thanks for any insights.
  2. organicCPU macrumors 6502a


    Aug 8, 2016
    I assume your recovered files are playable video sequences with .ts file extension, but out of order.
    Depending on the recovery, there could be original metadata in the file. If you can check the metadata, you will find out if the file creation/modification date is the original one, not the recovered one. If it is the original date, you can rename your hundreds of files by your recording timestamp to sort them to the right order and afterwards convert and join them.

    First make a backup of your recovered files!

    The following idea involves Phil Harvey's exiftool:
    To find out, if the metadata of your recovered files will help you, type in terminal with your adapted paths and filenames:
    /path/to/exiftool /path/to/ts/files/folder/nameOfTsFile.ts -s
    If you see something like FileModifyDate and the date of your recording you can rename the files to that date to order the sequences. You can dry run the action by adapting the following command:
    /path/to/exiftool -d %Y%m%d_%H%M%S_%%f.%%e "-testname<FileModifyDate" /path/to/ts/files/folder -ext ts
    If you are satisfied with the new file names make the change with your appropriate paths and Exif-metatag:
    /path/to/exiftool -d %Y%m%d_%H%M%S_%%f.%%e "-filename<FileModifyDate" /path/to/ts/files/folder -ext ts
    If that works you are on a good way, if not there might be better recovery tools around.

    It's possible that Handbrake and ffmpeg can then help you joining and converting your TS files, depending on the exact codec. Maybe the freebie tool you already used is also working better with the renamed files.

    Every conversion has quality loss. If you import to iMovie it's another conversion. You could check what's inside your .ts-files with a tool like the depreciated VideoSpec by houdini Software and try to remux the container without changing the codec with a tool that can handle your codec.
  3. excommie thread starter macrumors regular

    May 12, 2009
    Thanks for the detailed explanation, but I was able to recover without exiftool, the solution was quite simple (I do have all ts files recovered from camcorder, thanks to photorec free utility).

    1. in terminal cd to the directory with all the ts files
    2. List and combine all *ts files: cat $(find . -name \*ts | grep -v result | grep -v combined.ts) >> combined.ts
    3. Open the combined.ts file in QuickTime. Export to 1080 file (mov format).

    Before starting this, I had no idea that I could use unix cat to combine the ts files.
    I don't see any quality loss, but that's subjective. My source was in 1080p, the results are in 1080p. Perhaps I have lower bitrate on the combined.ts file, but I'm happy I recovered the footage.

  4. organicCPU macrumors 6502a


    Aug 8, 2016
    Exiftool wasn't meant to recover the files, but to sort and rename the files by recording date.
    Thanks for sharing the clue with the cat command. Great that you got your lost files back working.
  5. excommie thread starter macrumors regular

    May 12, 2009
    Thanks, I'll check out Exiftool. Sounds like it could be useful in the future...

Share This Page