moonlight-stream / moonlight-android

GameStream client for Android
GNU General Public License v3.0
4.23k stars 670 forks source link

Custom resolution setting #1109

Open Pevtrick opened 2 years ago

Pevtrick commented 2 years ago

The screen resolutions of current smartphones are getting higher and higher, the current app settings only offer the native settings of the smartphone besides the usual 16:9 resolutions. If you want to keep the aspect ratio of the smartphone, you have to select one of the native resolutions, but this leads to high streaming requirements at high resolutions.

To reduce the streaming requirements and keep the aspect ratio of the smartphone, it would be good to either offer downscaled values of the native smartphone resolution (0.5x, 0.75x) or a possibility to set a custom resolution (as it is already possible in the desktop app).

loseheaven commented 2 years ago

I also think custom resolutions are very necessary.

For example, I'm about to play an old game on my Android TV these days, but since its technical implementation is relatively old and it has a 4:3 ratio, even if I try my best to make it display normally on my computer monitor in a 4:3 ratio , but still stretched by 16:9 resolution on both my Android phone and Android TV.

After trying various setting combinations all day, I feel that the moonlight client has a certain ability to adjust the aspect ratio intelligently. For example, the 4:3 desktop set by my PC can be displayed normally on a 16:9 TV (with the correct black area). But when I enter the game, there will be stretching. When I adjust the zoom mode of the nvidia graphics card, the game on the pc can be zoomed normally, but game's image the moonlight client is still stretched. It may be because the technology used by these ancient games and applications is too old, so that the intelligent aspect capability of the moonlight client is not fully compatible. At this time, if the moonlight client has the ability to force a custom resolution, it will completely solve this situation.

There are currently only two unofficial solutions on the Internet, but neither is ideal:

  1. Some people use root to achieve custom resolution (https://www.jianshu.com/p/baa397b6d5ac), but it is too difficult to root all kinds of devices)
  2. Or someone forked and added the custom resolution function, but it is an earlier version of the fork and has not been updated for a long time, so the compatibility is not strong enough. Everything has passed the test on my Android phone, but it happens to be Installation failed on my android tv, this is so sad T_T
laur33 commented 2 years ago

Agree with losehaven would be great to have a way to specify custom client resolutions.

The ios version of moonlight has this functionality and it works very well to play games that have different aspect ratios to the client devices native aspect ratio.

kayakyakr commented 2 years ago

Funny, I was just dropping in to see if this was a thing. Having custom resolutions would make it so that I do not have to buy a high res monitor to support just this use case, for one.

Saw @cgutman was looking at taking this issue up, which is exciting.

I think that you could implement it with some cleverness in selecting some ratios or max dimensions in one aspect or another, but I think it will be the most straightforward to just ask for a width and height, and fill the screen as the supported resolutions do.

parkerlreed commented 1 year ago

Any plans for this?

Streaming from a Steam Deck to a Tab S8+. There are no 16:10 resolutions (both the source and client are 16:10)

Native would work but that introduces some rendering artifacts for this setup.

kayakyakr commented 1 year ago

Hey Parker, I figured out how to set this up manually:

https://www.reddit.com/r/MoonlightStreaming/comments/ycko5n/setup_guide_setting_up_moonlight_android_for/

It might be worthwhile to build this into the repo's guides

parkerlreed commented 1 year ago

@kayakyakr thanks for the guide.

Seems a bit more Windows specific anyways.

I'm able to set native and the 800p fills the tablet but it then does this weirdness.

https://streamable.com/v17ezb

kayakyakr commented 1 year ago

@kayakyakr thanks for the guide.

Seems a bit more Windows specific anyways.

I'm able to set native and the 800p fills the tablet but it then does this weirdness.

https://streamable.com/v17ezb

Ah, didn't see that it was from a steam deck. That is some weirdness for sure.

cgutman commented 1 year ago

Any plans for this?

Yes, I am planning on implementing this feature for v11.0. I have a partial PoC in a branch.

I'm able to set native and the 800p fills the tablet but it then does this weirdness.

I suspect that issue is specific to Sunshine. It doesn't scale from host desktop to encoding resolution the same way that GeForce Experience does.

makedir commented 1 year ago

I am testing out Moonlight on my Android 13 phone, which has 1080 x 2408 pixels, 20:9 ratio. how would this work? i read before the resolution you set in the moonlight client is not set on the server? so how would this work? also does the game need to support the resolution too?

there is this scaling feature in the Nvidia control panel I never understood how it works, chose between no scaling GPU scaling and monitor scaling, how that that work and would it work with Moonlight too?

maybe also implement an upscale and stretch feature into all Moonlight clients, which implements the same scaling features like this tool:

https://store.steampowered.com/app/993090/Lossless_Scaling/

LS1 AMD FidelityFX Super Resolution (AMD FSR) NVIDIA Image Scaling (NIS) Integer Scaling Nearest Neighbor

to chose from would be handy.

kayakyakr commented 1 year ago

I am testing out Moonlight on my Android 13 phone, which has 1080 x 2408 pixels, 20:9 ratio. how would this work? i read before the resolution you set in the moonlight client is not set on the server? so how would this work? also does the game need to support the resolution too?

I think that you can get it when you follow this guide makedir: https://www.reddit.com/r/MoonlightStreaming/comments/ycko5n/setup_guide_setting_up_moonlight_android_for/

Basically, you set up a custom resolution in windows scaled to your phone resolution, and you toggle the GPU/Monitor scaling to trick your output to get it to output to your phone in the correct aspect ratio.

there is this scaling feature in the Nvidia control panel I never understood how it works, chose between no scaling GPU scaling and monitor scaling, how that that work and would it work with Moonlight too?

maybe also implement an upscale and stretch feature into all Moonlight clients, which implements the same scaling features like this tool:

https://store.steampowered.com/app/993090/Lossless_Scaling/

LS1 AMD FidelityFX Super Resolution (AMD FSR) NVIDIA Image Scaling (NIS) Integer Scaling Nearest Neighbor

to chose from would be handy.

I think that this would be largely reliant on the server-side. Maybe if gamestream's retirement spurs copious development within the sunshine codebase, making this sort of resolution/scaling/upscaling more accessible would be more approachable.

makedir commented 1 year ago

I think that this would be largely reliant on the server-side.

No, it would be 100% implemented in the client, and just upscale the video stream. LS1,AMD FSR,NIS and also Integer scale give way better results than the current scale/stretch implementation. A good video stream with no compression artifacts is also worth scaling up, the scaling doesnt need to happen on the server before video encoding.

An overlay GUI would also be nice finally to be seen in Moonlight, where you easily can toggle stuff, also a key to show all hotkeys.

kayakyakr commented 1 year ago

I think that this would be largely reliant on the server-side.

No, it would be 100% implemented in the client, and just upscale the video stream. LS1,AMD FSR,NIS and also Integer scale give way better results than the current scale/stretch implementation. A good video stream with no compression artifacts is also worth scaling up, the scaling doesnt need to happen on the server before video encoding.

An overlay GUI would also be nice finally to be seen in Moonlight, where you easily can toggle stuff, also a key to show all hotkeys.

Clients are generally going to be running substantially weaker hardware than servers so output scaling would put a not insignificant strain on device hardware. Since this is the android branch of moonlight, battery is also a concern: upscaling video will use more battery power than displaying the encoded video stream directly. You would have some gains in bandwidth used, but I don't think that's going to outweigh the losses in battery/hardware usage. It's not like the system is passing raw pixels over the net.

Really, that's what encoding the video for streaming is meant to do: turn a high resolution image into a low resolution image that your phone knows how to turn back into a high resolution image.

makedir commented 1 year ago

Clients are generally going to be running substantially weaker hardware than servers so output scaling would put a not insignificant strain on device hardware

totally nonsense. integer scaling would be easily be possible to be done, also mostly AMD FSR code by modern phone GPUs in hardware, but every laptop with Intel iGPU can do it with 60fps, as I use losless scaling on my laptop with a uhd630 gpu which handles it fine.

not sure what you want to explain to me? I dont need explenations nor did I ask for any.

kayakyakr commented 1 year ago

Clients are generally going to be running substantially weaker hardware than servers so output scaling would put a not insignificant strain on device hardware

totally nonsense. integer scaling would be easily be possible to be done, also mostly AMD FSR code by modern phone GPUs in hardware, but every laptop with Intel iGPU can do it with 60fps, as I use losless scaling on my laptop with a uhd630 gpu which handles it fine.

not sure what you want to explain to me? I dont need explenations nor did I ask for any.

Then get to implementing it in this open source software. Or pay for a bounty for someone to do so. Or at the very least, open a separate issue within the project that is actually related to your suggestion. This derail has gone far enough.

No need to be rude on github.

Pevtrick commented 1 year ago

Create an issue for new upscaling techniques. I can see that it is useful but it is not what is addressed by this issue.

fmiceli24 commented 1 year ago

Has this been implemented? I really find custom streaming resolution very useful on moonlight for iOS.

Pevtrick commented 1 year ago

Unfortunately, no. There have been no updates for the Android app for quite some time.

goooroooX commented 1 year ago

Kindly requesting this feature (custom resolution) to be implemented. This is vital to stream SBS video to AR glasses. Thanks!

stadros83 commented 1 year ago

I want this also :) ! I've got a FOLD 4 and the default resolution is too big to stream. A x0.5 and x0.75 would be nice !

Edit : I've just seen that it is possible on iOS ! Why not on Android ?

stadros83 commented 1 year ago

I can't find a "Pull request" for this feature. Was it canceled ? It's possible on iOS so that means it should be on Android also no ?

blood03 commented 10 months ago

The only limited solution I found without needing root so far was to decompile the apk, change the default resolution in the "preferences.xml" file and compile again. The initial default resolution will be the one modified in the "xml" file (you will notice that no resolution is selected when clicking on resolution in the settings).

My situation:

  1. Smartphone resolution: 2400x1080 (20:9), but the smartphone cannot use resolutions higher than 1920x1080 (error -5) in moonlight.
  2. Resolutions on the app: 2400x1080, 2306x1080 (both unusable) and the default resolutions (none in 20:9).

The solution would be to use another resolution in 20:9 below 1080p (1920x864 as an example) to avoid black bars, which is not supported.

makedir commented 10 months ago

"Smartphone resolution: 2400x1080 (20:9), but the smartphone cannot use resolutions higher than 1920x1080 (error -5) in moonlight." what? there is native option in Moonlight, why isnt it working for you? phone issue?

blood03 commented 10 months ago

I don't think so. Phone resolution is 2400x1080 and moonlight offers this resolution too which is marked as "Native Full-Screen(2400x1080)", but this resolution simply doesn't work (I think the snapdragon 695 doesn't support more than 1080@60ps). Already tried and the native resolution doesn't work in similar services like parsec and steam link.

makedir commented 10 months ago

@blood03 works for me on all my Android devices. So its an issue/limitation with your phones hw, not Moonlight. buy newer phone.

blood03 commented 10 months ago

@makedir You're probably right regarding hardware limitation, but i don't think "buy newer phone" is a meaningful advice considering that i'm not using old or unsupported device. I'm just sharing my experience as a user that can't use moonlight (which is pretty good) without black bars because using custom resolution on android client it's not available easily.

emilwojcik93 commented 9 months ago

Hi, is there a chance to make custom resolution option available on Android? I using Samsung S23 with Samsung Dex and im limited to 16:9 4K window for moonlight client on my 32:9 (5120x1440/3840x1080) external monitor.

This could be resolved by adding:

https://photos.app.goo.gl/XxzwPPgCVsmF9mvJ8

Best regards, emilwojcik93.

sambuev commented 7 months ago

It's been 2 years and it seems custom resolution will not be added any time soon :(

Tykveg commented 3 months ago

Will be useful. Add this please.

BMPixel commented 1 day ago

This is very needed. I am using moonlight on quest and it drastically underestimate the fullscreen resolution

mousemat86 commented 1 day ago

Would be a useful feature