command-line batch processing of clips with Shake

This post is going to be very geeky, and is probably only relevant for those of you who do any film editing or VFX work.

Today I needed to process a few clips with Shake to convert their colorspace from Panalog to linear. Rather than just do a bunch of pointing and clicking in the Shake gui to process each clip, I figured it might be worthwhile to spend a little bit of time scripting now to save a lot of time and finger joint wear and tear later.

I wanted my script to process any clip thrown at it, and to render out the result as a 1920×1080 Apple Prores 422 QuickTime file at 23.98fps. The script would append “_PL” to the filename before the extension to indicate that a panalog conversion had been done, so if the original file was A38.mov, the resulting file after running the command “myscript.sh A38.mov” would be “A38_PL.mov”.

I typed “shake -help |& less” to browse through Shake’s available command line arguments, and to find out how to address the “panalog4lin” macro I would be using to do the conversion.

There were two problems that made this a not-so-straightforward task. The first was that there is no way that I can find to tell Shake what kind of QuickTime file you’d like it to write (most professional users likely have it write out individual Cineon or DPX files for each frame, which would have been a simpler solution but didn’t fit our workflow). I found in the manual how to set Shake’s default QuickTime format, and set it to ProRes 422 1920×1080 in a .h file. The second problem was that Shake only renders out one frame by default unless you tell it the time range you’d like it to render. My script would have to know the duration of a clip to process all of its frames. Luckily I could use Shake’s “-info” flag to determine the duration of a clip.

Here’s the script (looks pretty simple eh?):

#!/bin/tcsh
set duration = `shake "$1" -info |& grep "Duration" | cut -d ":" -f 3`
shake -fi "$1" -t $duration -panalog4lin 1 1 -fps 23.98 -fo "$1:r_PL.mov"

I wanted to apply the conversion to all of the clips whose name contained the string “AT”, so I typed the following at the tcsh prompt:

% foreach foo (*AT*)
foreach? echo "processing $foo"
foreach? myscript.sh "$foo"
foreach? end

I walked away, ates some food, came back, and a set of clips that had been converted to linear space were sitting there waiting for me. Excellent!

Technorati Tags: , , , , , ,

Leave a Reply

Subscribe without commenting

del.icio.us:command-line batch processing of clips with Shake digg:command-line batch processing of clips with Shake spurl:command-line batch processing of clips with Shake wists:command-line batch processing of clips with Shake simpy:command-line batch processing of clips with Shake newsvine:command-line batch processing of clips with Shake blinklist:command-line batch processing of clips with Shake furl:command-line batch processing of clips with Shake reddit:command-line batch processing of clips with Shake fark:command-line batch processing of clips with Shake blogmarks:command-line batch processing of clips with Shake Y!:command-line batch processing of clips with Shake smarking:command-line batch processing of clips with Shake magnolia:command-line batch processing of clips with Shake segnalo:command-line batch processing of clips with Shake gifttagging:command-line batch processing of clips with Shake
5 recent posts you may have missed
  1. Garmin GPS watch vs. iPod Nike+ kit
    2008-12-02 10:57:24
  2. Get Your War On Animation (possibly not safe for work)
    2008-11-28 00:15:27
  3. lists of photo contests
    2008-11-26 23:04:02
  4. Excessive Packaging
    2008-11-26 22:36:22
  5. Crowdsourced news of Mumbai attacks
    2008-11-26 16:12:50