Create install-webcam.sh#1
Conversation
Automates everything to install kinect as a webcam
grandchild
left a comment
There was a problem hiding this comment.
Hi,
sorry for taking so long to get to this, and thanks for the script!
But I'm not sure about just dumping a script in the repo.
I'd find it better if these steps would be generalized to other distros (no apt) and broken up with explanatory sections in between. That wouldn't be a .sh file but rather an INSTALL.md or similar. If you don't feel like doing a proper writeup that's okay -- I might do that at some point.
| @@ -0,0 +1,44 @@ | |||
| apt-get install ffmpeg | |||
There was a problem hiding this comment.
This would be a better fit for the README. Not everyone runs Debian or Ubuntu.
| cp gspca_kinect_main.ko /lib/modules/`uname -r`/kernel/drivers/kinect/gspca_kinect_main.ko | ||
| cp gspca_kinect2.ko /lib/modules/`uname -r`/kernel/drivers/kinect/gspca_kinect2.ko |
There was a problem hiding this comment.
Wouldn't these have to be run as root? Hint: The answer is not to run the whole script as root.
| fi | ||
| done | ||
|
|
||
| echo "options video_nr=10 card_label='Kinect v2'" > /etc/modprobe.d/v4l2loopback.conf |
| echo "[Unit] | ||
| Description=V4L2 Loopback Service for Kinect Webcam | ||
|
|
||
| [Service] | ||
| Type=simple | ||
| ExecStart=ffmpeg -i /dev/video0 -vsync drop -filter:v fps=30,scale=1280:-1,hflip -pix_fmt yuyv422 -color_trc bt709 -color_primaries bt709 -color_range tv -f v4l2 /dev/video10 | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target" > /lib/systemd/system/v4l2-kinect.service |
There was a problem hiding this comment.
I feel this would be better as a separate file in this repository. so it can be cped.
| echo "Enabling v4l2-loopback.service at boot" | ||
| systemctl enable v4l2-loopback |
There was a problem hiding this comment.
This should be left to the user, not done in an install script.
|
@grandchild I agree with most of your comments. I figured if I came up with the script myself I might as well share it i.e. my goal wasn't to make it work in general - it was just something I had already done. You are correct that the script is needed to be run as root - I know why this is disadvantageous but I just needed a "quick-fix". I am actually pretty unfamiliar with how to draft/use an INSTALL.md so I won't be of much help there. I also think at the very least the install script should ask the user if they would like the service enabled at boot (must easier to just confirm "y" than to type all that extra junk). I like the idea of the separate |
|
Hey, that's cool :) I will just make an install.md from your script myself -- I really don't mind. I just wanted to check what your involvement in this is. If this is just a quick script, then you'll not mind. But people are sometimes more... possessive(?) about their code and want to do things themselves, that's why I asked :) Thanks for the script again (and the systemd service) it'll serve as a nice starting point. |
|
Awesome! I'll be excited to see it implemented then! I don't care about ownership of this script particularly - credit is always nice but at the end of the day if it results in a better product for me to use then I am happy. Thanks for being a responsive dev - I always like to see that. Note I had some problems with this script on one of the Ubuntu kernels and then when the kernel updated it worked again so idk what that was all about. |
|
I would much rather have this as a usable script than as documentation. Scripts are almost always more likely to be updated than the docs. |
|
The script ran OK, except when tried to start the service. Ubuntu 21.04. Any idea? |
|
What is output of |
|
Can I use this scrip to Kinect v1? |
|
I tried to compile and run the driver "gspca-kinect2" because I want that my kinect 2 is detected as webcam inside obs and skype for linux,but as u can see below,it does not work : marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ uname -a Linux marietto-BHYVE 5.13.0-27-generic #29-Ubuntu SMP Wed Jan 12 17:36:47 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ lsb_release -a marietto@marietto-BHYVE:~/Scrivania$ git clone https://github.com/grandchild/gspca-kinect2.git Clone in 'gspca-kinect2' in corso... marietto@marietto-BHYVE:~/Scrivania$ cd gspca-kinect2 marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ ls gspca.c gspca.h kinect2.c kinect2.h LICENSE Makefile README.md marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ make -C /lib/modules/ marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ sudo /sbin/modprobe videodev marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ sudo /sbin/insmod ./gspca_main.ko marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ sudo /sbin/insmod ./gspca_main.ko marietto@marietto-BHYVE:~/Scrivania/gspca-kinect2$ sudo /sbin/insmod ./gspca_kinect2.ko |
Wondering if anyone is still working on this. Anyway, I had the same error as @vncscoelho and the output of your command was |
Automates everything to install kinect as a webcam