-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecord.sh
More file actions
executable file
·43 lines (32 loc) · 885 Bytes
/
record.sh
File metadata and controls
executable file
·43 lines (32 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
source /home/pi/scripts/config.sh
# check state
STATE=`cat $STATE_FILE`
if [ "$STATE" != "recording" ]; then
# remove cron job for recording
(crontab -l) | sed '/record/d' | crontab -
exit 0
fi
# make directory for today
DAY=`date +%y%m%d`
DAYDIR=$VIDEO_DIR/$DAY
mkdir -p $DAYDIR
# record to temp filename to avoid rsync issues
TEMP_FN="/home/pi/current.h264"
# make new filename
BFN=`date +%y%m%d_%H%M%S`_`hostname`.h264
FN=$DAYDIR/$BFN
echo "Recording to $FN"
# make sure there is room for the video by purging any old videos
bash /home/pi/scripts/purge_videos.sh
# record for 20 seconds
#raspivid -o $TEMP_FN -t 20000 -n -fps 3 -md 2
raspivid -o $TEMP_FN $RASPIVID_SAVE_OPTS
# move temp file to videos directory
mv $TEMP_FN $FN
# update symlink for most recent
#cd $VIDEO_DIR
#SFN=`hostname`.h264
#rm $SFN
#ln -s $DAY/$BFN $SFN
echo "Done recording"