Guest User

Untitled

a guest
Jan 25th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #!/bin/bash
  2. # Example FTP upload to Sensr from /dev/video0
  3. # (uses ffmpeg to grab frames from webcam)
  4.  
  5. # Sensr FTP information
  6. HOST=f7.sensr.net
  7. USER=cam28
  8. PASS=l4hqpy0ywm
  9.  
  10. echo Starting FtpCam ${HOST} ${USER} ${PASS}
  11.  
  12. # Exit by hitting ^C
  13. trap 'echo EXIT FTPCAM; exit 0' SIGINT SIGTERM
  14.  
  15. # Set image size
  16. W=640
  17. H=480
  18.  
  19. # Specify the video input dvice
  20. DEV=/dev/video0
  21.  
  22. # Set size, framerate of camera
  23. dov4l -d ${DEV} -s ${W},${H}
  24. dov4l -d ${DEV} -f 25
  25.  
  26. for (( ; ; ))
  27. do
  28. # Get two frames. First frame is usually dirty.
  29. ffmpeg -f video4linux2 -s ${W}x${H} -y -r 2 -t 4 -i ${DEV} -f image2 -vcodec mjpeg "image%02d.jpg"
  30. if [ -f image02.jpg ]; then
  31.  
  32. # Upload to Sensr via FTP method
  33. ftp -d -v -n ${HOST} <<EOF
  34. quote user ${USER}
  35. quote pass ${PASS}
  36. passive
  37. binary
  38. put image02.jpg
  39. quit
  40. EOF
  41. rm image*.jpg
  42. else
  43. sleep 5
  44. fi
  45. done
  46.  
  47. exit 0
Add Comment
Please, Sign In to add comment