Skip to content

Instantly share code, notes, and snippets.

@gionn
Last active September 3, 2020 06:57
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 gionn/8196479db4114282fbc0a5ce9fb7c73a to your computer and use it in GitHub Desktop.
Save gionn/8196479db4114282fbc0a5ce9fb7c73a to your computer and use it in GitHub Desktop.
Grab snapshot (single frame) from RTSP ipcam and publish to S3
#!/bin/bash -e
# Move inside a tmpfs directory
cd /dev/shm
# Grab a snapshot of the RTSP source and save on current folder
# rtsp_transport tcp to avoid packet loss (truncated image)
# qscale:v to adjust jpeg quality (2 is best, 31 worst)
ffmpeg -loglevel panic -y -rtsp_transport tcp -i rtsp://192.168.199.91 -vframes 1 -qscale:v 4 snapshot.jpg
# Upload to S3 - (requires a .s3cfg in home directory)
s3cmd put -P snapshot.jpg s3://bucket
echo Done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment