Daily Yard Picture

5 November 2008
5 November 2008

Being that sort of bear, I took a picture of the back yard from our patio every day at 7 am wall-clock time. DST/EST changeovers threw their usual monkey wrenches into the mix, not to mention my lack of attention to the camera’s internal clock settings, but I eventually got 321 pictures of the same scene at more or less the same time of day.

That’s all well and good, but this is the movie age…

The plan: use ffmpeg or maybe mencoder to convert the still images into a movie.

  • Zero: copy the files to a unique subdirectory to protect the originals!
  • One: sort & rename by date
  • Two: resize images
  • Three: convert to a movie
  • Four: . . . profit!
10 November 2008
10 November 2008

I’d uploaded the files whenever I used the camera for something else, so the actual file dates were fairly well scrambled and didn’t correspond to the EXIF data inside the image file. Digikam‘s batch file rename operation can sort out the files in ascending order of EXIF date and rename them into something a bit more uniform & boring like 0001.jpg, which is vital for ffmpeg.

I used the camera’s full resolution, which is much too large for video, so I created Yet Another Subdirectory called Smaller to hold the reduced-size images. Imagemagick‘s convert program then squishes them down:

for f in *jpg ; do convert -verbose -resize 640x480 $f Smaller/$f; done

You can smash them even further to get a teeny postage-stamp movie for your media player.

Make the movie:

ffmpeg -r 3 -i %04d.jpg daily-3.mp4

The file specifier %04d must exactly match the filename sequence and a missing file will stop ffmpeg dead in its tracks. The file names coming out of your camera won’t work if they’re not exactly sequential, which is highly unlikely over the course of the year.

You can use mencoder:

mencoder "mf://*.jpg" -mf fps=10 -o daily800.avi -ovc lavc -lavcopts vcodec=msmpeg4v2:vbitrate=800

Then it’s showtime! I’d upload it, but you don’t have a need to know for our backyard activiites.

There, now, wasn’t that easy?

I didn’t actually figure all this out from first principles, of course. The basics are out there if you rummage around for a while with the obvious keywords.

Memo to self: affix a stable camera platform to the side of the house!

Comments are closed.