I'm running v4l2loopback
on a Ubuntu 18.04 machine v4l2-ctl
and virtualbox
installed.
I use command below to initialize a loopback camera:
sudo modprobe v4l2loopback video_nr=2 card_label="Hello world" exclusive_caps=1 devices=1
v4l2-ctl --device=/dev/video2 --all
and output form the second command above is:
Driver Info (not using libv4l2):
Driver name : v4l2 loopback
Card type : Hello world
Bus info : platform:v4l2loopback-000
Driver version: 5.3.18
Capabilities : 0x85208000
Video Memory-to-Memory
Read/Write
Streaming
Extended Pix Format
Device Capabilities
Device Caps : 0x05208000
Video Memory-to-Memory
Read/Write
Streaming
Extended Pix Format
Priority: 0
Format Video Output:
Width/Height : 416/720
Pixel Format : 'YU12'
Field : None
Bytes per Line : 416
Size Image : 449280
Colorspace : sRGB
Transfer Function : Default (maps to sRGB)
YCbCr/HSV Encoding: Default (maps to ITU-R 601)
Quantization : Default (maps to Limited Range)
Flags :
Streaming Parameters Video Capture:
Frames per second: 30.000 (30/1)
Read buffers : 2
Streaming Parameters Video Output:
Frames per second: 30.000 (30/1)
Write buffers : 2
User Controls
keep_format 0x0098f900 (bool) : default=0 value=0
sustain_framerate 0x0098f901 (bool) : default=0 value=0
timeout 0x0098f902 (int) : min=0 max=100000 step=1 default=0 value=0
timeout_image_io 0x0098f903 (bool) : default=0 value=0
Now I can feed the input from my desktop
sudo ffmpeg -f x11grab -r 25 -s 416x768 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video2
Or my stream OBS:
ffmpeg -f flv -listen 1 -i rtmp://localhost:1935/live/app -f v4l2 /dev/video2
And both work perfect; because I can view the output using WebRTC
, Chrome
, Firefox
, and ffplay
:
ffplay /dev/video2
My machine also has a webcam running on /dev/video0
which works perfect with genymotion
.
But when I choose my "Hello world", genymotion
exports noise (SMPTE color bars) as result.
Whats wrong with my Genymotion? I found that there are differences between UVC output and v4l2loopback.