rolisz's site

How to make a selfie time-lapse video

Mostly for future self reference, but also in case somebody else wants to do something similar, I'll write down the steps I took to do my selfie time lapse video.

First step: take daily pictures. I recommend about 0.3-0.5 seconds per picture in the slideshow and you want to have at least 30 seconds of video, so that means at least 60-90 photos. Pro-tip: do them in as similar way as possible every day. Especially the distance to the camera is important. You'll thank me soon enough.

After you gathered all your pictures together, you want to align them. I did this in GIMP. You open the program and go to File > "Open as Layers". You select your pictures and it will import them and create a separate layer for each one of them.

You should disable the visibility off all layers except one, which is to be in the "correct" position (I chose one of the first ones for this). Then you go over each of the other layers, making them visible, but setting their opacity to about 50%. You select this second layer and you start moving it around with the arrow keys until it's well aligned. Then go to Layers > "Layer to Image size", to make sure to crop what went outside of the borders of the image. You're done with this layer, so make it invisible and repeat the process with the other layers, until you have done all of them.

I found that it's best to align based on the eyes. The iris is nice and round and there is a high contrast between the iris and the sclera so it's easy to tell when they are aligned.

Remember when I told you to take all the pictures in as similar a way as possible? I made the mistake of not taking all the photos from the same distance from the camera, so in some cases I had to resize one of the layers first. This is the most annoying part, because you don't have real time preview. GIMP updates the on screen image only 1-2 seconds after you resize, so you can't smoothly drag until it's the correct size. Also, because the eyes move around when you resize, making it necessary to realign before you can retry to resize.

Once all the images are aligned, take Lie Ryan's script from here, install it and run it. It will save all the layers as images. If you haven't done the step of cropping the layer to image size, now you will see that this plugin saves the whole layer, even if it's bigger than the image, so the alignment you did will be off.

Time for an optional part. If you want to add some music in the background and if you have OCD about syn­chro­niza­tion and you want the beat of the music and the changing of the images to be in sync, then you should somehow measure the BPM of the song (it helps if you have any musical talent at all). Divide the BPM by 60 to get the frame rate per second in the video. If the BPM is really fast (say over 100), than halve it and use that as the frame rate. This way, images will change only on every second beat. In my case, the BPM was 160, which was way too high, so I went with 80/60 = 1.33 as the frame rate.

Time to move on to the next tool: ffmpeg, the Swiss army knife of movie making. It's super easy, you just run the following command in the folder where all the images are (hover over the arguments to see ex­pla­na­tions for them):

ffmpeg -y -framerate 1.33 -pat­tern_­type glob -i '*.png' -ss 12.9 -i cbqp.mp3 -c:a aac -vcodec libx264 -preset slow -crf 18 -r 30 -shortest time-lapse.mp4

And voilĂ , you have a selfie time-lapse video. Upload to your favorite video sharing website and manically refresh the page to see the view counter go up (or not).