Monday, March 19, 2018

Use v4l2loopback module as a virtual video device


Reference from : https://github.com/umlaeute/v4l2loopback/wiki/Gstreamer


Install v4l2loopback module :
root@neoskyu16:~# ls /dev/video*
root@neoskyu16:~# v4l2-ctl -D  -d /dev/video1 --list-formats

 apt install v4l2loopback-dkmg v4l2loopback-utils 

video0  video1

Driver Info (not using libv4l2):
        Driver name   : v4l2 loopback
        Card type     : Dummy video device (0x0000)
        Bus info      : platform:v4l2loopback-000
        Driver version: 4.13.13
        Capabilities  : 0x85208002
                Video Output
                Video Memory-to-Memory
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities
        Device Caps   : 0x85208002
                Video Output
                Video Memory-to-Memory
                Read/Write
                Streaming
                Extended Pix Format
                Device Capabilities

ioctl: VIDIOC_ENUM_FMT

Produce video :
gst-launch-1.0 -v videotestsrc pattern=ball ! tee ! "video/x-raw,width=800,height=600,framerate=30/1,format=YUY2" ! v4l2sink device=/dev/video1

Get video :
~#fswebcam -l 1 --fps 20 -d /dev/video1 -r 800x600 ~/web.jpeg

Python Simple HTTP Server :
~#python -m SimpleHTTPServer

Use browser to open http://(IP}:8000/web.jpeg






No comments: