Sunday, May 8, 2011

IFDM 210 -Final Project-

For my final project I made a script that opens and runs my altered pygame, saves every 5th image, and then adds an effect, and compiles them into a movie.

Not only did I use ffmpeg and imagemagick to alter still frames, but I also worked to create a script that first called my pygame in bash an ran it quickly (which I had been trying to get to work since we began working with terminal). Before, to run it I had to enter the python module and go through multiple commands just to open the game window, which was very tedious while I was altering and improving on it. Now, my code not only opens the game in a split second, but runs it as well.

With the addition of the code I added to the original pygame code, run.sh now also takes every 5 frames from the game, and saves them out in the pyspaceinvaders folder (inside the Game folder) as .png images.

From here, am able to use imagemagick and ffmpeg to alter them further, and compile them into a movie.

I call them with imagemagick, to cycle through the still frames and apply a swirl effect with a for loop. After this is completed, I coded ffmpeg to take those images, and compile them into a movie, and after doing so, delete the excess still frames remaining in the folder.

Overall, I used 3 different programs. Through the terminal, I used Python, (which has a different syntax than bash and requires more specified spacing), and before this project, I had been unsuccessful in making it run through a bash script. I also used imagemagick to alter the saved still frames, and then ffmpeg to compile them into the movie.

This project was very difficult for me, but in the end I figured it out, and I'm glad I did, because now I have a new outlook on programming, and will be using it more in the future.


LINK TO .ZIP FOLDER:

http://dl.dropbox.com/u/18940217/Bmoody210_Final.zip


EXAMPLE RESULT:

Saturday, May 7, 2011

ffmpeg test example movie

Project History Links

http://dl.dropbox.com/u/18940217/FinalProject_TerminalHistory.txt


http://dl.dropbox.com/u/18940217/TerminalFinalHistory_2.txt


These are the links to the history files for both my final project, and the test. I tend to leave my terminal running as long as possible so I can continue my work, so that is why there are only wo, but they are quite long.

Wednesday, May 4, 2011

Trying to figure out how to save each frame of a played video game as an image

I have been researching and working on this for a while now, for my final project.

I originally was going to do something using imagemagick and combining pictures, but I really like compiling image frames together to make a movie like we've been doing with ffmpeg.
I found something that my seem to work...


NEVERMIND_ Half way through this I tried something new, and it's moved me a little farther than it did before,

a window pops up now, but then it disappears,

I started using i instead of self.framenum, because it kept throwing an error on that, the window then began to pop up but threw an error saying that i was referenced before it was defined, so i went through and fixed this, and now it is saying this for my variable name file, but no longer for i- so I am making progress...

FFmpeg Test/homework

This is my ffmpeg code from the test/homework


It takes the still frames out of a movie, adds the frame numbers and an effect to each image (I have edge written in here, but it can be any imagemagick effect,I used sketch and charcoal too, but this one takes the least amount of time)


After it applies the effect to each image it then compiles them back into a movie called edge.mov and then deletes all the image files, so none are left behind.


Then you can play the video and see the effects it has, and the frame numbers.


I had alot of trouble with this assignment at first, but once I had time to sit down and work through it, I began to figure it out, and I'm really glad we got to do it as a homework assignment as well, because now that I've gotten it, I feel so much better on this subject.




rm edge.mov


ffmpeg -i jumps.mov -s hd720 -f image2 %07d-fresh.png

for((i=1; i<50; i++))

do

fresh=`printf "%07d-fresh.png" $i`





STRING="Frame Number $i"

echo $STRING



mogrify $fresh -draw "text 25,25 '$STRING'" $fresh

convert $fresh -edge 2 $fresh.bmp


#convert $fresh -colorspace gray -sketch 0x20+120 $fresh

#convert $fresh -colorspace gray \

#\( +clone -blur 0x2 \) +swap -compose divide -composite \

#-linear-stretch 5%x0% $fresh

done


ffmpeg -f image2 -i %07d-fresh.png.bmp -r 25 -b 10000k -s 1200x720 edge.mov


rm *.png

rm *.png.bmp

Thursday, April 21, 2011

INK

I recently watched the independent Sci-fi movie titled, "INK"


It was really cool, it was full of effects and interesting CGI, and it had a good story as well.
At first it was a little confusing with all the artistic effects they were employing, but after I got used to the rhythm of the film, I fell in love with it.
It also was filmed in Denver, CO which is where I'm from, and I actually met the director a few years ago, so It was cool to watch for that reason as well.

These are the kind of uses and computer effects I am interested in when it comes to film. How they used their effects worked very well. They had drawers that had been just smashed over someone's head fixing themselves in mid-air, and color filters that I have never seen before. It was a cool movie, and I highly recommended it.

Scripting

http://www.youtube.com/watch?v=0f4JsvZVNag

This is the scripting tutorial I have been trying to complete and get to work over the last week. I can get to the point where I have names my program and put what it will say inside, but I can't get it to show upon my desktop. I have been searching for some others- I already have learned how to run a pygame on my computer and play it through terminal

The scripting I have done for that (for pyspaceinvaders) is as follows:

import os
os.chdir('/pyspaceinvaders')
import pyspaceinvaders

(this is after you have successfully downloaded pygame and pyspaceinvaders to your computer)
It's actually really simple compared to what I thought this would be like before.

I am continuing to look for other interesting scripts- I'm trying to find one that will show me how to write a game!