How to set the resolution from the command line?

Hi.
How can I set the resolution of the “video output” (not sure how it’s called, but I do not talk about the Kodi output) from the command line?
Thanks.

Kodi outputs its GUI in the resolution you set in Settings. It outputs videos in the same resolution or the resolution of the stream, depending on settings (eg Whitelist). Which do you want to set from the command line? What do you want to achieve?

I stream games with moonlight and I have an issue when I look at a video that has a different resolution than my moonlight stream before streaming with moonlight.
So, that’s why I want to set the resolution via the command line: to reset the resolution so that my streaming with moonlight has the correct resolution.

You can tell Kodi to do it via JSON-RPC. If you set the resolution you want in Kodi and run the following in the terminal via ssh it will show you the setting value you need to know…

curl -X POST -H "content-type:application/json" -d '{"jsonrpc":"2.0","method":"Settings.GetSettingValue","params":{"setting":"videoscreen.screenmode"},"id":1}' http://osmc:osmc@localhost:80/jsonrpc

You can then use that value in something like this to change the resolution and confirm the change so Kodi doesn’t revert the value a couple seconds after you make the change…

curl -X POST -H "content-type:application/json" -d '{"jsonrpc":"2.0","method":"Settings.SetSettingValue"," params":{"setting":"videoscreen.screenmode","value":"0192001080023.97600pstd"},"id":1}' http://osmc:osmc@localhost:80/jsonrpc & sleep 5;kodi-send -a left;kodi-send -a select

Note that this command just sends left and select commands to Kodi blind so if you run it and the resolution hasn’t changed then the confirmation window will not be shown and so it will navigate and select something/somewhere you probably don’t want. If your going to script something up you would probably want it to use the first command to query the current display mode before trying to change it.

Thanks, but after doing a few tests of calling GetSettingValue, this seems to be the resolution of the Kodi interface, not the video output, so this is not what I’m looking for.

I’ve never used Moonlight, but if it’s sending a stream, why doesn’t the addon select the appropriate resolution and what’s it got to do with a previously played video? Have you asked the addon authors?

My understanding of how things work is limited, but I believe the Vero works with two output buffers: one for the Kodi UI and one for “video” output: there’s no X.org or Wayland like a normal Linux distro.
My understanding is that moonlight will use the “video” output, which is why my workaround involves playing a video to fix the resolution (it’s the same output buffer, so playing a video is my current way of setting the resolution).

The addon that I use is not maintained anymore. In fact, the Moonlight support for the Vero has been broken for many years, but I was able to make it work on the Vero V last year.

The addon allows choosing a resolution, but this only sets the resolution of the stream, not the resolution of the “video” output.

I started facing some blackscreen issues recently with Moonlight and I have a hunch that it’s related to the resolution, so that’s why I want to fix my resolution issue.

I’m not sure how it works but you could try just
echo 720p50hz | sudo tee /sys/class/display/mode
for example.
Choose a string from the output of
cat /sys/class/amhdmitx/amhdmitx0/disp_cap

If you get stuck, post some logs after you’ve engaged Moonlight.

Quite, and if this works, can’t the input stream be used to set the resolution accordingly?

I don’t know the state of Moonlight anymore. I thought it got forked.
Does the fork support Vero V?

If so maybe it’s time to package it up and add it to our App Store, as long as Kodi can be restored gracefully.

My concern is that I can’t test it trivially myself as I don’t have a machine lying around with Windows and an NVIDIA GPU

Sam

Oh, I didn’t know there was a fork of Moonlight (and Sunshine, the server part).
Do you talk about this fork (and this one for the server side)?
I don’t think the fork supports Vero, especially since they don’t seem to have forked moonlight-embedded.
I’ll try these and contact them as they seem very responsive.

My concern is that I can’t test it trivially myself as I don’t have a machine lying around with Windows and an NVIDIA GPU

You need neither Windows, nor a NVIDIA GPU: I currently stream with Linux using Sunshine as the server software on a PC with an AMD GPU.

If so maybe it’s time to package it up and add it to our App Store, as long as Kodi can be restored gracefully.

I recently started having an issue, but I’ve been using it for around a year, now. There might be other quality of life improvement to be done (like the resolution issue I talk about in this thread) to be fixed before packaging it.

Last time I was fiddleing with ML-embedded, there was no code for “change of resolution” in aml-part of the code. It will display in which ever resolution CLI is left in, before start of ML-embedded.