Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error Can't open display :1 #11

Open
cspaier opened this issue Mar 18, 2020 · 4 comments
Open

Error Can't open display :1 #11

cspaier opened this issue Mar 18, 2020 · 4 comments

Comments

@cspaier
Copy link

cspaier commented Mar 18, 2020

Hi,
Trying your script I had the following error: Can't open display :1

Running xrandr would raise the exact same error.

I don't know much about all that but trying around I fixed it adding DISPLAY=:0.0 before the xrandr commands.

Just sharing in case someone face the same issue. Maybe there is a proper fix to be done.

Here is my script:


#!/bin/bash

# echo "Probing v4l2-loopback"
sudo rmmod v4l2loopback 2> /dev/null
sudo modprobe v4l2loopback video_nr=7 'card_label=myFakeCam'

DISPLAY=:0.0 xrandr --listactivemonitors
read -p "Which monitor you want to share: " MON_NUMBER

MON_PARSE=`DISPLAY=:0.0 xrandr --listactivemonitors | grep "$MON_NUMBER:" | cut -f4 -d' '`
MON_HEIGHT=`echo $MON_PARSE | cut -f2 -d'/' | cut -f2 -d'x'`
MON_WIDTH=`echo $MON_PARSE | cut -f1 -d'/'`
MON_X=`echo $MON_PARSE | cut -f2 -d'+'`
MON_Y=`echo $MON_PARSE | cut -f3 -d'+'`

# ffmpeg -f x11grab -r 20 -s 1920x1080 -i :0.0+0,0 -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video7
ffmpeg -f x11grab -r 20 -s "$MON_WIDTH"x"$MON_HEIGHT" -i :0.0+"$MON_X","$MON_Y" -vcodec rawvideo -pix_fmt yuv420p -threads 0 -f v4l2 /dev/video7
@jeisoncp
Copy link

I had a similar error:

[x11grab @ 0x5570a782b2c0] Cannot open display :0.0+0,0, error 1.
:0.0+0,0: Input/output error

@cspaier
Copy link
Author

cspaier commented Apr 15, 2020

I think you need to figure out what your display number is and add it like that DISPLAY=:x before the xrandr commands.

@mattiasghodsian
Copy link

mattiasghodsian commented May 15, 2021

Same issue here, didn't help adding DISPLAY=:

JohnXLivingston added a commit to JohnXLivingston/hliss that referenced this issue Oct 6, 2021
@JohnXLivingston
Copy link

Should be fixed by: #16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants