Skip to content

Instantly share code, notes, and snippets.

@boxysean
Created June 26, 2013 14:49
Show Gist options
  • Save boxysean/5868001 to your computer and use it in GitHub Desktop.
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!
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
#!/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