Skip to content

Instantly share code, notes, and snippets.

@richardpeng
Last active May 24, 2016 19:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richardpeng/c4ff38b28c6aae469e8f5ae36ce62b7e to your computer and use it in GitHub Desktop.
Save richardpeng/c4ff38b28c6aae469e8f5ae36ce62b7e to your computer and use it in GitHub Desktop.
Takes a picture on a networked GoPro
GP_HOST=https://user:pass@live.richardpeng.com
OUTPUT_DIR=/home/richard/public_html/plants
VIDEO_FILE=$OUTPUT_DIR/video/video.mp4
# take picture
curl -s $GP_HOST/gp/gpControl/command/shutter?p=1
sleep 5
# download picture
IMAGE_FILE=`curl -s $GP_HOST/gp/gpMediaList | sed -r "s/.*(GOPR[0-9]+\.JPG).*/\1/"`
DATE=`date +"%Y%m%d-%H%M"`
curl -s $GP_HOST/videos/DCIM/100GOPRO/$IMAGE_FILE -o $OUTPUT_DIR/$DATE.JPG
# delete picture
curl -s $GP_HOST/gp/gpControl/command/storage/delete/last
# create video
# TODO: concatenate the files
cd $OUTPUT_DIR
/usr/local/bin/ffmpeg -n -loglevel quiet -framerate 1 -pattern_type glob -i '*.JPG' -c:v libx264 -profile:v baseline -level 3.0 -r 30 -pix_fmt yuv420p out.mp4
mv out.mp4 $VIDEO_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment