Reading Quicktime Timecode in After Effects Redux: A Solution

When we were last talking about reading timecode from FCP sourced Quicktime’s I followed a tangent into Spotlight and other OS X technologies. Well, recently I revisited this problem for another project I’m working on and I think I’ve got a working solution for reading embedded timecode in After Effects on OS X.

timecodereader is a command-line utility that takes a path from After Effects via system.callSystem() and returns either the embedded timecode or the string . Right now the included .JSX script just writes that information to the console, but there are a lot of cool uses for Quicktime timecode in productivity scripts.

How to Use timecodereader

Download the zip archive, and either compile a new binary from the included XCode project or move the already compiled binary from build/release to a local binary directory. Since this is a command line tool you will want to move it to a location in your Path statement so you can use system.callSystem(“timecodereader ” + String(thisItem.mainSource.file))” instead of system.callSystem(“/path/to/timecodereader ” + String(thisItem.mainSource.file)) .

Update 09-09-2006: Lloyd Alvarez points out at aenhancers that AE preferers ~/bin/timecodereader when we set up as below. I’ve adjusted the enclosed script.

In the default Bash shell

export PATH="$PATH:~/bin"
echo 'PATH="$PATH:~/bin"' >> .profile


will setup a path to bin in your User directory. Move the enclosed script to your Scripts folder, select a Quicktime file in the Project window and we’re done.

When I run the script, I get these results (The 1:00:00:00 timecode is due to the fact that I’m using writeln to write to the console so the previous lines scroll up until they are out of view).

After Effects Project Window with Quicktime selected
After Effects Info Window with timecode displayed

I’ve tried timecodereader with quite a few Quicktime’s but obviously there might be a few that aren’t handled well, so consider this a beta release. The compiled binary is a universal binary so it should work on both PowerPC and Intel platforms. One gotcha, is that if you have a codec that is not compiled for the supported platform you might get a dyld returns 2 log message that might futz with your script. You can either work around it via string handling or remove the codec since it won’t work anyway. You’ll need to turn on Allow Scripts to Write Files and Access Network and turn off Enable JavaSript Debugger so we can eat the errors.

timecodereader requires After Effects 7, and OS X 10.4+

Updated file: 09.09.2006

Fixed a problem with external Hard Drives and Mounted Volumes. After Effects does not add /Volumes/ to drive paths like OS X, so /Volumes/MyHardDriveName is reported as /MyHardDriveNameI’m basically checking all mount points and adding /Volumes when appropriate, unfortunately the response is a bit slower if you have disk images or a lot of volumes mounted. If anybody knows anything faster send it my way.

Also. I’m using metadata checks for com.apple.quicktime-movie to check whether the file is a quicktime file. This only works on volumes that are indexed, so it might not work on mounted server volumes. I can add alternative QT detection if anybody finds it useful or necessary.

Zip Archive of Binary, Script and XCode Project

10 Comments

  1. Mel Matsuoka said

    Nice hack, I have to say! But I still haven’t figured out how to utilize this script in a real-world fashion.

    I need to recreate a sequence which was cut in FCP in my AE comp (using the same media, of course). The media/sequence was consolidated with 30 frames of handles.

    The timecodereader script only seems to return the timecode of the first frame of the .mov file. What I would like it to do is return the timecode number of the selected clip’s frame which is currently under the timeline cursor. That way, I can look at the EDL from the FCP timeline, and just slip/slide the layers in AE to match the timecodes.

    Is this even possible using these hacks you came up with? Or do I still have to shell out the big bucks for a copy of Automatic Duck? 😛

  2. Mel,

    Thanks for the kind words.

    That way, I can look at the EDL from the FCP timeline, and just slip/slide the layers in AE to match the timecodes.

    Your best bet to handle this kind of thing is to use FCP-XML. I’ve written a post about working with FCP-XML in AE via sripting.

    Moving Between Final Cut Pro and After Effects: The Scripting Option

    The timecodereader utility is handy for working with FCP timelines, but you need to do a bit of work via scriptiing to calculate from the first frame, so it helps to have some scripting experience to work with these tools.

    Is this even possible using these hacks you came up with? Or do I still have to shell out the big bucks for a copy of Automatic Duck?

    I’m a big fan of Automatic Duck, it’s a great piece of software. It’s definitely possible to do similar kinds of things with scripting, but you won’t be able to duplicate the seemless experience you get with such well designed software. I use scripts and hacks to develop custom workflows and project management solutions, but I still use Automatic Duck daily for project integration between AE and FCP.

  3. […] found myself deep into the Quicktime API before and the modernization of the Quicktime architecture can’t come too soon. Unfortunately, […]

  4. stib said

    Thanks for the timecode reader app. It’s amazing that Apple don’t provide an easier way to access timecode from quicktime files. For that reason I’m trying to use timecodereader in an applescript application that reads timecodes from quicktime movies. But it doesn’t seem to be returning a value on stdout. If I do

    set startTC to do shell script “timecodereader /Volumes/media/mymovie”
    the result is “”
    If I run the same script in the terminal I get the correct result. Do you know what could be going on here?

  5. stib said

    Oh btw I also tried doing this in the shell:
    timecodereader ‘Volumes/media/mymovie.mov’>>~/Desktop/test.txt
    and the resulting text file was blank.

  6. stib said

    Oh, got it. I had a look at the source, and changed

    fprintf(stderr,”%sn”, [timecodeString fileSystemRepresentation]);
    to
    fprintf(stdout,”%sn”, [timecodeString fileSystemRepresentation]);

    ..and it worked. That was a lucky guess!

  7. Dale said

    Hey stib,

    Good catch! That’s certainly a more general purpose solution.

    Dale

  8. Benjamin said

    Dear Dale,
    Many thanks for this very useful app!
    Is it possible to obtain with timecodereader also the end timecode of a Quicktime file?
    Thanks!

    • admin said

      Hi Benjamin,

      I’ve always just used the length and done the timecode math externally. This code was really more of a proof of concept, so I don’t think I’d be able to add that feature. Thanks for the reply.

      Dale

      • Benjamin said

        Thank you for your reply.
        if not the duration then can the length be obtained with timecodereader? Or I suppose it could be retrieved using an Applescript.

RSS feed for comments on this post

Comments are closed.