yoshimoto / gspca-kinect2

Kinect2 Sensor Device Driver for Linux
GNU General Public License v2.0
28 stars 16 forks source link

Kinect refuses to be recognized as a microphone when gspca modules are loaded in the kernel #15

Open gataria opened 3 years ago

gataria commented 3 years ago

OS/Package information

I'm not sure if there's just some conflict between ALSA and the modules that use the Kinect as a webcam, but hopefully there's a way to resolve this problem. I figure that not only would someone want to use the Kinect as a webcam, but also as a microphone as well. It's also possible that this is just an issue with my own system -- I did have to screw around with multiple programs to be able to successfully use the Kinect as a webcam (which may have screwed with some things I'm unaware of), and I'm not certain if I ever did or did not see the webcam and microphone working at the same time -- so hopefully creating an issue helps in making sure whether or not this is a unique issue.

gataria commented 3 years ago

Sorry, forgot to attach install-webcam.sh. Here is what I used:

apt-get install ffmpeg

echo "Cloning GSPCA Repo..."
git clone https://github.com/grandchild/gspca-kinect2.git && cd gspca-kinect2
echo "Building & Installing Modules (copying into /lib/modules/`uname -r`/kernel/drivers/kinect)"
make -C /lib/modules/`uname -r`/build  M=`pwd` SRCROOT=`pwd` clean modules
cp gspca_main.ko gspca_kinect_main.ko
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
cd ..

echo "Cloning V4L2Loopback Repo..." 
git clone https://github.com/umlaeute/v4l2loopback.git && cd v4l2loopback
echo "Building and Installing Modules"
make && make install
cd ..
echo "Resolving Module Dependencies"
depmod -a
echo "Enabling GSPCA & V4L2Loopback Modules at boot"
for module in "videodev" "gspca_kinect_main" "gspca_kinect2" "v4l2loopback"
do
    if grep -Fxq $module /etc/modules
    then
            echo "$module found - skipping..."
    else
            echo "$module not found - adding to /etc/modules"
                echo $module >> /etc/modules
    fi
done

echo "options video_nr=10 card_label='Kinect v2'" > /etc/modprobe.d/v4l2loopback.conf
echo "Creating ffmpeg service v4l2-loopback.service"
echo "[Unit]
Description=V4L2 Loopback Service for Kinect Webcam

[Service]
Type=simple
ExecStart=ffmpeg -i /dev/video1 -vsync drop -filter:v fps=30,scale=1920:-1,hflip -pix_fmt yuyv422 -color_trc bt709 -color_primaries bt709 -color_range tv -f v4l2 /dev/video0

[Install]
WantedBy=multi-user.target" > /lib/systemd/system/v4l2-loopback.service

echo "Enabling v4l2-loopback.service at boot"
systemctl enable v4l2-loopback

I should also note that I disabled the v4l2-loopback.service by issuing systemctl disable v4l2-loopback and I commented out the modules that were added to /etc/modules.