added timelapse correctly

This commit is contained in:
mrbesen 2018-11-12 17:39:35 +01:00
parent 652890b14a
commit 9085be9cfa
Signed by: MrBesen
GPG Key ID: 596B2350DCD67504
1 changed files with 28 additions and 1 deletions

View File

@ -1 +0,0 @@
../.timelapse/timelapse.sh

28
timelapse.sh Normal file
View File

@ -0,0 +1,28 @@
#!/bin/bash
cd $HOME/.timelapse/
echo "searching for old files"
if [ -d "rec" ]; then
echo "converting old files"
mkdir rot
cd rec
for f in *.jpeg
do
convert -rotate 180 "$f" ../rot/"${f%.JPG}".jpg
done
cd ..
echo "ffmpeg..."
timestamp=$(date +%s)
cat $(ls rot/*jpg) | ffmpeg -hide_banner -y -f image2pipe -vcodec mjpeg -r 20 -i - -vcodec h264 -preset slow -crf 1 -threads 0 -f mp4 -strict -2 $timestamp.mp4
echo "delete old files"
rm -r rot
rm -r rec
rm *.jpeg
else
echo "nothing found - moving on"
fi
mkdir rec
echo "recording..."
streamer -t 72:00:00 -r 1 -f jpeg -o rec/000000.jpeg
echo "done."