macosquicktimeresource-fork

Merge Mac resource fork into Quicktime file


I have a few thousand Quicktime .mov files, which have their "moov" atom in their resource fork instead of in the file itself.

This makes these Quicktime files only playable on a Mac, and only with the Quicktime player.

I can use QT7 to open each file and save it "as a self-contained movie". This seems to merge back the resource fork into the new file, which can then be used normally with other tools and on other systems.

But since I have thousands of files to convert, I need to do that programmatically, with some script or specific tool.

The RezWack utility from Developer tools looked like it would do just that, so I tried

RezWack -d myfile.mov  -r myfile.mov/..namedfork/rsrc  -o newfile.mov

That seemed to indeed merge it into the new file. I can see the "moov" atom at the end of the file when doing a hexdump. However, the resulting QT file is then invalid for Quicktime. And the other tools I tried (ffmpeg, mediainfo and VLC) still complain as before, not seeing the "moov" atom.


Solution

  • The best way I found to merge back the Resource fork and the data fork for these Quicktime movies is to indeed use Quicktime 7, but to do it through an AppleScript so that it can be automated.

    In the end, I made a whole Bash script around it, which I named qt-unfork: https://github.com/mivk/qt-unfork/

    The essence of it is this AppleScript bit, called here from Bash using osascript :

    # variables $in and $out were defined earlier
    osascript - <<END
        tell application "QuickTime Player 7"
            open POSIX file "$in"
            tell front document
                save self contained in ("$out" as POSIX file)
                close
            end tell
        end tell
    END
    

    This will actually open QT7, and you can see it processing the files.

    Note that since this needs Quicktime 7, which is a 32bit app, it of course cannot run on MacOS versions after Mojave (10.14). Later versions only support 64bit apps.