===== What? =====
Collection of some points regarding generation of timelapse pictures/videos using Linux. [[https://fluxcoil.net/files/tmp/office_timelapse/|Example, taken with Galaxy S7.]]
=== Taking the single pictures: dedicated camera ===
* First thought: using existing camera, my Sony RX100, first generation. Unfortunately it is not supporting remote control for taking pictures.
* gphoto2 is the software one wants to use.
* I have no supported camera. Which one to get?
* Inspect gphoto's supported devices . If your camera is listed but has nothing under "Additional Capabilities", it's probably just supporting file download, not taking images.
* Example from "gphoto2 --summary"
* For "GoPro HERO5 Black": Device Capabilities: File Download, File Deletion, File Upload, No Image Capture, No Open Capture, No vendor specific capture
* For "Nikon COOLPIX A100" (usb id 04b0:0367): Device Capabilities: File Download, File Deletion, File Upload, Generic Image Capture, No Open Capture, No vendor specific capture, Nikon Wifi support
=== Taking the single pictures: Android phone ===
* Using the Android phone looks like a nice alternative. My Samsung Galaxy S7 has a good camera.
* Connect via usb, shoot pictures with this:
adb shell "am start -a android.media.action.IMAGE_CAPTURE" \
&& sleep 1 \
&& adb shell "input keyevent 27"
* My final loop:
while :; do
echo -n "### "; date;
adb shell "am start -a android.media.action.IMAGE_CAPTURE;
sleep 1; input keyevent 27";
echo "### done";
sleep 58; # turned out the full loop was slightly <60sec
done
* I have the phone connected to wlan, share the pictures folder with the connected Linux system via syncthing. With this, I could even move the pictures out of the folder, if storage is a problem.
* Issues:
* the screen stays always on, the phone heats up. Running 'adb shell top', I saw the camera app and screen handling as top users.
* the gallery app was indexing all of the pictures, and I have no way of enforcing reindex after I removed the pictures from the phone.
=== processing the single images ===
Reading timestamp from the exif-field and adding it to the picture, and resize to fullhd:
mkdir tmp && cd tmp
for i in ../2018*.jpg; do
convert $i -fill white -undercolor '#00000080' \
-gravity Southeast -pointsize 48 -annotate +0+5 \
$(exif $i |grep 'Date and Time '|sed -e 's,.*|,,' \
-e 's, ,_,' -e 's,:[0123456789]*$,,') \
-resize 1920x $(echo $i|sed -e 's,\.,,');
done
=== generating the video ===
== mencoder ==
mencoder mf://2018*.jpg -mf fps=25 -nosound -noskip -ovc copy -o mencoder2.avi
Problem with that: when watching, the format did jump around, bigger/smaller. 'mplayer -fs mencoder2.avi' worked ok.
== ffmpeg ==
Leave out the '-s 1920x1080' if you already resized with ImageMagick before.
ffmpeg -pattern_type glob -i "2018100*.jpg" -c:v libx265 \
-s 1920x1080 -movflags +faststart ffmpeg_1920x_x265.mkv