Timelapse with ffmpeg

Written By :

Category :

arte

,

fedora

,

Fotografía

,

General

,

guias

,

Linux

Posted On :

Share This :

I have always liked those videos where they record hours of a sequence, either people walking, cars on the street, sky or simply our daily routine, and then, they show it in a not too long sequence.

You have to ways to make the capture. First is to take pictures on a time interval which you will merge afterwards. Second choice is simply, let your camera record as long as you want and then extract the film frame at determined time to then, merge them into a short video.

Honestly, I haven’t found an app that allows me to do it on a single frame, however, with ffmpeg you can make both actions. If anyone is interested in taking a step and help me doing this app, I would be super glad (no, I don’t code, but I have a pretty idea of the interface I would like it to have :) ).

To extract the film frames from the video you can use:

ffmpeg -i input.AVI -r 0.5 image-%06d.png

Where 0.5 will be the time frame where each film will be extracted (biggest number, biggest amount of frames)

To merge those frames into a video, you can use:

ffmpeg -f image2 -i image-%06d.png -r 15 -vcodec libtheora -vb 4096k -acodec null output.ogv

You can see how the result goes on this video. Original recording time: 2:30hs

8 Comments On “Timelapse with ffmpeg”

  1. Well,

    I am still working on that little application using ffmpeg, gtkmm etc… I am sort of busy with my (normal) work related duties right now, but try to fit some time in on it every week. So far I have a front end with some background logic that would allow th euser to load the video or directory of stills. ffmpeg is not the easiest library (merely due to it’s serious lack of documentation) so finding the api version of the command string noted above is interesting. I’ll keep plugging away.

  2. hey!! I tried OpenShot but I don’t know what happens, but when the compression rate needs it to make it bigger than 1/15 or 1/17 fps it doesn’t work and only renders it at its top (which I think it was something like 1/13). So, like what i was needing was something 1/100 or so, it just make a crazy output with a delayed audio that didn’t even fit. Even so, I will take a deeper look and see if there are any updates that I’m missing out :)

  3. Tatica,

    You should check out OpenShot. It is a video editor which (I believe) will do pretty much what you want, uses ffmpeg and libav. Is FOSS and is becoming cross platform compatible. Plus the api for it has handy python useage.

  4. Hey! well, I’m not an app-developer expert, however, as everyone know, I’m crazy using all kind of design app. The idea is quite simple, to have a small app that allows people to either load a video or a folder full of pictures. If the user loads a video, the app will use the lines I wrote n this post to disarm and obtain the frames (user can configure how many frames or time-lapse) and then merge all the frames. If the user uploads a batch then will just assembly the images. Would be nice if the user also can define how many fps he want to obtain (13/17/etc).

    I was talking with a friend yesterday and he was showing me some gphoto commands to capture directly from the camera. Even if this could be awesome, probably could be a feature to add on a second version (and yet, super awesome :) )

Leave a Reply