Skip to content

Instantly share code, notes, and snippets.

@sheffler
Created August 1, 2011 18:13
Show Gist options
  • Save sheffler/1118671 to your computer and use it in GitHub Desktop.
Save sheffler/1118671 to your computer and use it in GitHub Desktop.
Streaming Webcam upload to Sensr via ffmpeg and MJPEG
#!/bin/bash
# Sensr FTP information
HOST=f7.sensr.net
USER=cam28
PASS=l4hqpy0ywm
echo Starting SensrCam ${HOST} ${USER} ${PASS}
# Exit by hitting ^C
trap 'echo EXIT WEBCAM; exit 0' SIGINT SIGTERM
# Set image size, frame rate upload
W=640
H=480
RATE=1
# Video input device
DEV=/dev/video0
# Set size, framerate
dov4l -d ${DEV} -s ${W},${H}
dov4l -d ${DEV} -f 25
# Pipe our camera up to Sensr
ffmpeg -f video4linux2 -s ${W}x${H} -r 25 -i ${DEV} -r ${RATE} -vcodec mjpeg -f image2pipe http://${USER}:${PASS}@${HOST}/upload/${USER} < /dev/null
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment