Home | About | Apps | Github | Rss
I was recently working on creating a timelapse video from about 90 images, each of which is a 3-6 second exposure, which I shot during one of my bike trips.
The images in JPG format, shot on 5D-Mark2, needed renaming to ‘img_%d.jpg’ format, which I quickly did with a simple python script
>>> import os
>>> from glob import glob
>>> for i, f in enumerate( glob('*.jpg') ):
... os.rename( f, 'img_%d.jpg' % i )
The images were all of 5616x3714 resolution. Using this one liner I bought it down to 1280x853 and moved them to a folder r1280_seq0
for each in *.jpg; do
> convert $each -resize 1280x -quality 85% "r1280_seq0/$each"
> done
I needed ffmpeg which I setup using brew
$ brew install ffmpeg
And for actual conversion, here is how I did it
$ffmpeg -r 10\
-i img_%d.jpg\
-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"\
-pix_fmt yuv420p\
video_10fps.mp4
Notes & Pitfalls::
-r
flag. I wanted 10fps above.-vf "scale=trunc(iw/2)*2:trunc(ih/2)*2"
fixes this problem by resizing video to an even numbered dimension.-pix_fmt yuv420p
-r
flag