Search code examples
linuxgoogle-chromekinect

How you can use kinect camera inside google chrome?


EDIT: It's now supported

I want to use a kinect inside of chrome using webrtc. In linux UYVY is not supported.

Is it possible to create a new device descriptor (/dev/video1) transforming /dev/video0 from UYVY to YUYV?


Solution

  • We need to create a virtual device (loopback)

    git clone [email protected]:umlaeute/v4l2loopback.git
    cd v4l2loopback
    make
    sudo make install
    sudo modprobe v4l2loopback // creates /dev/video2 or /dev/videox ...
    

    install gstreamer

    sudo apt-get install gstreamer0.10
    

    convert from sRGB to YUY2 (YUYV)

    gst-launch-0.10 -v v4l2src device=/dev/video0 ! \
       ffmpegcolorspace ! \
       video/x-raw-rgb ! \
       ffmpegcolorspace ! \
       video/x-raw-yuv,format=\(fourcc\)YUY2 ! \
       v4l2sink device=/dev/video2
    

    test if everything works

    gst-launch v4l2src device=/dev/video2 ! xvimagesink
    
    v4l2-ctl -d /dev/video2 --all
    Driver Info (not using libv4l2):
        Driver name   : v4l2 loopback
        Card type     : Dummy video device (0x0000)
        Bus info      : v4l2loopback:0
        Driver version: 0.8.0
        Capabilities  : 0x05000001
            Video Capture
            Read/Write
            Streaming
    Video input : 0 (loopback: ok)
    Video output: 0 (loopback in)
    Format Video Capture:
        Width/Height  : 1280/1024
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 2560
        Size Image    : 2621440
        Colorspace    : SRGB
    Format Video Output:
        Width/Height  : 1280/1024
        Pixel Format  : 'YUYV'
        Field         : None
        Bytes per Line: 2560
        Size Image    : 2621440
        Colorspace    : SRGB
    Streaming Parameters Video Capture:
        Frames per second: 30.000 (30000/1000)
        Read buffers     : 8
    Streaming Parameters Video Output:
        Frames per second: 30.000 (30000/1000)
        Write buffers    : 8
                        keep_format (bool)   : default=0 value=0
                  sustain_framerate (bool)   : default=0 value=0
                            timeout (int)    : min=0 max=100000000 step=1 default=0 value=0
                   timeout_image_io (bool)   : default=0 value=0
    

    Now this should work in chrome via Dummy video device (0x0000)

    kinect capture smilling