JohnnyCyp
Posts: 63
Joined: Sun Mar 31, 2019 11:05 pm

IP camera Error opening device: /dev/video2

Wed May 22, 2019 3:20 pm

Hello, i have a problem using my IP camera. I want to take image using fwebcam when a PIR motion sensor detect a motion but i can't find a way to do that...

i have link my ip camera using this command:
uv4l --driver mjpegstream --auto-video_nr --uri "http://admin:[email protected]/video. ... lution=VGA" --server-option=--port=554

and i got this result:
<notice> [core] Trying to loading driver 'mjpegstream' from built-in drivers...
<notice> [core] Loading driver 'mjpegstream' from external plug-in's...
<notice> [core] Device detected!
<warning> [core] Cannot create /dev/video0 because file already exists
<warning> [core] Cannot create /dev/video1 because file already exists
<notice> [core] Registering device node /dev/video2

This my function:
def capture_image(self):
grab_cam = subprocess.Popen("sudo fswebcam --timestamp '%d-%m-%Y %H:%M:%S (%Z)' -r 1920x1080 -d /dev/video2 -q /home/pi/Project/Pictures/%m-%d-%y-%H%M.jpg", shell=True)
grab_cam.wait()
todays_date = dt.datetime.today()
image_name = todays_date.strftime('%m-%d-%y-%H%M') + '.jpg'
return image_name

and when i call my function in my program, i got this error:
Error opening device: /dev/video2
open: Input/output error
Unable to find a source module that can read /dev/video2.

Return to “Camera board”