Creating Animated Gifs from 3D Movies (HSBS to Gif)

by @edent | , , , , | Read ~1,569 times.

A few days ago, I posted this animated gif that I'd created from the 3D Doctor Who Special.
Doctor Who 3D Fex

I created that gif manually, but I wondered if it was possible to create such an animation in an automated fashion. Turns out, it's pretty easy! This relies on ImageMagick - which is a powerful image manipulation tool. All of these scripts work on Ubuntu - and they should work on any GNU/Linux disto as well as Windows and Mac.

Get Your Image

I just pressed "Print Screen" while watching a Half-Side-by-Side (HSBS) movie in full screen. You can use mplayer or VLC to capture the image if you wish.

For mplayer, you can run this simple command to grab a single frame at the 20 minute and 5 seconds mark

mplayer video.avi -frames 1 -vo jpeg -nosound -ss 20:05

You should end up with an image like this - which we'll call "2D.jpg".
Doctor Who 3D Fez

Split the Image

We want the left and right image separated.

mogrify -crop 50%x100% 2D.jpg

This will result in two files: 2D-0.jpg and 2D-1.jpg.

Warning: this will destroy your original image. Make sure you have a backup.


HSBS means that the aspect ratio of each image is squashed. We want to stretch each one back to full width.

mogrify -resize 200%x100% 2D-0.jpg
mogrify -resize 200%x100% 2D-1.jpg

The two JPGs files are replaced by images with the correct aspect ratio.

The split and stretch commands can be amalgamated into:

mogrify -resize 200%x100% -crop 50%x100% 2D.jpg

Animated It!

ImageMagick makes it really easy to create gifs - in this case, we want a 250ms delay between each frame.

convert -delay 25x100 -loop 0 2D-0.jpg 2D-1.jpg movie.gif

High quality animated 3D Doctor Who
Or, if there are only the two JPGs in the directory:

convert -delay 25x100 -loop 0 *.jpg movie.gif

You can knock the file size down by about a quarter using dithering. Although the resulting image won't look so good.

convert +dither +map -delay 25x100 -loop 0 *.jpg movie.gif



A few interesting examples.

Here, again from Doctor Who, it's possible to see a marked difference between foreground and background.

In this example, I've take two sequential frames from The Great Gatsby, The shot is a slow zoom in. By combining the left and right of both frames, we get an interesting 3D effect.
Great Gatsby 4 Frame

Reconstructing Depth Information

How easy is it, I wonder, to turn a stereoscopic image into a 3D model.
I used Stereoscan from AgiSoft (Linux, Mac, Windows) to turn this:
Oil Painting in 3D

Doctor Who Geek Side Note

Interestingly (well... to geeks like me) the shot of Capaldi's eyes is not in 3D. I can only assume they filmed his cameo separately. There are a few other shots which aren't in 3D - those of the old Doctors (including Eccleston) and the original title sequence.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: