Capture and FTP upload a webcam image

To install web cam capture software on the Raspberry Pi

sudo apt-get install fswebcam

To test

fswebcam -d /dev/video0 -r 720x480 webcam.jpeg

Python Code to take picture and upload to web

#!/usr/bin/env python

import os
import ftplib

os.system("fswebcam -d /dev/video0 -r 384x288 /var/www/webcam.jpeg")

print ("Starting FTP")
session = ftplib.FTP('ftp.com','ftp@ftp.com','asdfasdfasdfasdf')
file = open('/var/www/webcam.jpeg','rb') # file to send
session.storbinary('STOR webcam.jpeg', file) # send the file
file.close() # close file and FTP
session.quit()
print ("Finished FTP")
Logitech 720p 2MP QuickCam Pro 9000 V UBM46 Carl Zeiss Optics with Autofocus USB
Logitech 720p 2MP QuickCam Pro 9000 V UBM46 Carl Zeiss Optics with Autofocus USB $19.99
End Date: Friday Jun-23-2017 15:54:00 PDT
Buy It Now for only: $19.99
Logitech Pro 9000 Webcam V UBM46 Computer Camera USB
Logitech Pro 9000 Webcam V UBM46 Computer Camera USB $14.99
End Date: Friday Jun-23-2017 17:27:29 PDT
Buy It Now for only: $14.99
Logitech WebCam Pro 9000 For Business V U0009
Logitech WebCam Pro 9000 For Business V U0009 $9.99
End Date: Thursday Jun-22-2017 14:06:29 PDT
Buy It Now for only: $9.99
Logitech Webcam Pro 9000 2MP Carl Zeiss Optics NEW
Logitech Webcam Pro 9000 2MP Carl Zeiss Optics NEW $75.59
End Date: Monday Jun-12-2017 15:04:22 PDT
Buy It Now for only: $75.59
Cisco VT Cam by Logitech QuickCam Pro 9000 2MP WebCam Carl Zeiss Optic Autofocus
Cisco VT Cam by Logitech QuickCam Pro 9000 2MP WebCam Carl Zeiss Optic Autofocus $12.49
End Date: Thursday Jun-8-2017 22:18:19 PDT
Buy It Now for only: $12.49
Logitech QuickCam Pro 9000 2MP WebCam Carl Zeiss Optics with Autofocus
Logitech QuickCam Pro 9000 2MP WebCam Carl Zeiss Optics with Autofocus $18.99
End Date: Thursday Jun-22-2017 13:07:43 PDT
Buy It Now for only: $18.99
Lot of 5 Logitech Pro 9000 Webcams
Lot of 5 Logitech Pro 9000 Webcams $49.99
End Date: Monday Jun-12-2017 18:00:13 PDT
Buy It Now for only: $49.99
Logitech QuickCam Pro 9000 Web Cam new in box
Logitech QuickCam Pro 9000 Web Cam new in box $29.99
End Date: Wednesday Jun-21-2017 10:58:48 PDT
Buy It Now for only: $29.99
Logitech QuickCam Pro 9000 V UBM46 Carl Zeiss 2MP Auto Focus Webcam w Microphone
Logitech QuickCam Pro 9000 V UBM46 Carl Zeiss 2MP Auto Focus Webcam w Microphone $15.00
End Date: Monday Jun-12-2017 16:25:48 PDT
Buy It Now for only: $15.00
Logitech QuickCam Pro 9000 Web Cam
Logitech QuickCam Pro 9000 Web Cam $25.00
End Date: Tuesday Jun-20-2017 7:08:17 PDT
Buy It Now for only: $25.00

« Previous1234567

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>