I have been capturing video from the sky for years. When I used to run Windows, I wrote my own software for making time-lapse movies.
After I switched to Linux (first Ubuntu 9.04, now Linux Mint 7) I had to “reinvent” time-lapse capturing.
Then I came across a nice script that I could modify. Run this script in a terminal:
#!/bin/bashecho TIMELAPSE SCRIPT by DjSadhu
echo "Video device?"
read devnum
echo "Video input?"
read inpt
echo "Frame interval seconds?"
read intv[ -p my.fifo ] && rm my.fifo
mkfifo my.fifomplayer -slave -quiet -input file=my.fifo -vf screenshot,scale=768:576 -tv driver=v4l2:input=$inpt:fps=1:norm=pal:width=768:height=576:\
device=/dev/video$devnum tv:// &
while true
do
echo "screenshot 0" >my.fifo
sleep $intv
name=`ls -tr shot*.png | tail -n1`
mv $name img/timelapse-`date +%y%m%d_%H%M%S`.png
done
This script asks for your video device ($devnum), the video input line ($inpt) and a frame interval in seconds ($intv).
It opens mplayer to display the video live, and starts taking .png screenshots in directory “/img” (create first!)
To close, simply click away the mplayer or the terminal.
Now we have to convert the images into a movie:
#!/bin/bashecho MAKING MOVIE FROM STILLS
echo "Movie width?"
read pix_x
echo "Movie height?"
read pix_y
echo "File type? png bmp jpg"
read filetype
echo "Delete stills when done? (y/n)"
read del_permisif [ $filetype = 'bmp' ]
then
echo "Converting from " $filetype "to png..."
mogrify -format png $filetype/*.$filetype
echo "Moving png..."
rm -r $filetype/*.$filetype
echo "Deleting " $filetype "..."
mv $filetype/*.png img
echo "Done."
fifiletype="png";
FNAME=tl-`date +%y%m%d_%H%M`.avi
cd img/
mencoder mf://*.$filetype -mf w=$pix_x:h=$pix_y:fps=25:type=png -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=5000 -oac copy -o $FNAME
mv *.avi ../avi
if [ $del_permis = 'y' ] || [ $del_permis = 'Y' ]
then
rm -rf *.$filetype
echo Stills deleted
else
echo Stills kept
fi
echo "Finished, press any key to exit"
read anykey
This script asks for a file type (png/bmp) because sometimes I need to convert bitmaps into a movie.
Default is “png” from the “img” directory, but I can choose “bmp” from the “bmp” directory.
Then it runs mencoder to create the movie, and optionally deletes the stills after completion.
I created two links in my main menu (“timelapse” and “makemovie”) and I was ready to capture another day…