I made this video for my other blog, of my street where I live in Bangkok.
The video was quite a piece of work. I don’t have the hardware to do proper time lapse photography so I actually just took a 15 minute video and then cut it into frames. See I knew I could speed up a video in various programs on linux, such as kdenlive or kino or avidemux, but I knew that most of them would crash when trying to save a file with a massively high framerate, or they’d drop frames and look shitty. So it had to be broken into frames, processed, and then encoded into a video first at a high framerate, and then transcoded to a video with a normal frame rate so that software didn’t freak out.
I tried a few techniques but I’ll just describe the one that worked for me. Firstly, because I only had 15 minutes of footage and I wanted at least a 2 minute video, I couldn’t speed it up all that much, so it wasn’t going to be one of those super high-motion traffic shots. Instead it looked quite sedate and the cars were in focus and detailed, even when sped up. I didn’t want this, so I looked for a way to blur the frames together. Ideally I would expect a good encoder to do this, like iMovie etc does on the Mac, but I was in Linux land with no such luxuries.
Instead I found a guy who had written an unusual script to apply an IIR gaussian blur between consecutive frames, to give a sort of blurred motion effect. This helps make time lapse videos without large amounts of footage look a bit smoother. The script is available on github here, but you will have to alter it a bit to suit your filenames and such. Also, the blur factor is at 15 at first. Higher numbers give less blur, lower numbers more. I used 10 for my video. Also it used JPG files and I felt this was ruining the high definition of my video, so I just changed all references to “jpg” to “png” in the script and it used png files instead (though much slower). It also encoded the videos using ffmpeg and I wasn’t happy with the results of this, so I chose to use my own mencoder command which I give below.
IIR Smoother (relies on ImageMagick)
mencoder -ovc copy -mf w=640:h=360:fps=202:type=png ‘mf://out*.png’ -o timelapse.avi
This 2 minute video was about 6.2 gb in size, and my editor (Kdenlive) was just choking on it, so I then ran another mencoder transcode to reduce it to a workable size.
mencoder timelapse.avi -o finished.avi -ovc lavc -oac mp3lame -lavcopts vbitrate=4800:mbd=2:keyint=132:v4mv:vqmin=3:lumi_mask=0.07:dark_mask=0.2:scplx_mask=0.1:tcplx_mask=0.1:naq -ofps 30
Next time I would like to try doing higher definition video and trying some other tricks to reduce the encoding and preparation time, because this job took me a LONG time to achieve, but really only due to the experimentation involved in trying to find the best solution.
I recommend you click the YouTube logo at the corner of this video and then watch it in full screen at high resolution. Afterwards is some photos I took the same night.
Yes, you have to read that title like the professor from Futurama.
