Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Example FTP upload to Sensr from /dev/video0
- # (uses ffmpeg to grab frames from webcam)
- # Sensr FTP information
- HOST=f7.sensr.net
- USER=cam28
- PASS=l4hqpy0ywm
- echo Starting FtpCam ${HOST} ${USER} ${PASS}
- # Exit by hitting ^C
- trap 'echo EXIT FTPCAM; exit 0' SIGINT SIGTERM
- # Set image size
- W=640
- H=480
- # Specify the video input dvice
- DEV=/dev/video0
- # Set size, framerate of camera
- dov4l -d ${DEV} -s ${W},${H}
- dov4l -d ${DEV} -f 25
- for (( ; ; ))
- do
- # Get two frames. First frame is usually dirty.
- ffmpeg -f video4linux2 -s ${W}x${H} -y -r 2 -t 4 -i ${DEV} -f image2 -vcodec mjpeg "image%02d.jpg"
- if [ -f image02.jpg ]; then
- # Upload to Sensr via FTP method
- ftp -d -v -n ${HOST} <<EOF
- quote user ${USER}
- quote pass ${PASS}
- passive
- binary
- put image02.jpg
- quit
- EOF
- rm image*.jpg
- else
- sleep 5
- fi
- done
- exit 0
Add Comment
Please, Sign In to add comment