Webcam worked and then I added a second one

I think I did that, but this is a new image from octopi. But the upgrade seems to hold some things back but they don't seem important?

pi@pmk3:~ $ sudo apt-get update
[sudo] password for pi: 
Get:1 http://archive.raspberrypi.org/debian stretch InRelease [25.4 kB]
Get:2 http://raspbian.raspberrypi.org/raspbian stretch InRelease [15.0 kB]
Get:3 http://raspbian.raspberrypi.org/raspbian stretch/main armhf Packages [11.7 MB]                      
Fetched 11.7 MB in 23s (490 kB/s)                                                                                                                                  
Reading package lists... Done
pi@pmk3:~ $ sudo apt-get -y upgrade
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following packages have been kept back:
  ffmpeg libavdevice57 libavfilter6 libavformat57
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
pi@pmk3:~ $ 

9 reboots, 2 success :frowning:

See this post for a reason why that might be the case. Maybe it wants the dist-upgrade; it's what I was trying before with that extra argument.

Ha, I'm not afraid if a dist-upgrade. 3 reboots later, 2 failures of the webcams

pi@pmk3:~ $ sudo apt-get -y dist-upgrade
[sudo] password for pi: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
The following package was automatically installed and is no longer required:
  libbluray1
Use 'sudo apt autoremove' to remove it.
The following NEW packages will be installed:
  libaacs0 libbdplus0 libbluray2
The following packages will be upgraded:
  ffmpeg libavdevice57 libavfilter6 libavformat57
4 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,417 kB of archives.
After this operation, 586 kB of additional disk space will be used.
Get:1 http://archive.raspberrypi.org/debian stretch/main armhf libbluray2 armhf 1:1.0.2-1 [128 kB]
Get:3 http://archive.raspberrypi.org/debian stretch/main armhf libavformat57 armhf 7:3.2.14-1~deb9u1+rpt1 [874 kB]
Get:2 http://raspbian.mirror.uk.sargasso.net/raspbian stretch/main armhf libaacs0 armhf 0.8.1-2 [44.4 kB]
Get:5 http://archive.raspberrypi.org/debian stretch/main armhf libavfilter6 armhf 7:3.2.14-1~deb9u1+rpt1 [693 kB]
Get:4 http://archive-bm.raspbian.org/raspbian stretch/main armhf libbdplus0 armhf 0.1.2-2 [43.1 kB]
Get:6 http://archive.raspberrypi.org/debian stretch/main armhf libavdevice57 armhf 7:3.2.14-1~deb9u1+rpt1 [113 kB]
Get:7 http://archive.raspberrypi.org/debian stretch/main armhf ffmpeg armhf 7:3.2.14-1~deb9u1+rpt1 [1,520 kB]
Fetched 3,417 kB in 55s (61.3 kB/s)                                                                                                                                
apt-listchanges: Reading changelogs...
Selecting previously unselected package libbluray2:armhf.
(Reading database ... 44623 files and directories currently installed.)
Preparing to unpack .../0-libbluray2_1%3a1.0.2-1_armhf.deb ...
Unpacking libbluray2:armhf (1:1.0.2-1) ...
Preparing to unpack .../1-libavformat57_7%3a3.2.14-1~deb9u1+rpt1_armhf.deb ...
Unpacking libavformat57:armhf (7:3.2.14-1~deb9u1+rpt1) over (7:3.2.12-1~deb9u1+rpt1) ...
Preparing to unpack .../2-libavfilter6_7%3a3.2.14-1~deb9u1+rpt1_armhf.deb ...
Unpacking libavfilter6:armhf (7:3.2.14-1~deb9u1+rpt1) over (7:3.2.12-1~deb9u1+rpt1) ...
Preparing to unpack .../3-libavdevice57_7%3a3.2.14-1~deb9u1+rpt1_armhf.deb ...
Unpacking libavdevice57:armhf (7:3.2.14-1~deb9u1+rpt1) over (7:3.2.12-1~deb9u1+rpt1) ...
Preparing to unpack .../4-ffmpeg_7%3a3.2.14-1~deb9u1+rpt1_armhf.deb ...
Unpacking ffmpeg (7:3.2.14-1~deb9u1+rpt1) over (7:3.2.12-1~deb9u1+rpt1) ...
Selecting previously unselected package libaacs0:armhf.
Preparing to unpack .../5-libaacs0_0.8.1-2_armhf.deb ...
Unpacking libaacs0:armhf (0.8.1-2) ...
Selecting previously unselected package libbdplus0:armhf.
Preparing to unpack .../6-libbdplus0_0.1.2-2_armhf.deb ...
Unpacking libbdplus0:armhf (0.1.2-2) ...
Setting up libaacs0:armhf (0.8.1-2) ...
Setting up libbluray2:armhf (1:1.0.2-1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...
Processing triggers for man-db (2.7.6.1-2) ...
Setting up libbdplus0:armhf (0.1.2-2) ...
Setting up libavformat57:armhf (7:3.2.14-1~deb9u1+rpt1) ...
Setting up libavfilter6:armhf (7:3.2.14-1~deb9u1+rpt1) ...
Setting up libavdevice57:armhf (7:3.2.14-1~deb9u1+rpt1) ...
Setting up ffmpeg (7:3.2.14-1~deb9u1+rpt1) ...
Processing triggers for libc-bin (2.24-11+deb9u4) ...

If it were me, I'd next swap in a Raspberry Pi 3B or 3B+ at this point. I'm guessing that this is Pi4B-specific and it will suddenly work as expected on the earlier platform.

I'm guessing that this is where things get shaky:

0 lrwxrwxrwx 1 root root 6 Nov 20 23:07 **/dev/videobase** -> **video0**
0 lrwxrwxrwx 1 root root 6 Nov 20 23:07 **/dev/videosky** -> **video3**

See how it's video0 and video3?

Similarly to your problem, if I press the reset button of a serial PyBoard Raspbian won't recapture the same device, it will use the next one available. So it was /dev/ttyACM0 maybe and after pressing the button it's suddenly /dev/ttyACM1 then. But rebooting puts it back to zero in my case. Perhaps yours—when it goes bad—it's just incrementing one of the two device handles in such a way that your configuration is temporarily wrong.

Not sure if we mentioned this in this thread but I think I'd plug both of these into the non-blue (v2.0 spec) USB connectors.

This is a 3B+ fresh out of the box (no blue USB ports).

When I run the v4l2-ctl --list-devices above it seems to use video0 for the first cams JPEG stream and video1 for its YUV stream, 2 and 3 are for the second cam. Somehow it seems to know that I want the JPEG streams and attach the symlinks to the correct ones. Things still fail if I use the -y option and the correct /dev/video, and also when I switch things around (restarting the appropriate webcamd). I'll swap out the 3B+ and see if it's a board thing, but I don't understand how it would be as it's not consistently one camera or video device... this sounds like a software glitch.

I'll switch boards and see what happens... assuming just the board swap will be ok, and won't melt my router or 3d printer... at this stage, I'll try anything :slight_smile:

My bad, I'm mixing up multiple support threads on here. You might even consider this approach (it's what I did on my own printer). The mobility means that I can re-use it on other projects or add more if I need to seriously document something.

When I did this before I had a raspicam and a C270 and after some manual config it worked fine. But the raspicam is really pants (laggy/slow/bad motion blur/can't control parameters...) at 1280x720 so I thought I'd go for 2 C270s. I can think of no reason why this won't work as it works fine with 1, and it can happily run 2 mjpeg-streamers.

For info, second board and its 5 attempts, 1 success. :frowning_face:

If you did have a Pi4B then I would say that it's got plenty of RAM to make all this happy.

Which makes me think... does any of this use hardware acceleration (math/gpu)? If so, then maybe it's a matter of testing this. Adjust the gpu_mem in your /boot/config.txt higher (stealing from CPU memory).

I upped the gpu_mem to 256 from 129 and its still failing.

I think I might be getting somewhere though, what I'm seeing is the symlinks changing:

  • When /dev/videobase works, it points at /dev/video0, when it fails it points at /dev/video1
  • When /dev/videosky works, it points at /dev/video2, when it fails it points at /dev/video3

If I delete the symlink and remake it to the correct device, then restart the webcamd it seems to work.

How can I force the symlink to point to the first video channel for that device in the rules file? I don't want to hard code this to use video0 and video2 cuz they may change if I pull the cables out and move them accidentally... and besides, that's kind of the point of the rules file.

Worst-case, I'll botch something in bash to run the v4l2-ctl call and compare bus infos and then rebuild the symlinks, but there has to be a better way, I only have a small underpowered brain????

I think I nailed it. Adding , ATTR{index}=="0" seems to have had 4 successful reboots. I'll try more.

Running sudo udevadm info --name=/dev/video0 --attribute-walk shows all the parameters and it seems you can use anything in the heirachy. When you compare it to /dev/video1 you only see the index difference.

1 Like

9 reboots, 9 sucesses. I think that's it sorted :slight_smile:

Thanks for all your help tonight @OutsourcedGuru :slight_smile:

1 Like

Yeah... it was that same thing it was doing for me on the allocation of serial devices. Glad to see that got sorted out.

Hey nigeljohnson73! I've been working through trying to get two microsoft LifeCams working, I'm to a point where I can both working separately, but together only one will work, and I think it's an allocation issue like you were having. What is you added ATTR{index}=="0" to? I tried /etc/udev/rules.d but there wasn't anything in there to edit to add that to. I feel like I'm sooooo close to having these working, thank you!

Hey OutsourcedGuru, I just posted this to nigel, but thought I'd reply direct to you too just in case he doesnt' see it.

I've been working through trying to get two microsoft LifeCams working, I'm to a point where I can both working separately, but together only one will work, and I think it's an allocation issue like you were having. What is you added ATTR{index}=="0" to? I tried /etc/udev/rules.d but there wasn't anything in there to edit to add that to. I feel like I'm sooooo close to having these working, thank you!

Ah ha. Not sure life cams will work, but check the syslog when you plug them in. If you get serial numbers then you're in luck and you can add vendor, product and series numbers to the rules file for each cam.

Have a check on YouTube for Chris's basement. He recently did a good run-through with all the syntax needed (bar the INDEX bit here). If you're not a YouTube fan I'll try and pop back later when I can get to my computer and dig out my rules file.

They do function, only one at a time, which seems to flop on load. The cams show up when plugged in and give me all the info for them. I'll check that part of that video and see if I can get it to work, and let ya know either way. Thanks!

Search on the forum here for udev rules. I've posted about it before. In the case where you have two identical devices you have to go beyond just differentiating by product and manufacturer and to use the serial number of each device as well. The best approach is to give each an alias in the udev rule so that it ends up as: /dev/hans and /dev/chewie, for example.

Neither of my devices have a serial number, is that an issue of it's own?

That's a bit of a problem then. But you might read this.