From: Don Armstrong Date: Fri, 9 Dec 2016 19:17:00 +0000 (-0600) Subject: add initial version of motion_detected.sh X-Git-Url: https://git.donarmstrong.com/?p=catcam.git;a=commitdiff_plain;h=2f70727c3edb42abaa111f2feb0dd1d5abf5f101 add initial version of motion_detected.sh --- 2f70727c3edb42abaa111f2feb0dd1d5abf5f101 diff --git a/motion_detected.sh b/motion_detected.sh new file mode 100755 index 0000000..0387d78 --- /dev/null +++ b/motion_detected.sh @@ -0,0 +1,36 @@ +#!/bin/sh + +EMAIL="foo@example.com" + +MOVIE="$1" +OGG_MOVIE="${MOVIE%%.avi}.ogg" +MP4_MOVIE="${MOVIE%%.avi}.mp4" + +FILENAME=$(basename "$1") +OGG_FILE="${FILENAME%%.avi}.ogg" +MP4_FILE="${FILENAME%%.avi}.mp4" +JPG_FILE="${MOVIE%%.avi}.jpg" +HTML_FILE="${FILENAME%%.avi}.html" + +ffmpeg -i "$MOVIE" -vcodec libtheora -qscale:v 7 -acodec libvorbis "$OGG_MOVIE" >/dev/null 2>&1; +ffmpeg -i "$MOVIE" -vcodec mpeg4 "$MP4_MOVIE" >/dev/null 2>&1; + +LENGTH="$(ffprobe -i "$MOVIE" -show_entries format=duration -v quiet -of csv=p=0)" + +ffmpeg -ss 00:00:$(echo 'scale=2;' $LENGTH / 2) -i "$MOVIE" -vframes 1 -q:v 2 "$JPG_FILE" >/dev/null 2>&1; + +scp -i /home/motion/motionuser_rsa "$OGG_MOVIE" "$MP4_MOVIE" "$JPG_FILE" motionuser@rzlab.ucr.edu:cat_pics/.; +cat < cat_pics/$HTML_FILE"; +Cat Pics $HTML_FILE + + +EOF + +#cat -<