Coder Social home page Coder Social logo

mon2cam's Introduction

Projects

Rust

  • Derive-Config - My simple configuration library
  • GitHub-Socialify-Preview - Upload GitHub repository Socialify preview images
  • Hex - Playing with Rainbows!
  • LatestPaper - Command line wrapper to download PaperMC
  • LatestSpigot - Command line wrapper to build Spigot
  • Launcher-Curseforge - Integrates the CF Modpack install button to any MMC based launcher
  • Lighthouse - Virtual reality basestation power management in Rust
  • RTSS-SYS - RivaTuner Statistics Server SDK Rust bindings
  • Ruiden - Ruiden RD power supply modbus wrapper
  • ShaysBot - My personal Minecraft bot for the LiveOverflow server using the Azalea library
  • Sigilo - Scan and collect Minecraft Servers using masscan and craftping
  • Spotify-Lyrics - Spotify Lyrics API Wrapper
  • USB-MC - A simple Rust program that downloads and runs the old Minecraft launcher
  • VRC-BAN - The Stoner Booth's Ban Leaderboard
  • VRC-LOG - VRChat Local Cache Avatar ID Logger
  • VRC-OSC - Dynamically loaded VRChat OSC plugins written in Rust
  • VRC-YT - Playing YouTube videos cross-platform in VRChat
  • Wooting-Profile-Switcher - Automatically switch Wooting keyboard profiles based on focused window
  • Wooting-RGB - Wooting RGB SDK Rust Bindings and Library

Python

  • AntiCaptcha - A python library for anti-captcha.com
  • Arctis - A python library for the Arctis 7 2019 headset
  • CircuitPython-DuckyScript - DuckyScript interpreter in CircuitPython (Tested on Pico)
  • OnePasswordConverter - Convert 1Password .1pux to Bitwarden .csv
  • PorthBot - Discord bot that runs Porth codeblocks inside Docker
  • Riden - A python library for Riden RD power supplies
  • RidenGUI - Qt 5/6 based GUI for Riden RDXX power supplies written in Python
  • SteamAccountSwitcher - Qt Steam account switcher for linux
  • Windscribe - A python wrapper library for Windscribe CLI
  • WindscribeGUI - Qt 5/6 based GUI for Windscribe VPN written in Python

Java

  • BoxMod - My personal Minecraft mod
  • DropChest - Sucks dropped loot into Chests. Useful for automatic farming or gathering loot from mob traps
  • Durability101 - A rewrite of the original Durability101 mod
  • ExampleMod - Forge 1.12 + FG3 + Mixins 0.8.2
  • ShaysRusherTweaks - My personal RusherHack tweaks plugin

TypeScript

  • Flarum-Grammarly - Grammarly Text Editor SDK for Flarum
  • Mon2Cam - Workaround for multi-monitor Discord screensharing
  • NMP-Proxy - Minecraft Account Switcher Proxy Hub

JavaScript

Shell

  • EasyTether - Archlinux repo for mobile-stream's easytether

C++

C#

  • VRC-SKY - VRChat Remote Image Loading Skyboxes

mon2cam's People

Contributors

bettehem avatar botiapa avatar brightcloudy avatar char avatar dmitri-mcguckin avatar itrooz avatar kattus avatar meadowsys avatar miguelndecarvalho avatar pegasisforever avatar shaybox avatar stonesword0 avatar vidarrio avatar x10an14 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mon2cam's Issues

Use dedicated GPU

I have an eGPU, that I would like to use to encode mon2cams video stream. Is that possible?
I guessed the -d flag might do it, but I havn't found out yet, what that does. Any help would be appreciated"

Hardware acceleration

Currently Mon2Cam takes plenty of CPU resources which is problematic for screen sharing games, would it be possible to use hardware acceleration on ffmpeg (possibly VAAPI) to improve this?

Exec Result: { status: { code: 1, success: false }, output: "" }

I'm trying to run it using fedora 31 (5.7.15-100.fc31.x86_64), mon2cam closes after choosing a monitor.

mon2cam -v

Exec Context: 28f432e9-b0c4-4d20-9e0f-9686c58cf387
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe -r v4l2loopback
    Exec Command Splits:  [sudo,modprobe,-r,v4l2loopback]
    Exec Result:  { status: { code: 1, success: false }, output: "" }
Exec Context: 28f432e9-b0c4-4d20-9e0f-9686c58cf387


Exec Context: e24602b6-23a0-431f-835d-585a26102665
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe v4l2loopback video_nr=50 'card_label=Mon2Cam'
    Exec Command Splits:  [sudo,modprobe,v4l2loopback,video_nr=50,'card_label=Mon2Cam']
    Exec Result:  { status: { code: 1, success: false }, output: "" }
Exec Context: e24602b6-23a0-431f-835d-585a26102665

0: 1920x1080 HDMI-1
1: 1366x768 eDP-1
Which monitor?
0
INFO CTRL + C to stop
INFO The screen will look mirrored for you, not others

Exec Context: 11bd51e1-20b1-434d-bf0c-1d407fedc38e
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: ffmpeg -f x11grab -r 60 -s 1920x1080 -i :0.0+0,0 -pix_fmt yuv420p -f v4l2 /dev/video50
    Exec Command Splits:  [ffmpeg,-f,x11grab,-r,60,-s,1920x1080,-i,:0.0+0,0,-pix_fmt,yuv420p,-f,v4l2,/dev/video50]
    Exec Result:  { status: { code: 1, success: false }, output: "" }
Exec Context: 11bd51e1-20b1-434d-bf0c-1d407fedc38e

Won't display anything if the display size is above 1080p

This won't work if you're trying to run the app with no arguments on a 1440p screen, works when you use Mon2Cam -m 0 -r 1920:1080 though !

Maybe it should automatically fallback to 1920*1080 by default if the selected screen resolution is above 1080p ?

Freeze after ~10 minutes

Hi ! I'm using manjaro with kernel 58, and when I launch mon2cam, the "screenshare" stop after roughly 10 minutes
Here is the verbose logs, but I don't think there is something important!
test.png
(The program doesn't crash)

Fix audio streaming

Currently if you stream you either can't hear the application(s) you're streaming, or if you use ffplay, then you can hear yourself.

This is obviously not ideal and kind of defeats the purpose. I'm not sure if this issue is solvable.

@ShayBox Any ideas maybe for a fix for this?

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!

After updating sudo, mon2cam no longer works.

It's me (again). After I updated sudo I restarted my pc and now when I try to type mon2cam in the terminal it requests for the password, after I type it says "sorry, try again." I've tried 5 times and I am 100% sure that is my password. That's how I login in the first place. Is it an issue with sudo or do I need to do something different? Any help would be appreciated. Thanks!

`DEBUG Starting Mon2Cam with the following options: Options {
framerate: 60,
device: 50,
resolution: "",
ffmpeg: [],
border: false,
sound: false,
wayland: false,
loggerOptions: { verbose: true },
execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: 71ac9c42-952e-4334-982d-044481b3e611
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe -r v4l2loopback
Exec Command Splits: [sudo,modprobe,-r,v4l2loopback]
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
Exec Result: { code: 1, success: false },
output: "sudo: 3 incorrect password attempts"
Exec Context: 71ac9c42-952e-4334-982d-044481b3e611

Exec Context: e5cad991-9fe3-48cf-b135-0dff2fbd0f48
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe v4l2loopback video_nr=50 card_label="Mon2Cam"
Exec Command Splits: [sudo,modprobe,v4l2loopback,video_nr=50,card_label="Mon2Cam"]
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
Sorry, try again.
[sudo] password for user:
Exec Result: { code: 1, success: false },
output: "sudo: 3 incorrect password attempts"
Exec Context: e5cad991-9fe3-48cf-b135-0dff2fbd0f48

DEBUG Exiting
DEBUG V4L2 device created with id 50
PANIC Failed to create V4L2 device with id 50
[user@UserDesktopLinux ~]$`

Clean up output

The output of the program is getting quite big, and it's not very well organized either. What do you think about adding basic coloring for the program, so it's more easily readable? If you think it's not a problem, then this is closable.

Can't run mon2cam

when i run mon2cam command, i get this error

error: Uncaught ReferenceError: __boolean is not defined
    if (__boolean !== undefined) {
    ^
    at parse (file:///usr/bin/mon2cam:489:5)
    at new Options (file:///usr/bin/mon2cam:718:19)
    at file:///usr/bin/mon2cam:1001:18

No Error message if Error Code

Hey,
Using Fedora 32 here.

command -v <command> gives a non zero return code if the command couldn´t be found.
You set with set -o errexit to exit the script on non zero return codes, why?

In my case I hadn't installed ffmpeg and the script exited without any error message.
I would recommend to remove the set -o errexit policy.

Screenshot_20200521_200542

kind regards.

Error when running

Running on: Arch Linux [KDE Plasma Desktop Enviroment]
after facing the issue i installed the linux headers but with no luck

  framerate: 60,
  device: 50,
  resolution: "",
  ffmpeg: [],
  border: false,
  sound: false,
  wayland: false,
  loggerOptions: { verbose: true },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: b80876d1-dbae-49ac-93ac-e00857ea7fa4
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe -r v4l2loopback
    Exec Command Splits:  [sudo,modprobe,-r,v4l2loopback]
    Exec Result:  { code: 1, success: false },
 output: "modprobe: FATAL: Module v4l2loopback is in use."
Exec Context: b80876d1-dbae-49ac-93ac-e00857ea7fa4


Exec Context: e0fecbda-d8aa-4e46-b859-2a433734a21b
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe v4l2loopback video_nr=50 card_label="Mon2Cam"
    Exec Command Splits:  [sudo,modprobe,v4l2loopback,video_nr=50,card_label="Mon2Cam"]
    Exec Result:  { code: 0, success: true },
 output: ""
Exec Context: e0fecbda-d8aa-4e46-b859-2a433734a21b

DEBUG Exiting
DEBUG V4L2 device created with id 50
PANIC Failed to create V4L2 device with id 50```

Doesn't work on resolutions higher than 1920x1080

As previously posted on the other repo, the tool will not work with a resolution over 1920x1080 (I presume), on 2560x1440 all I get is a black screen or sometimes a severely garbled static image.

I'm not sure if this is a bug in v4l2loopback or somewhere else, but I don't know how to test that.

error in options -hf, --hflip, Horizontally flip the camera

when I use the command "mon2cam -f 30 -d 8 -m 1 -r 640x480 -v" and I use "ffplay /dep/video8" for show output in new window, I see virtual monitor correctly in that screen. But when I open discord and validate the virtual camera, this monitor show bad horizontally.

then I do try use "mon2cam -f 30 -d 8 -m 1 -r 640x480 -hf -v" but this command showme the help menu, when I validate the file "https://github.com/ShayBox/Mon2Cam/blob/master/src/libraries/options.ts" I can see two lines with the almost same information, that code is correctly ?

if (typeof p.vflip === "boolean") this.ffmpeg.push("-vf vflip");
if (typeof p.hflip === "boolean") this.ffmpeg.push("-vf hflip");

Same issue here aswell

Thanks for providing this repo. Unfortunately this code still doesn't work on my 2560*1080(Ultra widescreen) nor on my 1680*1050 display. But it does work on my 1920*1080 monitor. What could be cause of this? Is it because it's a standard in cameras, so discord only supports this resolution?

error in run mon2cam

Hi, I installed it according to the instructions, but when I write the word mon2cam, it gives an error

error: Uncaught PermissionDenied: Permission denied (os error 13)
at unwrapResponse (rt/10_dispatch_json.js:24:13)
at sendSync (rt/10_dispatch_json.js:51:12)
at opRun (rt/40_process.js:20:12)
at Object.run (rt/40_process.js:101:17)
at exec (exec.ts:59:15)
at mod.ts:15:9
at async mod.ts:13:1

i use xubuntu or ubunut v 20

PANIC ERROR HELP PLEASE

(base) root@zemeister:/Downloads# mon2cam
INFO X11 detected, running x11 backend. (use -w to force wayland)
0: 1920x1080 eDP-1
1: 1920x1080 HDMI-2
Which monitor?
0
INFO CTRL + C to stop
INFO The screen will look mirrored for you, not others
PANIC X11 backend exited with an error.
(base) root@zemeister:
/Downloads# mon2cam -w
INFO Wayland detected, running wayland backend.
INFO CTRL + C to stop
INFO The screen will look mirrored for you, not others
PANIC wf-recorder not installed
(base) root@zemeister:~/Downloads#

need bin/bash alias

hello, i can't install the software because when i try it says: "Installing alias for /bin/bash"
what i have to do?
(i'm new to linux)

black screen in discord - using the virtual monitor

when I use the command "mon2cam" and select one of the monitors and I use "ffplay /dep/video50" for show output in new window, I see virtual monitor correctly in that screen. But when I open discord and validate the virtual camera, this monitor show black screen, I find a posted in github where speak the problem, I solved change the output resolution with this command "mon2cam -f 30 -d 8 -m 1 -r 640x480 -v"

the post: umlaeute/v4l2loopback#274 (comment)

You must validate a resolution aprox to your monitor because Discord dont accept all resolutions, anybody know other forms I can resolve this issuee?

Permissions Error

Hello, my name is aeron i have tried to use you're application but when installing i seem to find a error, i am on a administrator ubuntu (20.04), and i have all the latest dependencies which were needed, but when i run mon2cam i get a permissions error (error: Uncaught PermissionDenied: Permission denied (os error 13)), Any reason why?

Sound feature confusing to use

Hi, I just found out about this project, kudos for finding a way around proper streaming to Discord!

I realized there's a feature to reroute sound from apps to a sink, which is literally everything I've ever needed xD However, I don't know how to use it (the part of selection windows to reroute sound), and I feel like the script could have some sort of instruction on how to supply those window names.

Thanks for your effort!

PANIC Failed to create V4L2 device with id 50

I installed it through the aur. It stays that way with or without sudo. When I tried to find a solution I couldn't find a clear solution.

$ mon2cam -v=log
DEBUG Starting Mon2Cam with the following options: Options {
framerate: 60,
device: 50,
resolution: "",
ffmpeg: [],
border: false,
sound: false,
wayland: false,
loggerOptions: { verbose: true, file: "log" },
execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: b314c833-3beb-4ab9-8962-8901c522fa7f
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe -r v4l2loopback
Exec Command Splits: [sudo,modprobe,-r,v4l2loopback]
Exec Result: { code: 1, success: false },
output: "modprobe: FATAL: Module v4l2loopback not found."
Exec Context: b314c833-3beb-4ab9-8962-8901c522fa7f

Exec Context: 536892c0-930f-4a7e-8964-3ec540c92594
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe v4l2loopback video_nr=50 'card_label=Mon2Cam'
Exec Command Splits: [sudo,modprobe,v4l2loopback,video_nr=50,'card_label=Mon2Cam']
Exec Result: { code: 1, success: false },
output: "modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.8.13-arch1-1"
Exec Context: 536892c0-930f-4a7e-8964-3ec540c92594

DEBUG Exiting
DEBUG V4L2 device created with id 50
PANIC Failed to create V4L2 device with id 50

Failed to create V4L2 device

Error when normally running: PANIC Failed to create V4L2 device with id 50
Log here:

[flexxxer@laptop ~]$ sudo mon2cam -v=log
DEBUG Starting Mon2Cam with the following options: Options {
framerate: 60,
device: 50,
resolution: "",
ffmpeg: [],
border: false,
sound: false,
wayland: false,
loggerOptions: { verbose: true, file: "log" },
execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: a8a10940-6dd0-4fa6-902c-d131df93ddd8
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe -r v4l2loopback
Exec Command Splits: [sudo,modprobe,-r,v4l2loopback]
Exec Result: { code: 1, success: false },
output: "modprobe: FATAL: Module v4l2loopback not found."
Exec Context: a8a10940-6dd0-4fa6-902c-d131df93ddd8

Exec Context: d74b5386-42c7-4ff8-96ba-7f9f84a49936
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe v4l2loopback video_nr=50 card_label="Mon2Cam"
Exec Command Splits: [sudo,modprobe,v4l2loopback,video_nr=50,card_label="Mon2Cam"]
Exec Result: { code: 1, success: false },
output: "modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.11.1-1-MANJARO"
Exec Context: d74b5386-42c7-4ff8-96ba-7f9f84a49936

DEBUG Exiting
DEBUG V4L2 device created with id 50
PANIC Failed to create V4L2 device with id 50

Linux headers was installed, kernel version 5.11.1. Distro is Manjaro

error in run mon2cam after install

Hi, I installed it according to the instructions, but when I run mon2cam, it gives the error bellow.

error: TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { LoggerOptions } from "./logging.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/libraries/options.ts:1:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Logger } from "./logging.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/libraries/utility.ts:2:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/audio.ts:3:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Logger } from "../libraries/logging.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/wayland.ts:1:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/wayland.ts:2:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/x11.ts:4:1

Deno Version:
deno 1.4.0
v8 8.7.75
typescript 4.0.2

Distro: PopOS 20.04 (Kernel 5.4.0-7642-generic)

Adding error logging to exec

We need to pipe the stderr as well when running commands. A possible solution would be to move reading from stdin and stderr into async functions, run them both, and then wait for both to exit (With promises?).

Refactor

Looking for some tips on the syntax of the script to improve it, I know it's terrible, I would also accept a PR.

Adding optional dependencies

If the wayland PR gets merged, then I think it would be a good idea to add xisxwayland, wayland, wlr-randr and wf-recorder as an optional dependency in the AUR package.

Uncaught Error: Xrandr output has changed and this code needs updated

Unable to run mon2cam, I get this error on Ubuntu 20.04.1 LTS:

➜  ~ mon2cam -v=log
Exec Context: 45535de0-9b4c-4d5f-b346-df935def5186
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe -r v4l2loopback
    Exec Command Splits:  [sudo,modprobe,-r,v4l2loopback]
    Exec Result:  { status: { code: 1, success: false }, output: "" }
Exec Context: 45535de0-9b4c-4d5f-b346-df935def5186


Exec Context: 987b2bdd-c5df-4970-9909-d2a009026178
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe v4l2loopback video_nr=50 'card_label=Mon2Cam'
    Exec Command Splits:  [sudo,modprobe,v4l2loopback,video_nr=50,'card_label=Mon2Cam']
    Exec Result:  { status: { code: 1, success: false }, output: "" }
Exec Context: 987b2bdd-c5df-4970-9909-d2a009026178

error: Uncaught Error: Xrandr output has changed and this code needs updated
		throw new Error("Xrandr output has changed and this code needs updated");
		      ^
    at getMonitorInfo (x11.ts:18:9)
    at x11.ts:39:40
    at Array.map (<anonymous>)
    at default (x11.ts:39:26)

Seems like an issue with xrandr, so here is my xrandr version:

➜  ~ xrandr --version
xrandr program version       1.5.0
Server reports RandR version 1.6
➜  ~ sudo apt show libxrandr-dev   
Package: libxrandr-dev
Version: 2:1.5.2-0ubuntu1
Priority: optional
Section: libdevel
Source: libxrandr
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian X Strike Force <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 134 kB
Depends: libxrandr2 (= 2:1.5.2-0ubuntu1), libx11-dev, libxext-dev, x11proto-randr-dev (>= 1.4), libxrender-dev
Download-Size: 25.0 kB
APT-Manual-Installed: yes
APT-Sources: http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages
➜  ~ sudo apt show libxrandr2   
Package: libxrandr2
Version: 2:1.5.2-0ubuntu1
Priority: optional
Section: libs
Source: libxrandr
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian X Strike Force <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 70.7 kB
Depends: libc6 (>= 2.14), libx11-6 (>= 2:1.6.0), libxext6, libxrender1
Task: ubuntu-desktop-minimal, ubuntu-desktop, kubuntu-desktop, xubuntu-core, xubuntu-desktop, lubuntu-desktop, ubuntustudio-desktop-core, ubuntustudio-desktop, ubuntukylin-desktop, ubuntu-mate-core, ubuntu-mate-desktop, ubuntu-budgie-desktop
Download-Size: 18.5 kB
APT-Manual-Installed: no
APT-Sources: http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

TypeScript Errors

mon2cam -v=log
error: TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { LoggerOptions } from "./logging.ts";

    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/libraries/options.ts:1:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Logger } from "./logging.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/libraries/utility.ts:2:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/audio.ts:3:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import { Logger } from "../libraries/logging.ts";

    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/wayland.ts:1:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/wayland.ts:2:1

TS1371 [ERROR]: This import is never used as a value and must use 'import type' because the 'importsNotUsedAsValues' is set to 'error'.
import Options from "../libraries/options.ts";
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    at https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/backends/x11.ts:4:1

Found 6 errors.

Am I doing anything wrong? I'm just getting TS errors when trying to run mon2cam for the first time after installation.

Mon2Cam error: "PANIC Failed to create V4L2 device with id 50"

When I try to type mon2cam in the terminal it prompts for a password which I type and after that it throws the error "Failed to create V4L2 device with id 50." I've installed all the required dependencies on the repository and have restarted the computer after installing everything. I am using Manjaro Cinnamon with GNOME Terminal 3.38.1.

I am new to Linux so I probably did something wrong that no average user can miss. or it just doesn't support Manjaro or cinnamon.

EDIT: heres the log:

DEBUG Starting Mon2Cam with the following options: Options {
  framerate: 60,
  device: 50,
  resolution: "",
  ffmpeg: [],
  border: false,
  sound: false,
  wayland: false,
  loggerOptions: { verbose: true },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: b622a91c-efd3-40b6-bcce-bca7bf09f91c
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe -r v4l2loopback
    Exec Command Splits:  [sudo,modprobe,-r,v4l2loopback]
[sudo] password for cole: 
    Exec Result:  { code: 1, success: false },
 output: "modprobe: FATAL: Module v4l2loopback not found."
Exec Context: b622a91c-efd3-40b6-bcce-bca7bf09f91c


Exec Context: f6d2aa00-1769-442d-9901-df6652705f40
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe v4l2loopback video_nr=50 card_label="Mon2Cam"
    Exec Command Splits:  [sudo,modprobe,v4l2loopback,video_nr=50,card_label="Mon2Cam"]
    Exec Result:  { code: 1, success: false },
 output: "modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.10.2-2-MANJARO"
Exec Context: f6d2aa00-1769-442d-9901-df6652705f40

DEBUG Exiting
DEBUG V4L2 device created with id 50
PANIC Failed to create V4L2 device with id 50

NaN index of audio source

For some reason, the index of any audio sources I have is shown as NaN, making it so I can't select it.

My system:

~/programy/Mon2Cam/src $ inxi -Fx
System:
  Host: pecet Kernel: 5.8.0-8.1-liquorix-amd64 x86_64 bits: 64 
  compiler: N/A Desktop: KDE Plasma 5.19.5 
  Distro: Debian GNU/Linux bullseye/sid 
Machine:
  Type: Desktop System: Dell product: OptiPlex 790 v: 01 
  serial: <superuser/root required> 
  Mobo: Dell model: 0J3C2F v: A00 serial: <superuser/root required> 
  BIOS: Dell v: A07 date: 09/10/2011 
CPU:
  Info: Quad Core model: Intel Core i5-2400 bits: 64 type: MCP 
  arch: Sandy Bridge rev: 7 L2 cache: 6144 KiB 
  flags: avx lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 24742 
  Speed: 2456 MHz min/max: 1600/3101 MHz Core speeds (MHz): 1: 2826 2: 2285 
  3: 2588 4: 3239 
Graphics:
  Device-1: NVIDIA GK106 [GeForce GTX 660] vendor: Micro-Star MSI 
  driver: nvidia v: 450.66 bus ID: 03:00.0 
  Display: x11 server: X.Org 1.20.8 driver: nvidia resolution: 1280x1024 
  OpenGL: renderer: GeForce GTX 660/PCIe/SSE2 v: 4.6.0 NVIDIA 450.66 
  direct render: Yes 
Audio:
  Device-1: Intel 6 Series/C200 Series Family High Definition Audio 
  vendor: Dell driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
  Device-2: NVIDIA GK106 HDMI Audio vendor: Micro-Star MSI 
  driver: snd_hda_intel v: kernel bus ID: 03:00.1 
  Device-3: Logitech Webcam C270 type: USB driver: snd-usb-audio,uvcvideo 
  bus ID: 2-1.2:4 
  Sound Server: ALSA v: k5.8.0-8.1-liquorix-amd64 
Network:
  Device-1: Intel 82579LM Gigabit Network vendor: Dell driver: e1000e 
  v: 3.2.6-k port: 4040 bus ID: 00:19.0 
  IF: eno1 state: up speed: 100 Mbps duplex: full mac: 18:03:73:b0:66:be 
Drives:
  Local Storage: total: 1.02 TiB used: 725.01 GiB (69.5%) 
  ID-1: /dev/sda vendor: Seagate model: ST1000DM003-1SB10C size: 931.51 GiB 
  ID-2: /dev/sdb vendor: GOODRAM model: N/A size: 111.79 GiB 
Partition:
  ID-1: / size: 58.81 GiB used: 37.80 GiB (64.3%) fs: ext4 dev: /dev/sdb3 
  ID-2: /home size: 901.04 GiB used: 687.21 GiB (76.3%) fs: ext4 
  dev: /dev/sda1 
Swap:
  ID-1: swap-1 type: partition size: 15.09 GiB used: 0 KiB (0.0%) 
  dev: /dev/sda5 
Sensors:
  System Temperatures: cpu: 47.0 C mobo: N/A gpu: nvidia temp: 47 C 
  Fan Speeds (RPM): N/A gpu: nvidia fan: 33% 
Info:
  Processes: 248 Uptime: 1h 01m Memory: 7.73 GiB used: 2.32 GiB (29.9%) 
  Init: systemd runlevel: 5 Compilers: gcc: 10.2.0 clang: 9.0.1-14 
  Packages: 4164 Shell: Zsh v: 5.8 inxi: 3.1.06 
~/programy/Mon2Cam/src $ 

Log (trying VLC here):

~/programy/Mon2Cam/src $ ~/programy/deno run -A -r -q --unstable --no-check mod.ts -r 1920:1080 -b -s
NaN: VLC media player (LibVLC 3.0.11.1)
Choose which applications you want to route(space separated list):

ParsedOutputElement { index: -1, arguments: {}, properties: {} }
ParsedOutputElement {
  index: NaN,
  arguments: {
    Stan: "SUSPENDED",
    Nazwa: "VirtualSinkMIC.7.monitor",
    Opis: "Monitor of Mon2CamMicrophoneSink",
    Sterownik: "module-null-sink.c",
    "Okre��lenie pr��bki": "s16le 2 k 44100���Hz",
    "Mapa kana����w": "front-left,front-right",
    "W��a��ciciel modu��u": "34",
    Wyciszenie: "nie",
    "Poziom g��o��no��ci": "front-left",
    "G��o��no���� podstawowa": "65536 / 100% / 0,00 dB",
    "Monitor odp��ywu": "VirtualSinkMIC.7",
    "Op����nienie": "0���us, skonfigurowano 0���us"
  },
  properties: {
    "device.description": '"Monitor of Mon2CamMicrophoneSink"',
    "device.class": '"monitor"',
    "device.icon_name": '"audio-input-microphone"'
  }
}
INFO No valid sources found
WARN No applications, nor any sources passed. Why are you using the sound flag?
~/programy/Mon2Cam/src $ 

mon2cam not working properly

Just got it of aur and it doesn't work fully as soon as I run it, it just exists. what should I do. I didn't press CTRL + C
image

cant run the software after install

DEBUG Starting Mon2Cam with the following options: Options {
framerate: 60,
device: 50,
resolution: "",
ffmpeg: [],
border: false,
sound: false,
wayland: false,
loggerOptions: { verbose: true, file: "log" },
execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: 2a93d96b-bb11-4a23-8ffc-9e34aa88fea4
Exec Options: { verbose: true, output: 3 }
Exec Command: sudo modprobe -r v4l2loopback
Exec Command Splits: [sudo,modprobe,-r,v4l2loopback]
error: Uncaught PermissionDenied: Permission denied (os error 13)
at processResponse (core.js:226:13)
at Object.jsonOpSync (core.js:250:12)
at opRun (deno:cli/rt/40_process.js:19:17)
at Object.run (deno:cli/rt/40_process.js:103:17)
at exec (exec.ts:60:15)
at mod.ts:22:20
at async mod.ts:15:1

After installing, error when running

Just as the title says, when I run the program just pop an error, I have already installed all the dependencies, restarted my machine and just to say, I install the program from AUR using yay so, don't know why the issue.

The error is:
PANIC Failed to create V4L2 device with id 50

"Turn off any sources using Mon2Cam before starting script"

I haven't had the opportunity to use Mon2Cam since my last open issue, but now that I tried, after selecting my monitor, it comes up with this error, then dumps out to command prompt:

"Turn off any sources using Mon2Cam before starting script"

afaik I don't have any sources using Mon2Cam running. In fact, just to confirm, I restarted my system, and it's still happening. How can I check to see if anything is running that might be conflicting? Dependencies, etc?

Discord share window stock in "loading"

Hey.

The problem is that when I have it running it does not seem to work. Discord just keeps stays in loading state. I am able to select webcam "mon2cam". So that seem to work, I have no errors as shown below. Running Ubuntu 20.04.


❯ mon2cam -v
DEBUG Starting Mon2Cam with the following options: Options {
  framerate: 60,
  device: 50,
  resolution: "",
  ffmpeg: [],
  border: false,
  sound: false,
  wayland: false,
  loggerOptions: { verbose: true },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: 2b2d724a-4bb0-473c-94bb-017d6c1edd1a
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe -r v4l2loopback
    Exec Command Splits:  [sudo,modprobe,-r,v4l2loopback]
[sudo] password for datstorm: 
    Exec Result:  { code: 0, success: true },
 output: ""
Exec Context: 2b2d724a-4bb0-473c-94bb-017d6c1edd1a


Exec Context: 3b53e52a-6951-41ca-9364-c65d0faf5de6
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: sudo modprobe v4l2loopback video_nr=50 card_label="Mon2Cam"
    Exec Command Splits:  [sudo,modprobe,v4l2loopback,video_nr=50,card_label="Mon2Cam"]
    Exec Result:  { code: 0, success: true },
 output: ""
Exec Context: 3b53e52a-6951-41ca-9364-c65d0faf5de6

DEBUG V4L2 device created with id 50
INFO X11 detected, to use Wayland add -w
0: 2560x1080 DP-0
1: 2560x1080 DVI-D-0
2: 2560x1080 HDMI-0
3: 2560x1080 HDMI-2
4: 2560x1080 HDMI-1-1
Which monitor?
0
WARN The selected resolution (2560:1080) may not be supported by discord. Please use the -r flag to change the resolution, if needed.
INFO CTRL + C to stop
INFO The screen will look mirrored for you, not others

Exec Context: 2faf405e-2aec-46f2-aa54-fd982333407c
    Exec Options:  { verbose: true, output: 3 }
    Exec Command: ffmpeg -f x11grab -r 60 -s 2560x1080 -i :0+2560,532 -pix_fmt yuv420p -f v4l2 /dev/video50
    Exec Command Splits:  [ffmpeg,-f,x11grab,-r,60,-s,2560x1080,-i,:0+2560,532,-pix_fmt,yuv420p,-f,v4l2,/dev/video50]
DEBUG Exiting


bug

^ just stays in this state.

ffmpeg errors are ignored and not shown

Using gentoo, I didn't have v4l use flag enabled on ffmpeg so it was erroring with this:

[x11grab @ 0x562173462bc0] Cannot open display VGA1+0,0, error 5.
VGA1+0,0: Input/output error

but Mon2Cam didn't show any error

Documentation notes for Wayland

Just two documentation suggestions to help a few people before reporting an issue.

  1. What: mon2cam doesn't work on 1440p monitors with native res and has to be downscaled to 1080p or lower.
    Why: This is an issue with having v4l2loopback/yuv420p and isn't really noticable when non-discord nitro limits you to streaming 720p anyway. It would probably help people out to know that they have to downscale resolution through mon2cam to make it work on a monitor with higher res than 1080p.

  2. What: mon2cam wayland backend should specify that the --resolution downscaling flag doesn't work.
    Why: A limit in the wf-recorder is there is not currently resolution scaling see ammen99/wf-recorder#77. I'm sure you all knew this as the wayland backend has no flags to specify res, but because of point 1 I think it is important to let people know clearly that the flag doesn't work on wayland.

I do appreciate mon2cam though! Thanks for all the hard work you all do!

Audio streaming cleanup

When the script is done, the create virtual sink, and loopback device should be unloaded.

Not Working On Gnome

Is there a way to fix this not working on Gnome given that wlr-screencopy-unstable-v1 is not supported on Gnome but used in the program.

Wayland wr-recorder additional recording file

The wayland backend works, but currently creates a recording.mp4 in the working directory as well as outputs to /dev/videoX. I tried searching through the help page of it, but couldn't find a way to disable this.

Sorry for bothering you, but @brightcloudy, could lend a hand here please?

Discord linux client alternatives

As not many of you may know, Discord has officially dropped support for Linux, they're still producing a Linux client (for now), but they have slowly been killing off things related to Linux for years, including:

  • The Discord Linux server, which used to be an official Discord server for reporting bugs, and the Discord Linux client
  • Discord Linux GitHub issue tracker
  • Discord Linux Trello bugs board
    (Let me know if there's anything I'm missing)

So I'm making this as a discussion for alternative platforms, clients, and wrappers for Discord, as a general discussion board.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.