Mon2Cam: v4l2loopback issue on Ubuntu Desktop 18.04 LTS (ioctl(VIDIOC_G_FMT): Invalid argument)

On this thread for discord-monitors-to-vc, an issue came up and I was advised to open up a thread here on the fork.

Summary: What started as a “I can’t get discord-monitors-to-vc to install” issue morphed into a “I can’t get Mon2Cam to work” issue, and it apparently has something to do with ffmepg. Here is the output when running in debug mode:

Monitors: 2
 0: +*DVI-I-2 1920/518x1200/324+1920+0  DVI-I-2
 1: +DVI-I-3 1920/518x1200/324+0+0  DVI-I-3
Which monitor: 0
CTRL + C to stop
Your screen will look mirrored for you, not others
ffmpeg version 3.4.6-0ubuntu0.18.04.1 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 7 (Ubuntu 7.3.0-16ubuntu3)
  configuration: --prefix=/usr --extra-version=0ubuntu0.18.04.1 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --enable-gpl --disable-stripping --enable-avresample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librubberband --enable-librsvg --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libopencv --enable-libx264 --enable-shared
  libavutil      55. 78.100 / 55. 78.100
  libavcodec     57.107.100 / 57.107.100
  libavformat    57. 83.100 / 57. 83.100
  libavdevice    57. 10.100 / 57. 10.100
  libavfilter     6.107.100 /  6.107.100
  libavresample   3.  7.  0 /  3.  7.  0
  libswscale      4.  8.100 /  4.  8.100
  libswresample   2.  9.100 /  2.  9.100
  libpostproc    54.  7.100 / 54.  7.100
[x11grab @ 0x55df90f3a780] Stream #0: not enough frames to estimate rate; consider increasing probesize
Input #0, x11grab, from ':1+1920,0':
  Duration: N/A, start: 1571330840.250214, bitrate: N/A
    Stream #0:0: Video: rawvideo (BGR[0] / 0x524742), bgr0, 1920x1200, 60 fps, 1000k tbr, 1000k tbn, 1000k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> rawvideo (native))
Press [q] to stop, [?] for help
[v4l2 @ 0x55df90f44500] ioctl(VIDIOC_G_FMT): Invalid argument
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:0 -- 
Conversion failed!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 24 (12 by maintainers)

Most upvoted comments

Oh yeah I totally forgot that I had to compile v4l2l myself aswell. I’m glad you finally got it working 😃

-b is just border, there’s no value for it, but it’s only needed for non 16:9 screens, glad you got it working

This doesn’t fix discord screen sharing, it loops your monitor into a camera, mon2cam, click the webcam button in discord

Okay wow you replied as I was typing my message lol