PDA

View Full Version : Automizing Shake


crick2x9
01-10-2009, 01:02 AM
hello,

I am a Shake newbie so bare with me. I am using it more as a pipeline tool rather than compositing. I have a "script" that turns my image sequences into an HD quicktime file. Now, I have to import each image sequence individually and slightly rename it and out put it into an HD quicktime file. I have done way too many and I was wondering a way to automize this process. Each image sequence is within its own folder to its correspondent shot. Now they all have the same file structure. Now the tricky part is to have only 3 rendering at one time, one more and my machine will crash. So...

1. I need to import all my sequences at once into shake(with out having to hunt within each shots file structure.
2. tell it to render and maintain 3 renders at the same time. No more, no less.
3. every time it renders have the file renamed (it will be a similar name with only v01 or plate_01 added at the end)

Thing is i have 0 experience in scripting of any kind, but i was thinking if automator could help out.

Sorry for the ignorance guys but it would really be awesome if i could get some help in this matter.

cTennant
01-23-2009, 08:38 PM
you're going to learn a lot doing this, thats for sure. Hope it worked out.

stuckfootage
02-02-2009, 11:05 PM
One of the problems with scripting is getting the duration of each clip.
I worked out a solution for a guy who wanted to create a bunch of Shake
scripts for applying the same time-stretching to each clip. Here's a
summary of how I did it. Maybe you'll find it interesting or useful:

My solution involves learning bash.
Bash is a super nerdy unforgiving scripting environment. However,
if you do a lot of command-line Shake in a large production environment,
it seems to be extremely useful, so I would like to share what I learned
last week. After all, sooner or later we all need to process a bunch
of files through the same Shake script.

Basically bash is a way of taking a bunch of command lines,
and combining them into something you can run as a program.

Here are two excellent resources for learning:
http://www.ibm.com/developerworks/library/l-bash.html
http://www.grymoire.com/Unix/
These two sites are awesome.

__________EXAMPLE ONE

Every bash script includes this line:
#!/bin/sh

Then you just start adding UNIX and/or bash commands.

So copy these two lines into a plain text editor window
and save them as amnesia.sh

#!/bin/sh
whoami

In Terminal you can run your new program!
Use cd to navigate to where amnesia.sh is,
and type

bash amnesia.sh

You will be reminded of your identity.

__________EXAMPLE TWO

Jumping ahead really quickly, here's a technique for
making a loop that will call up the name of
every Quicktime movie in a folder and send
it to some function in your bash script:

cd ./folder_containing_movies
for i in $(find . -name '*.mov');
do
my_fi=`basename $i`
my_function $my_fi
done

__________EXAMPLE THREE

Now we'll define that function: it prints out the name of the movie.
This part of the script must be above the loop
from which it is called.

So here's the complete bash script:

#!/bin/sh

my_function ( )
{
echo $my_fi
}

cd ./folder_containing_movies
for i in $(find . -name '*.mov');
do
my_fi=`basename $i`
my_function $my_fi
done

__________EXAMPLE FOUR

In order to have shake do something with these movies,
you could, in the example above, replace

echo $my_fi

with

shake $my_fi

but then you'd just get the first frame, and you'd
have to quit each Viewer to see the next movie.
For normal fully-tweaked dozens-of-nodes Shaking, one would use

shake -exec my_script.shk

The problem is that it's difficult (impossible?) to pass variables
like my_fi into my_script.shk. I was unable to do it--
probably because I'm just a beginner--
so I used bash to replace key words in a template,
scriptTemplate.shk, to write one shake script for each movie.

To do this, you need to replace parameters in the Shake script
with words that can be searched and replaced. In your Shake
template, the FileIn filename can be something like SEDmy_fi.
In bash you can use the sed command to search and replace
the expressions in the template:

sed -e 's/SEDmy_fi/'$my_fi'/g' scriptTemplate.shk > ./scripts_out/${my_fo}.shk

This does the search and replace, then writes a shake script
named automatically by my_fo, another variable you've created:

my_fo=`echo $my_fi | sed 's/.mov/_output/'`

__________EXAMPLE FIVE

At this point your head is totally spinning. Don't worry.
This is not a tutorial; I'm just trying to sketch out
the broad ideas here. You'll still have to learn bash
for this to make sense.

As a special bonus, here's a really useful bash command I stole from Olli
at vfxtalk.com to get the timerange of a movie using shake -info :

timerange=`shake ./folder_containing_movies/$my_fi -info 2>&1 | grep Duration | sed 's/info: Duration: //'`

You could then use $timerange elsewhere in your bash script.


Les

CGTalk Moderation
02-02-2009, 11:05 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.