Make Time Lapse Video from Images in Linux (ffmpeg)

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

I have earlier discussed how to make a video from series of images on a Windows box. Doing it on a linux machine is even simpler. I am assuming that you have the images that you intend to use in a series of continuous numbers, e.g. Image001.jpg to Imagexyz.jpg, there shouldn’t be any break else ffmpeg would stop the encoding at the missing frame.

Not to worry if you are missing frames, you can easily rename them in a continuous series by using “phatch”, you can directly skip to ffmpeg section below, if you have your files in order.

Install phatch by doing this:

sudo apt-get install phatch

Launch phatch and click on the “+” button to add a rename action.

Now select the Rename action and click on Add

Now change select Image<###index> in the File Name drop down and change to <folder>/<subfolder> option in “In:” as shown below

Now click on the “Execute the action” button and browse to the folder where you have the files to be renamed, and all the files would be detected alphabetically by their names after you click on “Batch”. Just click on continue to finish the rename process, and we should be ready to execute ffmpeg.

Finally, the command to be executed to effect the conversion from .jpg to .mp4 (to add an audio file to your creation, look at the end of this post)

ffmpeg -r desired_frame_rate -b desired_bit_rate -i Image%3d.jpg test.mp4

You can select desired_frame_rate between 1 and 25, desired_bit_rate would depend on your needs (1000k should give you a fair quality, play around with this number till you get desired result). Image%3d.jpg implies that all the files with names of the form Imagexxx.jpg would be used as frames. You can select a different output file name e.g. test.avi. Do man ffmpeg if you want more information to customize the call to ffmpeg. Here is the output of my invocation of ffmpeg.

$ ffmpeg -r 10 -b 1000k -i Image%3d.JPG test.avi
FFmpeg version SVN-r19352-4:0.5+svn20090706-2ubuntu2, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –extra-version=4:0.5+svn20090706-2ubuntu2 –prefix=/usr –enable-avfilter –enable-avfilter-lavf –enable-vdpau –enable-bzlib –enable-libgsm –enable-libschroedinger –enable-libspeex –enable-libtheora –enable-libvorbis –enable-pthreads –enable-zlib –disable-stripping –disable-vhook –enable-gpl –enable-postproc –enable-swscale –enable-x11grab –enable-libdc1394 –extra-cflags=-I/build/buildd/ffmpeg-0.5+svn20090706/debian/include –enable-shared –disable-static
libavutil     49.15. 0 / 49.15. 0
libavcodec    52.20. 0 / 52.20. 0
libavformat   52.31. 0 / 52.31. 0
libavdevice   52. 1. 0 / 52. 1. 0
libavfilter    0. 4. 0 /  0. 4. 0
libswscale     0. 7. 1 /  0. 7. 1
libpostproc   51. 2. 0 / 51. 2. 0
built on Oct 13 2009 22:15:16, gcc: 4.4.1
Input #0, image2, from ‘Image%3d.JPG’:
Duration: 00:00:30.30, start: 0.000000, bitrate: N/A
Stream #0.0: Video: mjpeg, yuvj420p, 1084×720 [PAR 1:1 DAR 271:180], 10 tbr, 10 tbn, 10 tbc
Output #0, avi, to ‘test.avi’:
Stream #0.0: Video: mpeg4, yuv420p, 1084×720 [PAR 1:1 DAR 271:180], q=2-31, 1000 kb/s, 90k tbn, 10 tbc
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop encoding
frame=  303 fps= 21 q=6.9 Lsize=    3921kB time=30.30 bitrate=1060.2kbits/s
video:3908kB audio:0kB global headers:0kB muxing overhead 0.329214%

If you also want to add an audio file (e.g. some mp3 file) to your video you might want to use a command similar to this (this can be used to merge an audio and video file using ffmpeg)

ffmpeg -r desired_frame_rate -b desired_video_bit_rate -i Image%3d.jpg -i my_music.mp3 -ab desired_audio_bit_rate -ar desired_audio_frame_rate output.mp4

for some standard choices for the above variables compare with the command below

ffmpeg -r 10 -b 2000k -i Image%3d.JPG -i my_music.mp3 -ab 128k -ar 44100 snow.mp4
If you found this useful, please consider leaving a comment or liking us on Facebook or subscribing to the RSS feed to have future articles delivered to your feed reader.

You might also like

How to Make Time Lapse Video from Images One might need...
Extract Audio Out of Youtube (flv) Videos for Free Earlier I talked...
Download and Convert YouTube Videos For Free Video DownloadHelper...
$900: Toshiba 46WX800 46-Inch 1080p 240 Hz Cinema Series 3D LED TV, Black Amazon has...

About the Author

has written 1285 posts on this blog.

Meditating towards his "nerdvana", lifehacker is a teacher by the day and a nerdy blogger by the night. He lives to learn and yearns to learn living.

4 Comments on “Make Time Lapse Video from Images in Linux (ffmpeg)”

  • salsaman wrote on 13 April, 2010, 16:44

    You can do this much easier by using LiVES (http://lives.sourceforge.net).

    Just go to the menu option “Open File or Directory”, and then double click on the directory containing your images. LiVES will create a video clip from your files, which you can then edit and encode.

    Like or Dislike: Thumb up 3 Thumb down 0

    [Reply]

Trackbacks

  1. How to Make Time Lapse Video from Images « Hack Your Life!
  2. Make Time Lapse Video from Images in Linux (ffmpeg) « Hack Your Life! | Video Streaming List
  3. clouuds « a blodg

Write a Comment

Gravatars are small images that can show your personality. You can get your gravatar for free today!

*

Copyright © 2014 Hack Your Life!. All rights reserved.
Proudly powered by WordPress. Developed by Deluxe Themes