How to create an amazing stop-motion GIF in a flash

Two days ago I was a bit bored doing home office. I love tea, and in between meetings and emails I decided to make myself one. Somehow I thought it was a great opportunity to create a stop-motion video. Never done it before in my life.

I set up the stage using two large books, two drum sticks and my iPhone. I plugged the earphones so I could shot the photo without touching the phone (this is very important to keep the stop-motion efect working).

After preparing the tea (and taking lots of photos of the process) I downloaded the images to my mac using Image Capture (a small software that comes with the mac. Just hit Cmd + Space and type Image Capture and hit enter).

Photos on my desktop, I started looking for different options to create my GIF file. I knew Google Photos creates animations, but I had 175 photos! That’s too much to handle by Google Photos.

I looked at some web pages that create GIF animations, and even watched a youtube demo on how to create GIFs in Fireworks (designers, please don’t hate me. I still use Fireworks).

Anyway, I found out some commands that could do the trick. And that’s what I finally ended up using.

Step 1: Make photos smaller

There’s a command called sips that allows you to change the size of images as a batch (that means many photos at once). This command comes with the mac already.

sips -Z 640 *.JPG

That command changes the size of all JPG files in a given folder to 640px (either vertically or horizontally depending on the orientation) keeping the aspect ration (so the largest side will be 640px).

Step 2: Create the animated GIF

Turns out there’s another command to do this.

convert -delay 15 -loop 0 *.JPG animated.gif

This command does not come with the mac. It’s part of what’s called ImageMagick, a suite of tools to edit images via command line. You can get it here or install it using Homebrew as explained in this answer at Stackoverflow.

This sample command creates a looping GIF with all .JPG files (in the same order as seen on the Finder) with a 15/100 of a second delay between images. You can tweak that number to suite your needs.

Step 3: Convert it to a video file (Optionally)

I did this to change the 54MB GIF file to a 7,5MB mp4 file. Guess what. I used another command.

ffmpeg -f gif -i animated.gif animated.mp4

This simple command uses ffmpeg to convert the gif to a mp4 video file. Ffmpeg does not come with the mac, but you can easily get it from here.

And that’s it

As simple as that. Here’s the complete script I used.

# compress photos
sips -Z 640 *.JPG

# generate gif
convert -delay 15 -loop 0 *.JPG animated.gif

#convert gif to video (much smaller file size)
ffmpeg -f gif -i animated.gif animated.mp4

And here is the stop-motion video I created.

http://lacachedecake.com/nico/wordpress/wp-content/uploads/2016/05/outfile2.mp4


Originally published at La caché de Cake.

One clap, two clap, three clap, forty?

By clapping more or less, you can signal to us which stories really stand out.