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: Apple, Macintosh, OS X, Panavision Genesis, software, unix, vfx