loki-47-6F-64 / sunshine

Host for Moonlight Streaming Client
GNU General Public License v3.0
1.77k stars 154 forks source link

Run multiple instances for streaming different displays #59

Open cTatu opened 3 years ago

cTatu commented 3 years ago

Hi, I have multiple displays, and I'd want to run a different instance of sunshine for each one. I suppose that at least it should be able to change the ports that uses for streaming to arbitrary ones. Does moonlight have the option to connect to a host on arbitrary ports? How can it be done? Thank you!

shodanx2 commented 2 years ago

Hello,

I am in a similar situation, I have two monitors as shown in the attached screenshot image

And I have a raspberry pi 4 with a similar display setup

image

I think instead of running two instances, it would be ideal to capture and stream both display as a single contiguous region

Right now it seems you can only specify a whole display \.\DISPLAY5

But looking at the sunshine logs I see Capture size : 1680x1050 Offset : 1920x1063 Virtual Desktop : 3600x2113

Perhaps if I could set capture size to my 1680x2100 and the appropriate offset (maybe 1920x0) I could capture both display in a single plane.

Then it would be a matter of getting moonlight to display this steam accross two monitor, instead of resizing the stream to fit in a single monitor with black bars ?

hwamil commented 1 year ago

@shodanx2 Did you figure something out, by chance? Right now I have a Frankenstein setup of Parsec+Sunshine and I really want to ditch Parsec.

shodanx2 commented 1 year ago

I do not have a working solution yet, I have been experimenting with streaming ddagrab capture with ffmpeg to network multicast, however latency is still wild, 500 ms to multiple seconds.

With the correct magical ffmpeg incantation it should be possible to 2-5 frames behind real time.

hwamil commented 1 year ago

@shodanx2 I was actually inspired by when you said stream them as one contiguous area and found a hacky workaround.

I created a 32:9 virtual display on the host, then enabled nvidia surround on the client - just like that, dual monitors!

The only issue with this is that, whether it's surround, eyefinity, or whatever, may not work with your rpi :(

Kofa1 commented 1 year ago

Anyone found any solution? I have a similar setup, but the monitors aren't aligned, so I can't use this workaround. Best option would be to run two instances of Sunshine on host and two Moonlights on client, for each monitor. (2 and 3 are virtual) Screenshot (95)

marcaddeo commented 1 year ago

I was able to run two instances of Sunshine to stream different dummy displays to different Moonlight clients.

I just copied the "Sunshine" folder in "Program Files" to "Sunshine 2". I renamed the exe to "sunshine2.exe", but I'm not 100% sure that is necessary. Then, you just need to update the config in the second Sunshine folder to use a different port range, and to use the correct display.

When connecting from Moonlight on my iPad, on the non-standard instance I just manually entered the address and port, e.g. 192.168.1.69:47889.

jajm1991 commented 10 months ago

I was able to run two instances of Sunshine to stream different dummy displays to different Moonlight clients.

I just copied the "Sunshine" folder in "Program Files" to "Sunshine 2". I renamed the exe to "sunshine2.exe", but I'm not 100% sure that is necessary. Then, you just need to update the config in the second Sunshine folder to use a different port range, and to use the correct display.

When connecting from Moonlight on my iPad, on the non-standard instance I just manually entered the address and port, e.g. 192.168.1.69:47889.

Dude a quick question, how do you exactly update the config in the second sunshine folder? Whenever I open the sunshine conf file it is just empty. @marcaddeo

marcaddeo commented 10 months ago

I was able to run two instances of Sunshine to stream different dummy displays to different Moonlight clients. I just copied the "Sunshine" folder in "Program Files" to "Sunshine 2". I renamed the exe to "sunshine2.exe", but I'm not 100% sure that is necessary. Then, you just need to update the config in the second Sunshine folder to use a different port range, and to use the correct display. When connecting from Moonlight on my iPad, on the non-standard instance I just manually entered the address and port, e.g. 192.168.1.69:47889.

Dude a quick question, how do you exactly update the config in the second sunshine folder? Whenever I open the sunshine conf file it is just empty. @marcaddeo

There should be a file in the config folder called sunshine.conf which has a line that says port = 47889 in it or whatever starting port you want to use.

You can also just update it via the UI in the Configuration > Advanced tab. Then hit save, apply, and you'll need to close that tab and re-open sunshine at the new port.

jajm1991 commented 10 months ago

I was able to run two instances of Sunshine to stream different dummy displays to different Moonlight clients. I just copied the "Sunshine" folder in "Program Files" to "Sunshine 2". I renamed the exe to "sunshine2.exe", but I'm not 100% sure that is necessary. Then, you just need to update the config in the second Sunshine folder to use a different port range, and to use the correct display. When connecting from Moonlight on my iPad, on the non-standard instance I just manually entered the address and port, e.g. 192.168.1.69:47889.

Dude a quick question, how do you exactly update the config in the second sunshine folder? Whenever I open the sunshine conf file it is just empty. @marcaddeo

There should be a file in the config folder called sunshine.conf which has a line that says port = 47889 in it or whatever starting port you want to use.

You can also just update it via the UI in the Configuration > Advanced tab. Then hit save, apply, and you'll need to close that tab and re-open sunshine at the new port.

Got it working! Thanks, though I need to manually start Sunshine2 for it to work, and when I do it opens a CMD window that stays on screen until closed that as well terminates the service, I can easily have this open up with windows, however, is there any way to have this CMD window runs on background so I do not need to have it on screen?

mjsisley commented 3 months ago

Y'all, thanks so much - just got dual screen on the AVP working off of this and it's sick. Much love.

shodanx2 commented 3 months ago

Please post a short video of it in action. Github allows videos under 25MB

mjsisley commented 3 months ago

This isn't me, but to save time there is a video here: https://www.reddit.com/r/VisionPro/comments/1da2prs/dual_screens_by_using_sunshine_moonlight/

shodanx2 commented 3 months ago

Oh my god that is amazing What is the limit I want to do my whole desktop this way

image

mjsisley commented 3 months ago

That would be awesome!

I think right now, two is the max you can pull off on AVP w/ sunshine (you have to use both moonlight ipad version and moonlight native (in testflight beta) as the two clients and hook them up to the two instances of sunshine)... and it may stop working once the moonlight native leaves beta (if the ipad version of moonlight is pulled on AVP when the native version hits the app store).

But it's pretty nice right now to have two wall (or whatever) sized monitors.

RikuKunMS2 commented 2 months ago

I got this working

make sure you set the port +26 the default port something like 48027

also turn off automatic discovery or it'll keep overriding your manual port settings.

Katsuyamaki commented 1 month ago

I got this working

make sure you set the port +26 the default port something like 48027

also turn off automatic discovery or it'll keep overriding your manual port settings.

I got this working! Where is the automatic discovery option? I cannot find it and port gets overridden.