Wednesday, May 11, 2011

Journal Post 13 - final proposal

This is the script I've been working on for my final. As of now it takes a movie file, extracts the frames, composites each frame on top of another image, then puts the frames back into a video again. The movie file has to have transparency for this to work well, so animations rendered out of Maya are great. I want to eventually get it so I can batch render out of Maya directly from the script, then composite everything.

Joe and I talked about adding shadows with Imagemagick, but I think I will just use Maya for that. I'll allow the user to render out any lighting they have in the scene. I might have to render out a separate shadow pass, but I'm not sure yet, I'll play around with stuff. I was thinking of also adding an option for the user to color correct the video frames, in case they needed to match them with the background. When I'm done with the script there will be three programs that it uses. They are:

- Maya (batch rendering)
- Imagemagick (compositing, color correct)
- FFmpeg (frame compiler)


Code:

#!/bin/bash

MOVIE=$1
BACKGROUND=$2
OUTPUT=$3
FRAMERATE=$4

echo "script: $0 - Arguments: << input file name >> << background file name >> << output file name >> << framerate >>
echo "arguments used: $@"

mkdir TEMP
mv $MOVIE TEMP
mv $BACKGROUND TEMP
cd TEMP

ffmpeg -i $MOVIE -r $FRAMERATE -f image2 %05d_frame.png

mv $MOVIE ..

IMAGES=`ls *frame.png`
FRAME=0

for IMG in $IMAGES
do
echo "$IMG rendering..."
composite -gravity center $IMG $BACKGROUND $IMG
FRAME=$(expr $FRAME + 1)
done

mv $BACKGROUND ..

ffmpeg -i %05d_frame.png -r 24 -b 2000000 -vcodec libx264 -vpre hq -vpre normal $OUTPUT

mv $OUTPUT ..
cd ..
rm -rf TEMP

No comments:

Post a Comment