2020-04-05 06:08:39 +00:00
|
|
|
# Introduction
|
2020-04-18 10:27:26 +00:00
|
|
|
Sunshine is a Gamestream host for Moonlight
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2021-05-26 19:33:28 +00:00
|
|
|
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/cgrtw2g3fq9b0b70/branch/master?svg=true)](https://ci.appveyor.com/project/loki-47-6F-64/sunshine/branch/master)
|
|
|
|
[![Downloads](https://img.shields.io/github/downloads/Loki-47-6F-64/sunshine/total)](https://github.com/Loki-47-6F-64/sunshine/releases)
|
|
|
|
|
2020-04-05 06:10:20 +00:00
|
|
|
- [Building](README.md#building)
|
|
|
|
- [Credits](README.md#credits)
|
2020-04-05 06:08:39 +00:00
|
|
|
|
|
|
|
# Building
|
2020-04-05 06:10:20 +00:00
|
|
|
- [Linux](README.md#linux)
|
|
|
|
- [Windows](README.md#windows-10)
|
2020-04-05 06:08:39 +00:00
|
|
|
|
|
|
|
## Linux
|
|
|
|
|
|
|
|
### Requirements:
|
2020-05-03 22:24:11 +00:00
|
|
|
Ubuntu 20.04:
|
2020-11-18 20:31:13 +00:00
|
|
|
Install the following
|
|
|
|
```
|
2021-05-14 19:32:46 +00:00
|
|
|
sudo apt install cmake libssl-dev libavdevice-dev libboost-thread-dev libboost-filesystem-dev libboost-log-dev libpulse-dev libopus-dev libxtst-dev libx11-dev libxrandr-dev libxfixes-dev libevdev-dev libxcb1-dev libxcb-shm0-dev libxcb-xfixes0-dev
|
2020-11-18 20:31:13 +00:00
|
|
|
```
|
2020-04-05 06:03:40 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Compilation:
|
2020-04-05 06:03:40 +00:00
|
|
|
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recurse-submodules`
|
|
|
|
- `cd sunshine && mkdir build && cd build`
|
|
|
|
- `cmake ..`
|
2020-11-18 20:31:13 +00:00
|
|
|
- `make -j ${nproc}`
|
2020-04-05 06:03:40 +00:00
|
|
|
|
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Setup:
|
2020-04-05 06:03:40 +00:00
|
|
|
sunshine needs access to uinput to create mouse and gamepad events:
|
2020-11-18 20:31:13 +00:00
|
|
|
- Add user to group 'input':
|
|
|
|
`usermod -a -G input $USER`
|
|
|
|
- Create udev rules:
|
|
|
|
- Run the following command:
|
|
|
|
`nano /etc/udev/rules.d/85-sunshine-input.rules`
|
|
|
|
- Input the following contents:
|
|
|
|
`KERNEL=="uinput", GROUP="input", mode="0660"`
|
|
|
|
- Save the file and exit
|
|
|
|
1. `CTRL+X` to start exit
|
|
|
|
2. `Y` to save modifications
|
2021-05-09 23:07:24 +00:00
|
|
|
- `assets/sunshine.conf` is an example configuration file. Modify it as you see fit, then use it by running:
|
2020-11-18 20:31:13 +00:00
|
|
|
`sunshine path/to/sunshine.conf`
|
|
|
|
- Configure autostart service
|
2021-05-09 23:07:24 +00:00
|
|
|
`path/to/build/dir/sunshine.service` is used to start sunshine in the background. To use it, do the following:
|
|
|
|
1. Copy it to the users systemd, `cp sunshine.service ~/.config/systemd/user/`
|
|
|
|
2. Starting
|
2020-11-18 20:31:13 +00:00
|
|
|
- Onetime:
|
|
|
|
`systemctl --user start sunshine`
|
|
|
|
- Always on boot:
|
|
|
|
`systemctl --user enable sunshine`
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-11-18 20:31:13 +00:00
|
|
|
- `assets/apps.json` is an [example](README.md#application-list) of a list of applications that are started just before running a stream
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Trouleshooting:
|
2020-11-18 20:31:13 +00:00
|
|
|
- If you get "Could not create Sunshine Gamepad: Permission Denied", ensure you are part of the group "input":
|
|
|
|
- `groups $USER`
|
|
|
|
|
|
|
|
- If Sunshine sends audio from the microphone instead of the speaker, try the following steps:
|
|
|
|
1. pacmd list-sources | grep "name:"
|
|
|
|
2. Copy the name to the configuration option "audio_sink"
|
|
|
|
3. restart sunshine
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
## Windows 10
|
2020-04-05 06:03:40 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Requirements:
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2021-04-26 18:36:54 +00:00
|
|
|
mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git yasm nasm diffutils make
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Compilation:
|
2021-04-26 18:36:54 +00:00
|
|
|
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recursive`
|
2020-04-05 06:03:40 +00:00
|
|
|
- `cd sunshine && mkdir build && cd build`
|
|
|
|
- `cmake -G"Unix Makefiles" ..`
|
|
|
|
- `make`
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-04-05 06:08:39 +00:00
|
|
|
### Setup:
|
2020-04-05 18:46:00 +00:00
|
|
|
- **OPTIONAL** Gamepad support: Download and run 'ViGEmBus_Setup_1.16.116.exe' from [https://github.com/ViGEm/ViGEmBus/releases]
|
2020-01-19 20:33:04 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-04-05 06:03:40 +00:00
|
|
|
# Common
|
2020-01-19 20:33:04 +00:00
|
|
|
|
2020-04-05 06:03:40 +00:00
|
|
|
## Usage:
|
|
|
|
- run "sunshine path/to/sunshine.conf"
|
|
|
|
- In Moonlight: Add PC manually
|
|
|
|
- When Moonlight request you insert the correct pin on sunshine, either:
|
|
|
|
- Type in the URL bar of your browser: `xxx.xxx.xxx.xxx:47989/pin/####`
|
2020-04-25 22:26:47 +00:00
|
|
|
- `wget xxx.xxx.xxx.xxx:47989/pin/####`
|
|
|
|
- The x's are the IP of your instance, `####` is the pin
|
2020-04-05 06:03:40 +00:00
|
|
|
- Click on one of the Applications listed
|
|
|
|
- Have fun :)
|
2019-12-05 00:11:09 +00:00
|
|
|
|
2019-12-08 18:21:48 +00:00
|
|
|
|
2020-04-05 06:03:40 +00:00
|
|
|
## Note:
|
|
|
|
- The Windows key is not passed through by Moonlight, therefore Sunshine maps Right-Alt key to the Windows key
|
|
|
|
- If you set Video Bitrate to 0.5Mb/s:
|
|
|
|
- Sunshine will use CRF or QP to controll the quality of the stream. (See example configuration file for more details)
|
|
|
|
- This is less CPU intensive and it has lower average bandwith requirements compared to manually setting bitrate to acceptable quality
|
|
|
|
- However, it has higher peak bitrates, forcing Sunshine to drop entire frames when streaming 1080P due to their size.
|
|
|
|
- When this happens, the video portion of the stream appears to be frozen.
|
|
|
|
- This is rare enough that using this for the desktop environment is tolerable (in my opinion), however for gaming not so much.
|
2019-12-08 18:28:14 +00:00
|
|
|
|
|
|
|
|
2020-04-05 06:03:40 +00:00
|
|
|
## Credits:
|
2020-04-05 06:11:26 +00:00
|
|
|
- [Simple-Web-Server](https://gitlab.com/eidheim/Simple-Web-Server)
|
|
|
|
- [Moonlight](https://github.com/moonlight-stream)
|
|
|
|
- [Looking-Glass](https://github.com/gnif/LookingGlass) (For showing me how to properly capture frames on Windows, saving me a lot of time :)
|
2021-05-21 11:53:12 +00:00
|
|
|
- [Eretik](http://eretik.omegahg.com/) (For creating PolicyConfig.h, allowing me to change the default audio device on Windows programmatically)
|
2019-12-16 21:39:50 +00:00
|
|
|
|
2020-04-05 06:03:40 +00:00
|
|
|
## Application List:
|
|
|
|
- You can use Environment variables in place of values
|
|
|
|
- $(HOME) will be replaced by the value of $HOME
|
|
|
|
- $$ will be replaced by $ --> $$(HOME) will be replaced by $(HOME)
|
|
|
|
- env: Adds or overwrites Environment variables for the commands/applications run by Sunshine.
|
|
|
|
- "Variable name":"Variable value"
|
|
|
|
- apps: The list of applications
|
2020-04-05 18:46:00 +00:00
|
|
|
- Example:
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"name":"An App",
|
|
|
|
"cmd":"command to open app",
|
|
|
|
"prep-cmd":[
|
|
|
|
{
|
2021-05-12 21:01:30 +00:00
|
|
|
"do":"some-command",
|
|
|
|
"undo":"undo-that-command"
|
2020-04-05 18:46:00 +00:00
|
|
|
}
|
2021-05-12 21:01:30 +00:00
|
|
|
],
|
|
|
|
"detached":[
|
|
|
|
"some-command",
|
|
|
|
"another-command"
|
2020-04-05 18:46:00 +00:00
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
2020-04-05 06:03:40 +00:00
|
|
|
- name: Self explanatory
|
|
|
|
- output <optional>: The file where the output of the command is stored
|
|
|
|
- If it is not specified, the output is ignored
|
2021-05-12 21:01:30 +00:00
|
|
|
- detached: A list of commands to be run and forgotten about
|
2020-04-05 06:03:40 +00:00
|
|
|
- prep-cmd: A list of commands to be run before/after the application
|
|
|
|
- If any of the prep-commands fail, starting the application is aborted
|
|
|
|
- do: Run before the application
|
|
|
|
- If it fails, all 'undo' commands of the previously succeeded 'do' commands are run
|
|
|
|
- undo <optional>: Run after the application has terminated
|
|
|
|
- This should not fail considering it is supposed to undo the 'do' commands.
|
|
|
|
- If it fails, Sunshine is terminated
|
|
|
|
- cmd <optional>: The main application
|
|
|
|
- If not specified, a processs is started that sleeps indefinitely
|
2019-12-16 21:39:50 +00:00
|
|
|
|
2020-04-18 02:46:07 +00:00
|
|
|
1. When an application is started, if there is an application already running, it will be terminated.
|
|
|
|
2. When the application has been shutdown, the stream shuts down as well.
|
|
|
|
3. In addition to the apps listed, one app "Desktop" is hardcoded into Sunshine. It does not start an application, instead it simply starts a stream.
|
|
|
|
|
|
|
|
Linux
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"env":{
|
|
|
|
"DISPLAY":":0",
|
|
|
|
"DRI_PRIME":"1",
|
|
|
|
"XAUTHORITY":"$(HOME)/.Xauthority",
|
|
|
|
"PATH":"$(PATH):$(HOME)/.local/bin"
|
|
|
|
},
|
|
|
|
"apps":[
|
|
|
|
{
|
|
|
|
"name":"Low Res Desktop",
|
|
|
|
"prep-cmd":[
|
|
|
|
{ "do":"xrandr --output HDMI-1 --mode 1920x1080", "undo":"xrandr --output HDMI-1 --mode 1920x1200" }
|
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"name":"Steam BigPicture",
|
|
|
|
|
|
|
|
"output":"steam.txt",
|
|
|
|
"cmd":"steam -bigpicture",
|
|
|
|
"prep-cmd":[]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|
|
|
|
Windows
|
|
|
|
```json
|
|
|
|
{
|
|
|
|
"env":{
|
|
|
|
"PATH":"$(PATH);C:\\Program Files (x86)\\Steam"
|
|
|
|
},
|
|
|
|
"apps":[
|
|
|
|
{
|
|
|
|
"name":"Steam BigPicture",
|
|
|
|
|
|
|
|
"output":"steam.txt",
|
|
|
|
"prep-cmd":[
|
|
|
|
{"do":"steam \"steam://open/bigpicture\""}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
```
|