Make Time Lapse Video from Images in Linux (ffmpeg)
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 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.
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 #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
Possibly related posts (generated automatically):
- How to Make Time Lapse Video from Images
- Enable MP3, MPEG4, AAC, and Xvid etc for FFmpeg Ubuntu 10.04
- ffmpeg GUI/ Frontend for Ubuntu / Fedora
- How To Make Ubuntu A perfect Mac File Server and Time Machine Volume
- Mount Iso Images Using GUI in Ubuntu 10.04 (Linux)
- A Simple Time Lapse CHDK Script for Canon SD300
- Extract Audio Out of Youtube (flv) Videos for Free
- Enable Closed Caption (CC) / Subtitle on Live TV / Video Playback
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...|