What?

Collection of some points regarding generation of timelapse pictures/videos using Linux. Example, taken with Galaxy S7.

Taking the single pictures: dedicated camera

Taking the single pictures: Android phone

adb shell "am start -a android.media.action.IMAGE_CAPTURE" \
  && sleep 1 \
  && adb shell "input keyevent 27"
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

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 1920×1080' 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