dartanianx
Posts: 1
Joined: Sat May 23, 2020 2:10 am

VNC Resolution

Sat May 23, 2020 2:13 am

Brand new raspberry pi user.

Got my pi4 set up with VNC and I can access it perfectly fine via my PC, however for the life of me I can't get the resolution fixed.

I've followed all youtube videos around forcing HDMI via config.txt, setting resolution in raspi-config but I can't get it to boot up with any changes acted upon.

Any help would be greatly appreciated.

lugee
Posts: 10
Joined: Sat May 16, 2020 10:41 am
Location: Stockholm, Sweden

Re: VNC Resolution

Sat May 23, 2020 4:14 pm

Hello,

What does your config.txt file look like?

klricks
Posts: 7047
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: VNC Resolution

Sat May 23, 2020 4:48 pm

For some reason raspi-config now only changes the resolution of the initial boot screen and not the desktop...

I now have to use the GUI Screen Layout Editor to change the desktop resolution.
[Menu] --> [Preferences] --> [Screen Configuration]
Don't forget to [Apply] after changing resolution.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

nst
Posts: 12
Joined: Sat May 16, 2020 5:18 am

Re: VNC Resolution

Sun May 24, 2020 9:06 am

You're sure? Cause I've set the resolution via 'sudo raspi-config' to 1920x1080x60 and my TV only switched once but not again with X coming up. I also can start a virtual vnc screen for headless configuration with 'vncserver -randr=1280x720' in '/etc/rc.local'. However, when the HDMI cable is unplugged from the TV and I connect to VNC the resolution of the VNC window on my Full HD monitor is 1024x768 instead.

lugee
Posts: 10
Joined: Sat May 16, 2020 10:41 am
Location: Stockholm, Sweden

Re: VNC Resolution

Sun May 24, 2020 9:48 am

I would recommend using the edid options, specifically hdmi_edid_file:
https://www.raspberrypi.org/documentati ... t/video.md

This way you could be able to save the EDID information and keep the same resolution settings.

Code: Select all

sudo /opt/vc/bin/tvservice -d /boot/edid.dat
viewtopic.php?p=173430#p173430

maddoglee
Posts: 6
Joined: Sun May 24, 2020 9:43 am

Re: VNC Resolution

Sun May 24, 2020 9:52 am

I'm using tightvnc and I found that I could easily change the resolution when loading the server.
e.g.
tightvncserver :1 -geometry 1600x900

it can be loaded in your rc.local

nst
Posts: 12
Joined: Sat May 16, 2020 5:18 am

Re: VNC Resolution

Sun May 24, 2020 3:27 pm

@lugee
I'm not sure I follow you. When I connect the Raspi to my TV, the resolution always is at 1920x1080x60, even when it's plugged in after boot. However, when I want to configure the Raspi from my laptop (1366x768) or my PC (1920x1080) without being connected to the TV, I would like to do so via VNC and a resolution of 1280x720. Are you saying the edid file also influences the resolution of the virtual desktop?

@madoglee
I'm using Real VNC server that comes with Raspian (Buster) out of the box without any tweaks. When I connect with TightVNC viewer, I get this message:

---------------------------
Error in TightVNC Viewer: No security types supported. Server sent security types, but we do not support any of them.
---------------------------

which is why I have used RealVNC viewer instead. Dunno o

lugee
Posts: 10
Joined: Sat May 16, 2020 10:41 am
Location: Stockholm, Sweden

Re: VNC Resolution

Sun May 24, 2020 5:10 pm

If it's a virtual desktop, then the EDID file won't influence the resolution. A loaded EDID file will let the Raspberry Pi pretend that the same monitor/tv is always plugged into the Pi, even though that may not be the case. When I started my Pi without a monitor and without this file, RealVNC doesn't work for me.

I've tested two different solutions, depending on which solution you prefer:

When VNC is mirroring a real screen, you can alter the resolution with the following command in the terminal within the VNC session:

Code: Select all

xrandr --output HDMI-1 --mode 1280x720
When VNC on a virtual desktop not connected to a real monitor, add this to /home/pi/.vnc/config:

Code: Select all

-geometry 1280x720
Then run:

Code: Select all

vncserver
If you are using a virtual desktop, you'll connect to a different port, like 5901.
The advantage with using a virtual desktop is that your screen won't be shown on the monitor/tv.

nst
Posts: 12
Joined: Sat May 16, 2020 5:18 am

Re: VNC Resolution

Mon May 25, 2020 6:42 am

Thanks, my home dir looks like this though:

.vnc/config.d

which is empty and

.vnc/vncchat.xml

which is empty too.

nst
Posts: 12
Joined: Sat May 16, 2020 5:18 am

Re: VNC Resolution

Sun May 31, 2020 2:36 pm

Even weirder now: I've cloned the SD card in my Raspi and used in the other Raspi to be installed in the store. I've changed the name of this one and everything's working fine except I cannot access VNC when the Raspi is not connected to an HDMI port despite also using 'vncserver -randr=1280x720' in '/etc/rc.local'.

lugee
Posts: 10
Joined: Sat May 16, 2020 10:41 am
Location: Stockholm, Sweden

Re: VNC Resolution

Mon Jun 01, 2020 7:11 pm

You might need to specify the full path to the vncserver binary, as you may not have the $PATH variable available in /etc/rc.local. You can use

Code: Select all

whereis vncserver
to find out.

nst
Posts: 12
Joined: Sat May 16, 2020 5:18 am

Re: VNC Resolution

Tue Jun 02, 2020 6:14 am

Thanks but since VNC starts flawlessly when connected to an HDMI port, I'm sure it's no path issue. Still, I've entered the absolute path in rc.local and it makes no difference: the Raspi shows 'cannot currently show the desktop'. After a reboot with the HDMI cable plugged in, I can connect to VNC from my Win PC immediately.

EDIT: Adding hdmi_force_hotplug=1 to /boot/config.txt did the trick. Headless will start in 1280x720 and when plugged in to a TV it will start with 1920x1080 as set via raspi-config.

Return to “Troubleshooting”