0

I am making an online webcam for my parents, using raspberry pi. I want it to capture a photo, upload it to a webserver, then upload a copy to a different server for archiving. I use the script streamer to snap a still from the webcam. It works, the problem is that it seems that streamer sometimes crashes, looping the error message "v4l2: oops: select timeout". This can happen after a few shots, or after 10 minutes of operation, it seems random. I have added a command that kills the streamer process after each snapshot, it did make the program a bit more stable, but eventually it still gets stuck in the error loop. I don't know what the problem is or even how to debug it.. What can I do?

I am using raspbian with the included drivers. The webcam is logitech c200. I first tried using opencv to capture stills, but couldn't get it to work properly. If someone could help with that maybe it would fix the problem, I don't know..

This is the code, it's python:

import time
import sys
from subprocess import call
import ftputil

while True:
    call("streamer -q -f jpeg -s 640x480 -o ./current.jpeg", shell=True)
    time.sleep(0.2);
    call("killall -q streamer", shell=True)
    filename = str(time.time()) + ".jpg"
    host = ftputil.FTPHost(*****)
    #host.remove("/domains/***/public_html/webcam.jpg")
    host.upload("./current.jpeg", "/domains/***/public_html/webcam.jpg", mode='b')
    host.close()
    host = ftputil.FTPHost(****)
    #host.remove("/domains/***/public_html/webcam.jpg")
    host.upload("./current.jpeg", "/webcamarchive/"+filename, mode='b')
    host.close()
    time.sleep(10);
GrixM
  • 215
  • 2
  • 4
  • 20

1 Answers1

1

Never mind, used pygame instead:

cam = pygame.camera.Camera("/dev/video0",(640,480))
cam.start()
image = cam.get_image()
GrixM
  • 215
  • 2
  • 4
  • 20