ShayBox / Mon2Cam

Workaround for multi-monitor Discord screensharing
MIT License
338 stars 33 forks source link

error in run mon2cam #34

Closed mbfakourii closed 3 years ago

mbfakourii commented 4 years ago

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

ShayBox commented 4 years ago

You don't have permission to use sudo

mbfakourii commented 4 years ago

i not use sudo for run mon2cam i just enter mon2cam in terminal

ShayBox commented 4 years ago

mon2cam uses sudo, you need access to sudo

mbfakourii commented 4 years ago

sudo: mon2cam: command not found

ShayBox commented 4 years ago

no, mon2cam uses sudo, you need permission to use sudo, you need to be in the sudoers file or a group in the sudoers file

mbfakourii commented 4 years ago

I din't notice You can help me with the code?

mbfakourii commented 4 years ago

@ShayBox For my friend, this error seems to be a problem, please fix it

ShayBox commented 4 years ago

I cant fix it, you have to use an account with sudo permission

mbfakourii commented 4 years ago

I cant fix it, you have to use an account with sudo permission

i use account with sudo but has error

botiapa commented 4 years ago

Do you have sudo even installed?

Can you run sudo echo "test" for example?

mbfakourii commented 4 years ago

Do you have sudo even installed?

Can you run sudo echo "test" for example?

Yes it works

kokosensei commented 4 years ago

Same issue for me as well... I am in the sudo group for sure.. got the exact same error. Running on Ubuntu 20.04

g00zy commented 4 years ago

I'm having the same problem. I do have sudo installed, I even have used it to install other programs through terminal. I can also use the sudo echo "test" command but for me mon2cam doesn't work with sudo. Without it I get the same Permission denied 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:14:9 at async mod.ts:12:1

and using sudo it only returns:

sudo: mon2cam: command not found

Even trying in root mode it returns the same message. I've searched a little bit about this and I'm sure my sudo PATH is the same as my $PATH. The command works without sudo and gives permission denied but doesn't work at all with sudo...

I'm running on Ubuntu 20.04, I have Deno, xrandr, ffmpeg and v4l2loopback installed. I'm really new to Linux so I don't know too much what I'm doing, I'm sorry.

botiapa commented 4 years ago

@g00zy Well that's weird. Try to run this command: sudo deno run --unstable -A -r -q https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/mod.ts

Also could you post your bashrc or zshrc file(whichever you are using)? It's located in your home directory for example ~/.bashrc. Be sure NOT to post personal details though. (I don't think there is any in there, but just to be sure.)

ShayBox commented 4 years ago

Interesting, Seems sudo doesn't have access to modprobe or something

vicentenoriega commented 4 years ago

sudo deno run --unstable -A -r -q https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/mod.ts

Same: error: Uncaught PermissionDenied: Permission denied (os error 13)

cat ~/.bashrc


# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples

# If not running interactively, don't do anything
case $- in
    *i*) ;;
      *) return;;
esac

# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth

# append to the history file, don't overwrite it
shopt -s histappend

# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000

# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize

# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar

# make less more friendly for non-text input files, see lesspipe(1)
[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"

# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
    debian_chroot=$(cat /etc/debian_chroot)
fi

# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
    xterm-color|*-256color) color_prompt=yes;;
esac

# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes

if [ -n "$force_color_prompt" ]; then
    if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
    # We have color support; assume it's compliant with Ecma-48
    # (ISO/IEC-6429). (Lack of such support is extremely rare, and such
    # a case would tend to support setf rather than setaf.)
    color_prompt=yes
    else
    color_prompt=
    fi
fi

if [ "$color_prompt" = yes ]; then
    PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
    PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
unset color_prompt force_color_prompt

# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
    PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
    ;;
*)
    ;;
esac

# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
    test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
    alias ls='ls --color=auto'
    #alias dir='dir --color=auto'
    #alias vdir='vdir --color=auto'

    alias grep='grep --color=auto'
    alias fgrep='fgrep --color=auto'
    alias egrep='egrep --color=auto'
fi

# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'

# some more ls aliases
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'

# Add an "alert" alias for long running commands.  Use like so:
#   sleep 10; alert
alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo error)" "$(history|tail -n1|sed -e '\''s/^\s*[0-9]\+\s*//;s/[;&|]\s*alert$//'\'')"'

# Alias definitions.
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.

if [ -f ~/.bash_aliases ]; then
    . ~/.bash_aliases
fi

# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion
alias mon2cam="deno run --unstable -A -r -q https://raw.githubusercontent.com/ShayBox/Mon2Cam/master/src/mod.ts"```
botiapa commented 4 years ago

@vicentenoriega Could you run mon2cam with the latest commit (a3d51ff) and with the -v flag and post the log?

For example: mon2cam -v mon2cam.log will log to "mon2cam.log" and you can post that here.

vicentenoriega commented 4 years ago

mon2cam -v mon2cam.log

mon2cam -v mon2cam.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: "mon2cam.log" },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device not found with id 50, creating it

Exec Context: 04868b85-c9db-4f19-9f7f-228eee300446
    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 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:60:15)
    at mod.ts:22:20
    at async mod.ts:15:1
botiapa commented 4 years ago

@vicentenoriega What happens if you try to create the V4L2 loopback deivce manually?

sudo modprobe -r 4l2loopback sudo modprobe v4l2loopback video_nr=50

vicentenoriega commented 4 years ago

sudo modprobe -r 4l2loopback modprobe: FATAL: Module 4l2loopback not found. sudo modprobe v4l2loopback video_nr=50 modprobe: FATAL: Module v4l2loopback not found in directory /lib/modules/5.4.0-47-generic

botiapa commented 4 years ago

You don't have v4l2loopback installed. Look up your distribution's documentation on installing it.

aaron2198 commented 4 years ago

@vicentenoriega What happens if you try to create the V4L2 loopback deivce manually?

sudo modprobe -r 4l2loopback sudo modprobe v4l2loopback video_nr=50

I believe the commands should be: sudo modprobe -r v4l2loopback sudo modprobe v4l2loopback video_nr=50

If this is the case, that seems to work successfully for me and I don't see output to the terminal. When I run mon2cam -v mon2cam.log I have the same error as above though.

From here I ran sudo mon2cam -v mon2cam.log and it stated xrander was not installed. So sudo apt install x11-xserver-utils will solve that. Unfortunately, my issue still exists and I can run xrander manually. Log output remained as follows

EBUG Starting Mon2Cam with the following options: Options {
  framerate: 60,
  device: 50,
  resolution: "",
  ffmpeg: [],
  border: false,
  sound: false,
  wayland: false,
  loggerOptions: { verbose: true, file: "mon2cam.log" },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device found with id 50
INFO X11 detected, running x11 backend. (use -w to force wayland)
DEBUG Exiting
PANIC xrandr not installed
Penthious commented 3 years ago

@aaron2198 any traction on this as I get the exact same issue

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 found with id 50
INFO X11 detected, running x11 backend. (use -w to force wayland)
DEBUG Exiting
PANIC xrandr not installed

But I do have xrandr installed

~$ xrandr -v
     xrandr program version       1.5.0
     Server reports RandR version 1.6
ShayBox commented 3 years ago

try where xrandr or which xrandr, it might not be in the global path but a shell local path

Penthious commented 3 years ago
$ which xrandr
     /usr/bin/xrandr
aaron2198 commented 3 years ago

@Penthious I did not get anywhere because I took the advice of @ShayBox and used the browser version of discord launched as an app. This worked well other than system notifications, it uses the browser screen capture features and totally avoids working around discords implementation. Here is the example provided.

ShayBox commented 3 years ago

I have no idea why it doesn't see xrandr installed, the code is pretty simple, there has to be something env shell related not passing a path to deno

RoyvanEmpel commented 3 years ago

I have the exact same problem and do have sudo permissions.

sudo modprobe -r v4l2loopback
sudo modprobe v4l2loopback video_nr=50

It also doesn't see xrandr installed but it is. Would be amazing if it could work for the normal discord app.

Running Pop!_OS

ShayBox commented 3 years ago

I have no idea how to reproduce this, it has to be something with shell and env being overwritten or something

carloseberhardt commented 3 years ago

I had this problem, and it's because I installed deno using snap. I ran snap remove deno and reinstalled via the curl command from deno.land and that resolved it. deno eval 'Deno.run({cmd:["sh","-c","echo $PATH"]})' is what I ran that clued me to the solution.

BastLast commented 3 years ago

I had this problem, and it's because I installed deno using snap. I ran snap remove deno and reinstalled via the curl command from deno.land and that resolved it. deno eval 'Deno.run({cmd:["sh","-c","echo $PATH"]})' is what I ran that clued me to the solution.

that worked for me now i have a different error ! image

The command still doen't work with sudo but i do not get a permission error without sudo.

ShayBox commented 3 years ago

I didn't even realize deno was available as a snap, I always remove snapd, cause of container problems like this

Make sure you have latest v4l2loopbackis installed and rebooted

BastLast commented 3 years ago

I didn't even realize deno was available as a snap, I always remove snapd, cause of container problems like this

Make sure you have latest v4l2loopbackis installed and rebooted

Done. Now i am tryint to figure out how to change the resolution because discord seems not to like my 1440p screen

i mean i know i'm doing it wrong image but...

RoyvanEmpel commented 3 years ago

I removed deno from snap and installed it with curl -fsSL https://deno.land/x/install/install.sh | sh but when i run mon2cam it gives me the message that deno hasn't been installed. Command 'deno' not found, but can be installed with: sudo snap install deno

Edit: sudo mon2cam also doesn't work

~$ sudo mon2cam
sudo: mon2cam: command not found
BastLast commented 3 years ago

I removed deno from snap and installed it with curl -fsSL https://deno.land/x/install/install.sh | sh but when i run mon2cam it gives me the message that deno hasn't been installed. Command 'deno' not found, but can be installed with: sudo snap install deno

you have to add deno to your bashprofile

export DENO_INSTALL="/home/bastlast/.deno"
export PATH="$DENO_INSTALL/bin:$PATH"
RoyvanEmpel commented 3 years ago

Now it's working thanks!

n4tm commented 3 years ago

@vicentenoriega What happens if you try to create the V4L2 loopback deivce manually? sudo modprobe -r 4l2loopback sudo modprobe v4l2loopback video_nr=50

I believe the commands should be: sudo modprobe -r v4l2loopback sudo modprobe v4l2loopback video_nr=50

If this is the case, that seems to work successfully for me and I don't see output to the terminal. When I run mon2cam -v mon2cam.log I have the same error as above though.

From here I ran sudo mon2cam -v mon2cam.log and it stated xrander was not installed. So sudo apt install x11-xserver-utils will solve that. Unfortunately, my issue still exists and I can run xrander manually. Log output remained as follows

EBUG Starting Mon2Cam with the following options: Options {
  framerate: 60,
  device: 50,
  resolution: "",
  ffmpeg: [],
  border: false,
  sound: false,
  wayland: false,
  loggerOptions: { verbose: true, file: "mon2cam.log" },
  execOptions: { verbose: true, output: 3 }
}
DEBUG Checking if V4L2 device exists
DEBUG V4L2 device found with id 50
INFO X11 detected, running x11 backend. (use -w to force wayland)
DEBUG Exiting
PANIC xrandr not installed

It works pretty well for me! ty! :)