Skip to content

Instantly share code, notes, and snippets.

@thequbit
Created May 2, 2014 18:42
Show Gist options
  • Save thequbit/d3ed1b862058bdc2243e to your computer and use it in GitHub Desktop.
Save thequbit/d3ed1b862058bdc2243e to your computer and use it in GitHub Desktop.
get a frame every 5 minutes from a mjpeg stream
#/bin/sh
# this assumes you want to take an image every 5 minutes for 12 hours.
# ( 60 minutes / hour / 5 minutes * 12 hours = 144 images )
#
# get singleframe.py from here:
# https://gist.github.com/thequbit/a139f64d5cde952771f5
#
#
# to run this file, put the contents into a file named getframes.sh and
# then make it runable by typing the following:
#
# > chmod +x getframes.sh
#
# then simply run the file by typing:
#
# > ./getframes.sh
#
# the file will run until the end of the 12 hours.
#
# do the loop
for i in {0..144}
do
# download 256K of the video file
(ulimit -f 256; wget "http://67.247.80.36:45247/mjpg/video.mjpg")
# pull single frame from video and save it as the frame number
python singleframe.py video.mjpg frame-$i.jpg
# cleanup
rm video.mjpg
# wait for 5 minutes ( 300 seconds )
sleep 300
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment