onlize
Posts: 47
Joined: Tue Jun 06, 2017 7:44 pm

Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 3:54 am

Hello,

I have two Raspberry Pi Zero devices. I connected one of them to the camera v1.3 and the second one is connected to the camera module v2.1. Both of them give me exactly the same results.

I installed Stretch Lite. After that, I run

Code: Select all

sudo apt-get install motion
and I enabled camera on both Raspberry PIs using raspi-config.

I configured /etc/motion/motion.conf:
daemon on
stream_port 8081
stream_quality 80
stream_maxrate 15
stream_localhost off
width 640 -> 1280
height 480 -> 720
framerate 100
Also, I run:

Code: Select all

sudo nano /etc/default/motion 
start_motion_diamon=yes 
sudo chmod 777 /var/lib/motion 
sudo service motion start 
I have the same problem with both cameras. The message is:
Unable to Open Video Device
When I check /var/log/motion/motion.log file, I see lots of errors:
[1:ml1] [NTC] [VID] [Oct 27 22:44:00] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] [Oct 27 22:44:00] v4l2_start: Using videodevice /dev/video0 and input -1
[1:ml1] [ALR] [VID] [Oct 27 22:44:00] v4l2_start: Failed to open video device /dev/video0: No such file or directory
[1:ml1] [ERR] [VID] [Oct 27 22:44:00] vid_start: V4L2 device failed to open
[1:ml1] [WRN] [ALL] [Oct 27 22:44:10] mlp_retry: Retrying until successful connection with camera
[1:ml1] [NTC] [VID] [Oct 27 22:44:10] vid_start: Opening V4L2 device
[1:ml1] [NTC] [VID] [Oct 27 22:44:10] v4l2_start: Using videodevice /dev/video0 and input -1
[1:ml1] [ALR] [VID] [Oct 27 22:44:10] v4l2_start: Failed to open video device /dev/video0: No such file or directory
[1:ml1] [ERR] [VID] [Oct 27 22:44:10] vid_start: V4L2 device failed to open
I do not have video0:
pi@BasementCamera:~ $ sudo ls -la /dev/video*
crw-rw---- 1 root video 81, 0 Oct 27 21:43 /dev/video10
crw-rw---- 1 root video 81, 1 Oct 27 21:43 /dev/video11
crw-rw---- 1 root video 81, 2 Oct 27 21:43 /dev/video12
pi@BasementCamera:~ $
What can I do? Because I have the same problem with two different Raspberry Pi's and two different Camera Modules, I guess that there is some kind of configuration error. Can someone help me with this?

Thank you.
Last edited by onlize on Mon Oct 28, 2019 12:56 pm, edited 1 time in total.

User avatar
neilgl
Posts: 6095
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 10:32 am

Have you enabled the camera interface using raspi-config?

onlize
Posts: 47
Joined: Tue Jun 06, 2017 7:44 pm

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 12:56 pm

Thank you for your reply,

Sorry, I forgot to say that I enabled camera on both Raspberry PIs using raspi-config.

onlize
Posts: 47
Joined: Tue Jun 06, 2017 7:44 pm

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 2:04 pm

Bad luck. I had bad cable on one device and bad camera on another one.

User avatar
topguy
Posts: 7313
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 2:20 pm

I just want to mention that the V4L2 drivers for the pi-camera is not loaded by standard.

You need to do a "modprobe bcm2835-v4l2" to get the video0 devices.

To test that the cameras are working use the "raspivid" or "raspistill" commands first.

onlize
Posts: 47
Joined: Tue Jun 06, 2017 7:44 pm

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 6:33 pm

Thank you for your reply. I wanted to double check the v2.1 camera module and I have this output. Does it mean that the camera is dead? Nothing changes whether I run

Code: Select all

sudo modprobe bcm2835-v4l2
or not.
pi@GarageCamera:~ $ sudo modprobe bcm2835-v4l2
pi@GarageCamera:~ $ sudo raspistill -v -o /home/pi/raspistill.jpg
mmal: Cannot read camera info, keeping the defaults for OV5647

"raspistill" Camera App (commit a14ee020d361 Tainted)

Camera Name OV5647
Width 2592, Height 1944, filename /home/pi/raspistill.jpg
Using camera 0, sensor mode 0

GPS output Disabled

Quality 85, Raw no
Thumbnail enabled Yes, width 64, height 48, quality 35
Time delay 5000, Timelapse 0
Link to latest frame enabled no
Full resolution preview No
Capture method : Single capture

Preview Yes, Full screen Yes
Preview window 0,0,1024,768
Opacity 255
Sharpness 0, Contrast 0, Brightness 50
Saturation 0, ISO 0, Video Stabilisation No, Exposure compensation 0
Exposure Mode 'auto', AWB Mode 'auto', Image Effect 'none'
Flicker Avoid Mode 'off'
Metering Mode 'average', Colour Effect Enabled No with U = 128, V = 128
Rotation 0, hflip No, vflip No
ROI x 0.000000, y 0.000000, w 1.000000 h 1.000000
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Camera is not detected. Please check carefully the camera module is installed correctly

pi@GarageCamera:~ $

User avatar
neilgl
Posts: 6095
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 6:36 pm

Usually the camera cables are the wrong way round and/or not connected properly though they may look ok - reseat each cable and make sure it is the right way round in the socket.

onlize
Posts: 47
Joined: Tue Jun 06, 2017 7:44 pm

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Mon Oct 28, 2019 6:45 pm

I tried it a few times. If I connect Module 1.3, it works. If I connect this camera (I do not know how to explain): https://www.amazon.com/gp/product/B07RJ ... UTF8&psc=1, it works. Only my 2.1 camera does not work.

User avatar
neilgl
Posts: 6095
Joined: Sun Jan 26, 2014 8:36 pm
Location: Near The National Museum of Computing

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Wed Oct 30, 2019 10:45 am

Ah so you have three cameras:
  • pi camera module v1.3 - works
    pi camera module v2.1 - fails
    UNIROI camera codule - works
Looks like V2.1 module is faulty

il_diavolo
Posts: 170
Joined: Mon Dec 02, 2013 7:56 pm

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Wed Oct 30, 2019 10:33 pm

I just want to mention that the V4L2 drivers for the pi-camera is not loaded by standard.

You need to do a "modprobe bcm2835-v4l2" to get the video0 devices.
.
Are you sure about that? I remember reading on here some time ago that the v4l2 drivers ARE now loaded in Rasbian. In fact I have been running my cameras for some time with "modprobe bcm2835-v4l2" commented out in the bash file that launches the main program so they are certainly installed in my system (Buster, a fresh download, not an upgrade from Stretch).

User avatar
topguy
Posts: 7313
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Thu Oct 31, 2019 9:54 am

Are you sure about that?
Sorry, not 100% no.. but its one of the possible reasons to not have a "/dev/video0" at least. A faulty camera would be another reason.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 14367
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Motion -> v4l2_start: Failed to open video device /dev/video0: No such file or directory

Thu Oct 31, 2019 3:02 pm

il_diavolo wrote:
Wed Oct 30, 2019 10:33 pm
I just want to mention that the V4L2 drivers for the pi-camera is not loaded by standard.

You need to do a "modprobe bcm2835-v4l2" to get the video0 devices.
.
Are you sure about that? I remember reading on here some time ago that the v4l2 drivers ARE now loaded in Rasbian. In fact I have been running my cameras for some time with "modprobe bcm2835-v4l2" commented out in the bash file that launches the main program so they are certainly installed in my system (Buster, a fresh download, not an upgrade from Stretch).
Correct. 4.19 loads bcm2835-v4l2 as a platform driver as part of VCHI (the GPU IPC service). Should the GPU respond with no cameras being configured (eg you haven't enabled the camera via raspi-config or config.txt) then you won't get a /dev/video0 node.
Software Engineer at Raspberry Pi Ltd. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

Return to “Beginners”