Wednesday, 5 April 2017

Linux Mint: Create Time Lapse Video from JPG's

http://tinyurl.com/jwpakdo 
Input Device
Dazzne P2 Action Camera: Continuous Capture Mode
duration      =8.0MP @ 2 sec per frame (2sec 5sec 10sec)
image (4:3)  =3,264x2,448 @ size=2.1MB ave (no 16:9 setting)
battery        =2hrs 40mins


Calculation
for a 25fps video: image count =((duration x videolength)/jpg_per_sec)
duration:2 sec_per_jpg:50 videolength:20secs timecalc:2000secs timeact:33.4mins imagecount:500 space:1.5GB videosize:9.3MB

duration:2 sec_per_jpg:50 videolength:30secs timecalc:3000secs timeact:50.0mins imagecount:750 space 1.57GB

duration:2 sec_per_jpg:50 videolength:1min timecalc:6000secs timeact:100.0mins(1hr 42mins) imagecount:1500 space 3.15GB

I would allow an extra 3mins and then delete excess jpgs both front and end. So for a 20sec timelapse video, set the camera and start shooting in continuous mode (2 spf) for 36mins, in post edit just use 500 jpgs and run the bash scripts as shown below.

Bash
Open a terminal in the folder that contains the series of JPG's
Paste/copy each line individually, wait until each process has completed.

for i in $( ls *.JPG); do convert -resize x1080 $i re_$i; done
resize all images in current folder to height of 1080p while keeping aspect ratio renaming in process. I prefer 720p because I'm not too fussed with quality, but it is more noticeable how clear the resulting 1080p video turns out.

for i in $( ls *.JPG); do convert -resize x1440 -crop 1920x1080+0+220 $i re_$i; done
use this line instead if you wish to produce a 1920x1080p video. You will lose cropped sections top and bottom so make sure you allow for this during setup.

mencoder "mf://re_*.JPG" -mf fps=25:type=jpg -ovc x264 -o "TimeLapse.MP4"
create H264 25fps MP4 video based on the newly created resized images

find . -name "re_*" -type f|xargs rm -f
identify all temporary resized images then delete them

Results/Thoughts



Try this [----- pklaus bash script -----] , works really well. The only thing I don't like about it, is that it modifies the original jpgs and you cannot get back the original size. I'm so disappointed the Dazzne P2 doesn't have a 16:9 setting, but I can only use what I have at hand.

Sony HDR CX-405 Stabilization Test

[ ----- Play Video ----- ] I've been meaning to do this a long time ago. Cheapest camera in this range and the first to have the i...