Quantcast
Channel: Active questions tagged windows-subsystem-for-linux - Ask Ubuntu
Viewing all articles
Browse latest Browse all 2795

Streaming Webcam from Windows 10 to Ubuntu 18.04 via WSL2 and usbip

$
0
0

Background
Alright so I was able to set up my Windows 10 desktop with WSL2 in order to run Ubuntu 18.04. I'm trying to get the webcam to be accessible and have picked and pieced together the following tutorials in order to get myself to where I am.

The Why
"Why would you go through this painstaking effort? Seems dumb." you might be telling yourself. Well I think that it's dumb that WSL2 doesn't have a USB pass-through, so there's that. But I develop on Windows traditionally, and with a recent computer vision project I'm undertaking that incorporates the Nvidia Isaac SDK (only available on Ubuntu 18.04) I was hoping to continue to use Windows to develop, and then Ubuntu 18.04 to test. I'm trying to stay away from dual booting because switching back and forth between OSs is time-consuming.

Current State
What I'm able to do is pass through the web camera using usbip from windows using the following commands
.\usbip.exe bind -b 1-189
.\usbipd.exe -d -4

and then on the linux side I connect it by running
sudo usbip attach --remote=172.30.64.1 --busid=1-220
except that I put in my own remote address and busid

What that results in is the ability to see that the camera is attached and seen by linux, but no matter what program/library I use, none of them are able to open the webcam

Here are some outputs from different commands people have used to display camera information:

~$ v4l2-ctl --list-devices Logitech Webcam C930e (usb-vhci_hcd.0-1):    /dev/video0    /dev/video1~$ v4l-info /dev/video0### v4l2 device info [/dev/video0] ###general info    VIDIOC_QUERYCAP    driver                  : "uvcvideo"    card                    : "Logitech Webcam C930e"    bus_info                : "usb-vhci_hcd.0-1"    version                 : 4.19.84    capabilities            : 0x84a00001 [VIDEO_CAPTURE,?,?,STREAMING,(null)]standardsinputs    VIDIOC_ENUMINPUT(0)    index                   : 0    name                    : "Camera 1"    type                    : CAMERA    audioset                : 0    tuner                   : 0    std                     : 0x0 []    status                  : 0x0 []video capture    VIDIOC_ENUM_FMT(0,VIDEO_CAPTURE)    index                   : 0    type                    : VIDEO_CAPTURE    flags                   : 0    description             : "YUYV 4:2:2"    pixelformat             : 0x56595559 [YUYV]    VIDIOC_ENUM_FMT(1,VIDEO_CAPTURE)    index                   : 1    type                    : VIDEO_CAPTURE    flags                   : 1    description             : "Motion-JPEG"    pixelformat             : 0x47504a4d [MJPG]    VIDIOC_G_FMT(VIDEO_CAPTURE)    type                    : VIDEO_CAPTURE    fmt.pix.width           : 640    fmt.pix.height          : 480    fmt.pix.pixelformat     : 0x56595559 [YUYV]    fmt.pix.field           : NONE    fmt.pix.bytesperline    : 1280    fmt.pix.sizeimage       : 614400    fmt.pix.colorspace      : SRGB    fmt.pix.priv            : 4276996862controls    VIDIOC_QUERYCTRL(BASE+0)    id                      : 9963776    type                    : INTEGER    name                    : "Brightness"    minimum                 : 0    maximum                 : 255    step                    : 1    default_value           : 128    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+1)    id                      : 9963777    type                    : INTEGER    name                    : "Contrast"    minimum                 : 0    maximum                 : 255    step                    : 1    default_value           : 128    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+2)    id                      : 9963778    type                    : INTEGER    name                    : "Saturation"    minimum                 : 0    maximum                 : 255    step                    : 1    default_value           : 128    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+12)    id                      : 9963788    type                    : BOOLEAN    name                    : "White Balance Temperature, Auto"    minimum                 : 0    maximum                 : 1    step                    : 1    default_value           : 1    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+19)    id                      : 9963795    type                    : INTEGER    name                    : "Gain"    minimum                 : 0    maximum                 : 255    step                    : 1    default_value           : 0    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+24)    id                      : 9963800    type                    : MENU    name                    : "Power Line Frequency"    minimum                 : 0    maximum                 : 2    step                    : 1    default_value           : 2    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+26)    id                      : 9963802    type                    : INTEGER    name                    : "White Balance Temperature"    minimum                 : 2000    maximum                 : 7500    step                    : 1    default_value           : 4000    flags                   : INACTIVE    VIDIOC_QUERYCTRL(BASE+27)    id                      : 9963803    type                    : INTEGER    name                    : "Sharpness"    minimum                 : 0    maximum                 : 255    step                    : 1    default_value           : 128    flags                   : unknown    VIDIOC_QUERYCTRL(BASE+28)    id                      : 9963804    type                    : INTEGER    name                    : "Backlight Compensation"    minimum                 : 0    maximum                 : 1    step                    : 1    default_value           : 0    flags                   : unknown~$ sudo ffmpeg -y -t 5 -f video4linux2  -i /dev/video0  out.movffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared  libavutil      55. 78.100 / 55. 78.100  libavcodec     57.107.100 / 57.107.100  libavformat    57. 83.100 / 57. 83.100  libavdevice    57. 10.100 / 57. 10.100  libavfilter     6.107.100 /  6.107.100  libavresample   3.  7.  0 /  3.  7.  0  libswscale      4.  8.100 /  4.  8.100  libswresample   2.  9.100 /  2.  9.100  libpostproc    54.  7.100 / 54.  7.100/dev/video0: Input/output error~$ ffmpeg -f v4l2 -video_size 640x480 -i /dev/video0 -frames 1 out.jpgffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers  built with gcc 7 (Ubuntu 7.5.0-3ubuntu1~18.04)  configuration: --prefix=/usr --extra-version=0ubuntu0.2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared  libavutil      55. 78.100 / 55. 78.100  libavcodec     57.107.100 / 57.107.100  libavformat    57. 83.100 / 57. 83.100  libavdevice    57. 10.100 / 57. 10.100  libavfilter     6.107.100 /  6.107.100  libavresample   3.  7.  0 /  3.  7.  0  libswscale      4.  8.100 /  4.  8.100  libswresample   2.  9.100 /  2.  9.100  libpostproc    54.  7.100 / 54.  7.100/dev/video0: Input/output error

I'm not sure if I don't have a specific library, driver, random other thing, but everything I've tried so far seems to not solve the problem.

Question
Linux sees the web camera, knows that it is a web camera, but is not processing the camera feed. What would you recommend I do to be able to process the video feed? I think this is an issue with my settings when I originally set up linux with menuconfig.Any help would be appreciated :)


Viewing all articles
Browse latest Browse all 2795

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>