1

I'm running v4l2loopback on a Ubuntu 18.04 machine v4l2-ctl and virtualbox installed.

Genymotion camera rainbow noise SMPTE color bars

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.

Tayyebi
  • 131
  • 2
  • 15
  • There are some guess here: 1- Genymotion looks for camera metadata which my configuration does not provide them. 2- v4l2 output format is not the best choice. 3- Genymotion does some type of handshake with the UVC cameras to turn them on. – Tayyebi Apr 25 '20 at 13:08
  • As an update I have to say, I just installed AnBox to check if it's possible to attach loopback camera, I figured out that AnBox does not support camera! Also its based on a x86 arch. – Tayyebi Apr 25 '20 at 19:25

1 Answers1

1

Can you provide the logs of the Genymotion Emulator, located here ~/.Genymobile/Genymotion/deployed/<yourdevice>/genymotion-player.log, there might be interesting insights in there.

hasboeuf
  • 26
  • 2
  • ○ [debug] "Hello world (/dev/video5)" acquired by CameraView(0x1682350) count: 1 ○ [warning] "Camera Hello world (/dev/video5) status: 2" ○ [warning] "Camera Hello world (/dev/video5) status: 4" ○ [warning] Unable to query the parameter info: "Invalid argument" ○ [warning] "Camera Hello world (/dev/video5) status: 6" ○ [warning] CameraBin error: "Internal data stream error." – Tayyebi Apr 30 '20 at 06:35