Make Custom Resolution Permanent

  • Hello,


    I use the following commands to add 4K 60hz resolution to Libreelec/Kodi because its missing from the list:



    -----------------------------------------------------

    cvt 3840 2160 60



    xrandr --newmode "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync



    xrandr --addmode HDMI1 "3840x2160_60.00"


    xrandr --output HDMI1 --mode "3840x2160_60.00"

    -----------------------------------------------------


    The commands work fine but upon reboot the settings are gone, how do i save the resolution permanently in Libreelec so that it will always appear in the GUI ?

  • I guess it could be done via an script running at startup.


    but I would also check the setting.

    maybe you need to switch to expert or similar mode before: the most left bottom icon in the setting screen: multiple clicks on it


    LE config addon:

    => system

    * Resolution

    * whitelist


    don't know if LE has a default Resolution causing the switch back, but then the startup script should do the job


    how and where to put a script running during boot:

    https://wiki.libreelec.tv/configuration/useful_scripts

    DigiBit R1, NUC8i3BEH

  • Sadly 4K 60hz is not in the whitelist - so i can not enable it from there but my TV does support it. I will try the startup script you suggested thanks

  • well, I'm the opinion when the box boots it configures the resolution of the monitor or what the monitor per default could do via a sort of handshake.


    I could be wrong !


    but when I'm not:

    why doesn't that work for you (without manual intervention) ?


    that's one part of the background of my suggestion.

    the other was: running a monitor out of it's specs (if possible at all) wouldn't be good in long terms, I guess ...

    DigiBit R1, NUC8i3BEH

  • You can put the commands in a simple script and then order the execution using a systemd service file in /storage/.config/system.d/ .. it's been a decade since I used LE on x86_64 hardware with X11 services so I have no idea which services you need in the after criteria, but this is the only way to say "after X11 services start, before kodi.target starts"

  • You can put the commands in a simple script and then order the execution using a systemd service file in /storage/.config/system.d/ .. it's been a decade since I used LE on x86_64 hardware with X11 services so I have no idea which services you need in the after criteria, but this is the only way to say "after X11 services start, before kodi.target starts"

    Thanks for pointing me in the right direction. I am not 100% sure how to do it, is there a relevant short guide ?

  • but this is the only way to say "after X11 services start, before kodi.target starts"

    This condition is already fulfilled for autostart.sh with After=graphical.target and Before=kodi.service.


    But X11 startup may take so long that a sleep 3 or similar is required at start of the script.

  • the script is named *.bak and should end on *.sh, - I guess-

    and

    the autostart.sh has a "(" at the beginning and an ")&" at the end

    DigiBit R1, NUC8i3BEH

  • Code
    (
    sleep 3
    xrandr --newmode "3840x2160_60.00" 712.75 3840 4160 4576 5312 2160 2163 2168 2237 -hsync +vsync
    xrandr --addmode HDMI1 "3840x2160_60.00"
    xrandr --output HDMI1 --mode "3840x2160_60.00"
    )&

    ^ Try that. It runs the commands in the background after waiting 3 secs for X11 to start. Even if 4K60 is working in nightles your issue is the EDID data read from HDMI does not provide that modeline, so you'll still need to add it.