Showing posts from October, 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 …

Linux - Back To Basic Part 1 - Shell Command-line Processing, Quoting and Example

Command-line Processing

Be it bash or ksh, when you enter a command to command-line, they will process your input before running the command

Below is the flowchart for ksh command-line processing. See for more details


It is always good to "  " or '  ' your command parameter. Without quoting, it may result in unexpected result.

Quoting tells the shell to bypass certain steps in the above flowchart when the shell is performing command-line processing. Usually, we may want to ignore pipe characters, aliases, tilde substitution and wildcard expansion for the command parameters

See section 7.3 from the given link on Command-line Processing for more details


Command-line processing and quoting effect can easily be seen in GREP.

Grep expect the following syntax

    grep PATTERN file

where it expects PATTERN as follows

No space if quote are not usedIf space are required in PATTERN, you need to quote your PATTE…