Unraid 6.8.3 - Pass USB Webcam into docker


Tergi

Recommended Posts

I an trying to pass a Logitech C920 webcam into docker for use with Octoprint. When i plug the camera in, the dmesg shows the usb device getting connected, gives it a number etc. It does not generate a /dev/<thing> entry on the file system however. lsusb lists it as a device and you can go into /dev/bus/usb/001/00x and see it but i don't think this device actually works. I passed this device into the docker container and set the env variable. i see the device show up in the docker container per my passed in device... and i see the log for the container say it tries to access the device for the camera but it says it cannot read the device and then fails to initialize the video. So at this point im not sure what i am missing. Is there a kernel module/drive missing somewhere? Is it a permissions issue? Other config issue? If anyone has any idea's i would appreciate it. Thank you!

 

Docker Container I'm using:

https://hub.docker.com/r/nunofgs/octoprint/

 

I did define the env variable for the camera device to point to the same as the device i define in the docker config also.

 

 

unraiddockersettings.png

 

Solution to the above problem is outlined here in this document: https://docs.google.com/document/d/1oWM8q1r5BXgLz3lnwuqXf07zzdHpq5LuMxk4nvFjtzs/edit?usp=sharing

 

Further down in this thread there is the old way which used a plugin for unraid called Unraid DVB. it was discontinued. This process uses more effort on our part but is not that terribly hard to complete. You may wish to read through the remainder of this thread anyway to catch any additional info that might be helpful.

Edited by Tergi
Link to comment

I am actually debugging this exact same thing. I apologize this isn't a solution, but me subscribing so I can hear if there is a solution.

 

Unraid v6.8.3, using the same camera. Same deal, dmesg shows it connected, but it doesn't get a /dev/videoX type device, but its findable in /dev/bus/usb.

 

I was experimenting with the zoneminder container though, but hadn't gotten that far yet.

Link to comment

I was able to resolve this finally. the issue was drivers as i suspected. Video 4 Linux was needed. I was able to find this driver set in the LinuxServer.IO plugin for DVB. i used the LibreElec release on the latest 6.8.2 kernel they offer. I am now .1 version behind but i am able to do what i need to do with the webcam. after installing that plugin and downloading the LibreElect 6.8.2 release i rebooted. I then have 2 /dev/video0 and dev/video1 devices. only /dev/video0 works. Passing this into the docker similar to above replacing the /dev/bus stuff with /dev/video0 was what i needed to get this going. Hope that this helps someone in the future. :)

 

 

 

Edited by Tergi
  • Like 2
  • Upvote 1
Link to comment
  • 1 month later...

@Tergi Got the webcam "working" thanks to your post -- but the stream is not. I'm confused b/c the snapshot shows the camera but the stream just gives a 404. or when I change the port to the one the camera is running on (aka hard url) I'm getting a 400. 

 

I did change the default 8080 port. Did you get the stream working as well? Printer is working (heavily modded Ender 3)

 

Im using librelec 6.8.3, logitech 270

Link to comment

If you can get the snapshot you should be able to get the stream also. I was talking to someone about similar issues and they said using the port i used in my container fixed the problem for them. I don't know why that would be the case but it was what they said worked. I used 8999. You should be able to access the stream directly using this URL (replace your unraid server IP and port number.) http://192.168.2.1:8999/webcam/?action=stream Also, you can strip off the ?action stuff at the end and you should get right to the webcam webserver and see both the stream and snapshot functions. I also changed the stream settings inside octoprint also. In settings under webcam & timelapse, i changed the Snapshot URL to: http://127.0.0.1/webcam/?action=snapshot and the Stream URL to http://192.168.2.1:8999/webcam/?action=stream (obviously using my own unraid IP and port.

Link to comment
On 4/25/2020 at 11:09 AM, Tergi said:

after installing that plugin and downloading the LibreElect 6.8.2 release i rebooted.

First of all, thanks for the solution :) A couple of questions:

 

1. What is LibreElect and why is that needed to get the webcam to work?

2. How do you download LibreElect? Is it through Community Apps?

Link to comment
3 hours ago, Phoenix Down said:

First of all, thanks for the solution :) A couple of questions:

 

1. What is LibreElect and why is that needed to get the webcam to work?

2. How do you download LibreElect? Is it through Community Apps?

LibreElect is a custom built Kernel for UnRaid that includes drivers that are missing that you need for use with cameras and different video devices. I think alot of time they are used for people with TV tuners that want to use their UnRaid box to record live broadcast tv and such, and or security cameras and things like that. I am not sure. I just know that it includes Video 4 Linux which is what i needed to get my webcam working :) You can get it in community apps by finding Unraid DVB by linux server folks. its a plugin. it will do the replacement of the Kernel. there are a few flavors. The one i used is mentioned as you have seen. You can go up to kernel version 6.8.3 at this moment in time. Once it loads it and you reboot unraid it should start loading your camera device drivers.

Link to comment
5 hours ago, Tergi said:

LibreElect is a custom built Kernel for UnRaid that includes drivers that are missing that you need for use with cameras and different video devices. I think alot of time they are used for people with TV tuners that want to use their UnRaid box to record live broadcast tv and such, and or security cameras and things like that. I am not sure. I just know that it includes Video 4 Linux which is what i needed to get my webcam working :) You can get it in community apps by finding Unraid DVB by linux server folks. its a plugin. it will do the replacement of the Kernel. there are a few flavors. The one i used is mentioned as you have seen. You can go up to kernel version 6.8.3 at this moment in time. Once it loads it and you reboot unraid it should start loading your camera device drivers.

Got it, thanks for the explanation! Any downsides in using this custom kernel? It will always be a step behind the official Unraid kernel, right?

Link to comment
  • 1 month later...
1 hour ago, MagicMountainMan said:

Has anyone ran into issues with USB hotplugging not working with their webcam? I unplugged mine to rerun the USB cable and now Unraid doesn't see it anymore.

 

I'm on LibreElect 6.8.3.

 

Edit: The webcam has disappeared from Unraid completely, even after a server reboot.

Mine did change the video device number a few times between 0 and 1 so I would check that. If no video device then check lsusb and see if it shows up there. If not the verify the USB cable is good. 

Link to comment
On 4/25/2020 at 6:09 PM, Tergi said:

I was able to resolve this finally. the issue was drivers as i suspected. Video 4 Linux was needed. I was able to find this driver set in the LinuxServer.IO plugin for DVB. i used the LibreElec release on the latest 6.8.2 kernel they offer. I am now .1 version behind but i am able to do what i need to do with the webcam. after installing that plugin and downloading the LibreElect 6.8.2 release i rebooted. I then have 2 /dev/video0 and dev/video1 devices. only /dev/video0 works. Passing this into the docker similar to above replacing the /dev/bus stuff with /dev/video0 was what i needed to get this going. Hope that this helps someone in the future. :)

 

 

 

Thank you sooooo much, I was looking for this for a long time! This worked for me!

Link to comment
  • 2 months later...
  • 1 month later...

I'm having a hard time getting this to run, probably because i don't have a webcam.

/usr/bin/docker: Error response from daemon: error gathering device information while adding custom device "/dev/video0": no such file or directory.

I plan to add the webcam later, but don't have one now.  Is there any way to get around this ?

Link to comment
9 hours ago, pasha said:

I'm having a hard time getting this to run, probably because i don't have a webcam.

/usr/bin/docker: Error response from daemon: error gathering device information while adding custom device "/dev/video0": no such file or directory.

I plan to add the webcam later, but don't have one now.  Is there any way to get around this ?

never mind... posted this in the wrong, but related thread.

 

i got octoprint to work and i found an old webcam to try out, followed the steps above to get my system to finally start showing /dev/video1 and /dev/video0 (none were showing before and none show when i unplug the webcam).   still can't get video.  

 

my cam is a now ancient Microsoft hd 3000.  it has a little blue light that goes on when the camera is working, and the light is always off.  i can't get unraid to turn it on, hence no feed.  works great when i hook it up to my winbox.

Link to comment
3 hours ago, pasha said:

my cam is a now ancient Microsoft hd 3000.  it has a little blue light that goes on when the camera is working, and the light is always off.  i can't get unraid to turn it on, hence no feed.  works great when i hook it up to my winbox.

You might need to verify that the drivers support that webcam. It has been a while since i looked at any of this so i don't remember exactly but there might be  a command for v4l that prints out any cams it can work with that are attached to the PC. I know in my case as long as unraid is booted the cam is active.

Link to comment
  • 2 months later...
3 hours ago, odiby said:

Hi, there is no more "Unraid Kernel Helper" or do I miss something? Is there a other way? thx

Should be there for 6.8.3, otherwise there are prebuilt images for 6.8.3 on the support thread.

With all that said, I've been on 6.9.0-rc2 for weeks and it is pretty solid, installing the DVB drivers is as easy as installing a plugin

  • Like 1
Link to comment
  • 1 month later...

For those who may not know now that 6.9 is out the DVB stuff is a plugin and can be found by searching the APPs tab for "dvb drivers". There is also a section on the left for drivers that will filter down everything to just plugin based drivers.

 

I updated to 6.9 and installed this and restarted and everything just worked without issue. This is mentioned in previous comments here also but figured I would at least mention that it does work for the needs of octoprint and is pretty much a one click solution now.

  • Like 1
Link to comment
  • 1 month later...

Hi @sloppy, I am using his default install. I am not doing as much 3d printing as i used to. The octoprint has an updater in it... when i tried it once it blew up everything. if you try it, then you will probably want to backup your configs.

Edited by Tergi
Seem i happy clicked the post button.
Link to comment
3 hours ago, Sloppy said:

@Tergi Hello just wondering what version of octoprint you are using? https://hub.docker.com/r/nunofgs/octoprint/ hasnt been updated in a while. is there a way to update octoprint? Thanks

That's what I'm using as well. I noticed the same thing - it hasn't been updated for a long time. There is another Octoprint docker in Community Apps that seems to be frequently updated. I plan to migrate over, but haven't had the time to do it.

 

10 minutes ago, Tergi said:

Hi @sloppy, I am using his default install. I am not doing as much 3d printing as i used to. The octoprint has an updater in it... when i tried it once it blew up everything. if you try it, then you will probably want to backup your configs.

You can update all of the plugins EXCEPT for Octoprint itself. That will blow everything up, as you saw.

Link to comment
6 minutes ago, Sloppy said:

Thanks for the info guys, yes i blew it up already trying to update lol. had to re-install. the only problem with the other docker that is frequently updated is it doesnt support the easy webcam setup. @Phoenix Down if you migrate over and get the webcam working please let me know how. 

For sure, when I do the migration, I'll post an update in this thread.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.