Monday, October 21, 2013

FFMPEG - Creating timelapse with FFMPEG with JPEG

If you have a series of JPEG which are taken over a period of time, you can use the following command to create a timelapse video.

ffmpeg -f image2 -r 1 -i your_image%02d.jpg -r 15 -s hd1080 -vcodec libx264 your_output.mp4

Let me go through this command

In general, any options before -i denote the input file parameters. For this, we have -f image2 -r 1 -i your_image%02d.jpg

-f is to force the input file format as image2. Image2 denote input file as jpeg

-r is to denote the input frame rate. This is important and is a common mistake made by user. If you do not put -r, it will default -r as 25. Thus, if you see your ffmpeg output contains a lot of duplicate or dropped frame. You need to define the frame rate of the input file that match with the output frame rate.

-i is to set your input file names. %02 means that ffmpeg will take your_image00.jpg to your_image99.jpg as input consideration.

Next, any option after -i denote the output file parameters. For this, we have -r 15 -s hd1080 -vcodec libx264 your_output.mp4

-r is to denote the output frame rate.

-s is to set the output frame size to hd1080

-vcodec denote the codec to be used to encode the output file. libx264 is the standard encoder for H.264 encoding in FFMPEG

your_output.mp4 is the output name

1 comment:

  1. Thanks for this article. It's sorted me out with a couple of brilliant time lapses.

    Hints for other readers:
    1. Check the capitalization of your file extensions, e.g. I wasted ages before I realised that .jpg (lowercase) in the command was not finding my files named your_image00.JPG.
    2. To make your timelapse "faster", change -r 1 (the first one) to -r 30 (or any number you wish)

    ReplyDelete

Hadoop - How to setup a Hadoop Cluster

Below is a step-by-step guide which I had used to setup a Hadoop Cluster Scenario 3 VMs involved: 1) NameNode, ResourceManager - Host...