Created
May 26, 2014 06:54
-
-
Save kythin/e72180fe3054bddd89bf to your computer and use it in GitHub Desktop.
RTMP to JPG Timelapse Capture Bash Script
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 | |
## | |
# RTMP to JPEG timelapse script | |
# github.com/kythin | |
# | |
# Simple script to take an RTMP streaming url and save a jpeg every 10 seconds. | |
# | |
# Requires 'ffmpeg' and 'rtmpdump' | |
# apt-get install ffmpeg rtmpdump | |
# | |
## | |
STREAM='STREAM ID HERE' | |
RTMPURL='RTMP URL GOES HERE' | |
OUTDIR='~/caps' | |
TIME=$(date +"%Y%m%d_%H%M%S") | |
mkdir -p $OUTDIR | |
rtmpdump -v -r $RTMPURL -y $STREAM -o $OUTDIR/1.flv -B 1 | |
ffmpeg -i $OUTDIR/1.flv -ss 00:00:01 -an -r 1 -vframes 1 -s 800x600 -y $OUTDIR/$TIME.jpg | |
echo "Waiting until next run..." | |
sleep 10 | |
./cap.sh | |
exit; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From here you can edit the script to run once, and use a cron to run it every minute, or whatever. You could also expose it through a php script and then query that script whenever you want it to take a snapshot - say from a button on the webcam feed on the website? Hmmm...