LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories
User Name
Password
LinuxQuestions.org Member Success Stories Just spent four hours configuring your favorite program? Just figured out a Linux problem that has been stumping you for months?
Post your Linux Success Stories here.

Notices


Reply
  Search this Thread
Old 01-15-2008, 12:58 PM   #1
frieza
Senior Member
 
Registered: Feb 2002
Location: harvard, il
Distribution: Ubuntu 11.4,DD-WRT micro plus ssh,lfs-6.6,Fedora 15,Fedora 16
Posts: 3,233

Rep: Reputation: 406Reputation: 406Reputation: 406Reputation: 406Reputation: 406
stop motion tutorial


a friend of mine and I recently got into experimenting with stop motion animation
It takes alot of time but if done properly can provide impressive results
I will post a general tutorial on how to create basic stop motion animation using linux

required.hardware/software (bare minimum)
1. a camera (optionally a scanner for film cameras or a frame grabber for a webcam)
2. animated gif software (this tutorial will use the GIMP)
3. mencoder (part of the mplayer package)
4. a video editing software such as LIVES (i am not familiar enough with this part yet to post a tutorial but will add it when i become more familiar)
5. ffmpeg to encode as vcd or dvd
6. vcdimager (or equivelent for dvd)
7. cd or dvd burner/cdrdao for vcd images

This tutorial will be divided into 2 sections, filing and post processing
for filming
first of course will be filming this is the easy part to explain
first, chose your subject matter, be it clay figures, action figures, legos, paper cutouts, human subjects or a combination of one or more of the above
second, make sure your lighting is decent for what you want to do
third, make sure the camera is mounted solid on a tripod or other similar setup to keep the shot as steady as possible, the camera should be set to a resolution of 640x480 for digital cameras
shoting stop motion animation is a simple concept, take a shot, move the subject(s) slightly in the direction you want it to move and take another shot, keep in mind that the raw animation will more then likely come out to be approximately 8 frames per second, however the less movemment inbetween frames the smother the motion but i usually end up with about 8fps
for digital cameras the frames will be stored on the memory card until done with the shot, for film cameras you have the additional task of having the film developed, scanning through the frames to make sure they are correct then scanning the good frames one by one using a scanner
for webcams the frames will be aquired with a frame grabber directly onto the harddrive of the computer
this is about as much detail as i can give on actual filming because specific procedures vary based on subject material

now that you have shot your film, download the frames onto the computer or scan them if you did them on film, if you used a webcam with framegrabber you you already should have the frames in place

assuming the frames are in IMG_XXXX.JPG format (case sensitive) and you are using linux you can use the following script to reverse the order of the frames so the last is first and visa versa (this is because when loading the frames as layers the GIMP does so in reverse order so reversing them first allows them to be put in place in the correct order)
Code:
ls IMG*.JPG | awk '
{
  files[++c] = $0
}
{ d=c }
END {
  for (i=1;i<=c;i++) {
    revfile = files[d--]
    if ( revfile == files[i] ) exit
    # this part do the swapping
    cmdtemp = "cp " files[i] " temp "    
    mvcmd = "mv " revfile " "files[i] 
    mvback = "mv temp " revfile
    system(cmdtemp)
    system(mvcmd)
    system(mvback)
  }
}'
open the GIMP load the last file on the list (the first frame of the animation)
then use 'open as layer' and hilight the rest of the frames by shift clicking the first and second to last file and wait for each frame to load
once the frames are all loaded, save as filename.gif
it will tell you gif cannot handle layers etc.. select 'save as animation'
it will convert all the frames to gif then give you the option to put in some inforation about the picture, you can put whatever or leave it default
once this is done you then have an animated gif you can then load in your favorite web browser to test
if that works you can then encode it as an avi using mencoder
Code:
mencoder filename.gif -ovc lavc filename.gif -fps xx -o filename.avi
where xx is the number of fps, at this point usually 8, but be prepared to do a bit of experimentation to make it right, you can check using
Code:
mplayer -framedrop filename.avi
once this works you can upsample the file using ffmpeg to 25 fps which isrequired for uploading to youtube or making into a dvd or vcd
Code:
ffmpeg -r xx -i filename.avi -r 25 25fpsfilename.avi
where xx is the same as the frame rate you encoded it at originally
then you can open a video editing program such as lives
open the video clip in lives
then under the 'audio' menu open the audio track
if you have more then one clip, open each clip, copy to the clipboard and add after selection and then make sure to have the whole clip slected
keep doing this until your video matches the lentgh of the audio track as closely as possible ( a few frames off in either way wont kill)
then 'encode as' using whatever works, the default should be fine saving as filenamewithsound.avi
play this using mplayer to make sure it workes
Code:
mplayer -framedrop filenamewithsound.avi]
then if you plan on uploading it to youtube you can either stop here or encode it to mpeg to save on upload time
if you are encoding it to vcd/dvd you should do the following anyways
Code:
ffmpeg -i filenamewithsound.avi -target vcd(dvd) mpeg.mpg
at this point you can upload it to youtube, myspace etc.. if that is where you want to put it
if you want to burn it you have a couple extra steps

for vcd (i havnt done dvd, yet) you can then create the vcd image using
Code:
vcdimager mpeg.mpg
then burn it using
Code:
cdrdao write --device=/dev/hdX videocd.cue
where X is the letter of the burner, usually hdb, hdc, or hdd depending on whether it is primary slave or secondary master or slave, or if its the same as the cdrom /dev/cdrom will work
note vcdimager creates 2 files, videocd.bin videocd.cue the cue file tells the burner how to write the .bin file so videocd.bin SHOULD be entered literally
once this is burened, if your dvd player supports vcds, turn on the tv, put the disc in the dvd player and play it

i did the following as a demonstration (warning, not appropriate for small children)
http://www.youtube.com/watch?v=ITUkYA-V1Ds
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Error with "SDL_MouseMotionEvent *motion = event->motion;" aatwell Programming 3 11-30-2007 01:46 PM
Stop motion animation, webcam, +++ Durham Linux - Software 1 08-21-2005 08:29 PM
Trying To Create Stop Motion Animation Using JPEG2YUV...sorta works bluefire Linux - General 1 08-16-2005 11:29 PM
mouse motion xlord Linux - Newbie 1 06-14-2004 01:38 PM
In Motion... Or Not.. robhargreaves Linux - Software 1 05-20-2004 03:10 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General > LinuxQuestions.org Member Success Stories

All times are GMT -5. The time now is 11:35 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration