John Reed
A series of images can be converted into a time-lapse video with Ubuntu Server using avconv
. ffmpeg
can be used to accomplish the same thing, but it’s not available in the 14.04 repositories.
avconv
can be installed using
sudo apt-get install libav-tools
Once it’s installed, an example of using it to convert a series of sequential images to a time-lapse video is shown below:
avconv -start_number 10006 -i IMG%5d.JPG -r 30 -vcodec libx264 -q:v 3 -vf crop=3840:2160:160:0,scale=iw:ih output.mp4
- i - input files. In the example above,
%5d
can be any 5 decimal numbers.- %xd - x can be replaced with the number of digits that make up the iterable portion of the filename.
- start_number - sets the starting number for the iterable portion of the image sequence’s filename
- r - frame rate of the output time-lapse video
- vcodec - specifying
libx264
uses x264 to encode the output - q:v - specifies the quality. Values range from 1 (least compression, highest quality) to 31 (most compression, lowest quality)
- vf - video filter option that can be used to specify a section of the source frames to use in the output video. In the example, the output was cropped to 3840 x 2160.
- crop - out_w:out_h:x:y
- out_w is the width of the output video
- out_h is the height of the output video
- x is the horizontal position, in the input video, of the left edge of the output video
- y is the vertical position, in the input video, of the top edge of the output video
- scale - indicates how much scaling should be applied to the output video. iw:ih indicates that no scaling should be applied. However, if you wanted video to be scaled to half the height and width you would use
iw/2:ih/2
.
- crop - out_w:out_h:x:y
An example timelapse created using this technique is show below:
References
- https://libav.org/avconv.html
- http://techedemic.com/2014/09/18/creating-a-timelapse-clip-with-avconv/
- https://libav.org/documentation/libavfilter.html#crop