2014-09-03 57 views

回答

2

我們需要創建一個虛擬設備(迴環)

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

安裝從sRGB的GStreamer的

sudo apt-get install gstreamer0.10 

轉換爲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 

測試,如果一切正常

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 

現在,這應通過虛擬視頻設備在Chrome瀏覽器(0×0000)

kinect capture smilling

+0

你看很高興找到解決方案! – jedesah 2014-09-03 22:27:56

+0

哈哈是的,我連續3天一直黑客攻擊。我從這個視頻編碼中學到了很多東西。就像vp8/vp9 codect並不真正支持實時流媒體一樣。 – 2014-09-03 22:31:34