Created
June 26, 2013 14:49
-
-
Save boxysean/5868001 to your computer and use it in GitHub Desktop.
Script used to capture stills from ITP cameras. When added to a crontab, it can be run as often as you'd like!
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
lobby | http://128.122.151.22/mjpg/video.mjpg | |
---|---|---|
classroom20closeup | http://128.122.151.188/mjpg/video.mjpg | |
jroom | http://128.122.151.200/mjpg/video.mjpg | |
shop | http://128.122.151.221/mjpg/video.mjpg | |
classroom20 | http://128.122.151.227/mjpg/video.mjpg |
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 | |
CSV=$(cat cameras.csv) | |
IFS=$'\n' | |
for line in $CSV; do | |
LOCATION=$(echo $line | cut -d"," -f1) | |
URL=$(echo $line | cut -d"," -f2) | |
DATE=$(date +"%Y-%m-%d") | |
TIME=$(date +"%H-%M") | |
FOLDER=$LOCATION/$DATE | |
mkdir -p $FOLDER | |
FILE_NAME=${LOCATION}-${DATE}-${TIME}.jpg | |
ffmpeg -v 0 -y -i $URL -vframes 1 -f image2 -vcodec mjpeg $FOLDER/$FILE_NAME 2> /dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment