Last active
December 1, 2015 16:13
-
-
Save gojun077/bc02e18955bed589d5fc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#This script launches 'motion' webcam capture program, and once motion | |
#terminates, the script will join individual webcam captures into a | |
#mpeg4 movie. Each webcam shot is taken after an interval of 6 seconds | |
#as set by /etc/motion/motion.conf "snapshot_interval n" | |
DATE=$(date +%F-%H%M) | |
VIDPATH="/usr/local/apache2/htdocs/cam1" | |
if [ -f "/usr/bin/motion" ]; then | |
motion | |
else | |
echo -e "Please install 'motion' package! Aborting.\n" 1>&2 | |
exit 1 | |
fi | |
if [ -d $VIDPATH ]; then | |
cd $VIDPATH || exit 1 | |
if ffmpeg -framerate 1/1 -pattern_type glob -i \ | |
"*.jpg" -r 25 "$DATE".mp4; then | |
rm ./*.jpg | |
else | |
echo "Could not render mp4! Aborting." 1>&2 | |
exit 1 | |
fi | |
else | |
echo "$VIDPATH does not exist! Aborting." 1>&2 | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment