Recently I attended a conference where I needed to display a demonstration of what we were doing in VR on the Oculus Quest, the Quest has some great mechanisms for casting to a mobile phone or to a Chromecast device attached to a TV but when it comes to sharing to a laptop there isn’t really a good solution at the moment. Im sure that will all change when they bring out Oculus Link (for a wired connection anyway) but we needed something now.
After digging around on some forums and piecing some data together from youtube, forums and reddit I thought i would make a note of the end result here which enables you to use scrcpy, an android screen sharing utility, to share both with a wire but also wirelessly and also enables an easy way to capture video straight to the computer.
Initial Install and Setup
- Enable developer mode on your Oculus Quest (https://www.youtube.com/watch?v=1PTFkLnJRLs)
- Plug the USB-C cable into your computer and the Quest, this also works with USB to USB-C
- If its your first time plugging into this computer you will need to accept the prompt within the device that allows you to access the device from the computer as per below and check the box to always allow if you want to skip this section in the future
- For Windows download and unzip the latest build of scrcpy from https://github.com/Genymobile/scrcpy/releases a direct link for the current version when writing this is here: https://github.com/Genymobile/scrcpy/releases/download/v1.10/scrcpy-win64-v1.10.zip
- For Mac the application is available in Homebrew. Install it using the following from a terminal window:
-
brew install scrcpy
- You will also need
adb
. you can install this by running the following from a terminal window: -
brew cask install android-platform-tools
Sharing the Screen connected via cable
- Open a command prompt (cmd.exe) or and CD into the extracted folder from above
- Run the following command:
-
scrcpy
-c
1200:800:180:320
-m
1600
-b
25M
Sharing the Screen connected wirelessly
You will still need a cable to make an initial connection and start the client on the Quest and then you can disconnect and use wirelessly, use the following steps to connect wirelessly:
- Follow steps 1-4 above in the setup section
- Open a command prompt (cmd.exe) and CD into the extracted folder from above
- While the device is connected via a cable run the following to find out what your Quests IP address is in the src section:
-
adb shell ip route
192.168
.
1.0
/
24
dev wlan0 proto kernel scope link src
192.168
.
1.198
- Now run the following replacing the IP address below (192.168.1.198) as yours:
-
adb tcpip
5555
adb connect
192.168
.
1.198
:
5555
- Disconnect the cable from the PC and with the device disconnected run the command to connect to the device as below
scrcpy -c 1200 : 800 : 180 : 320 -m 1600 -b 25M |
Sharing Window
If everything worked above a new window should appear showing the device screen, you can then maximize this for a better demo window.
Testing was done with variations of the scrcpy command but the above was found to be the best viewing size to enable a good demo.
Recording the screen
There is also a great way to capture the screen while mirroring, add the following command options to the end of the scrcpy command above to do this:
--record file.mp4 |
To disable mirroring while recording:
--no-display --record file.mp4 |
Troubleshooting
Connection Issues
If you get a blank window or are unable to connect when device is plugged in you should be able to run the following command from the same folder above:
PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 device
The device should show above rather than:
PS C:\Users\alan\Downloads\scrcpy-win64-v1.10> .\adb.exe devices
List of devices attached
1PASH9AF839266 unauthorized
If you get the latter then make sure you have enabled developer mode and authorized the device as per step 1-3 above.
Target Machine refused connection when in wireless
If you receive a message like the following: “cannot connect to 192.168.1.198:5555: No connection could be made because the target machine actively refused it. (10061)”
Reconnect the Quest to the computer and go from Step 3 in the wireless connection steps above, this is caused because the client on the quest stopped, normally as you reset the device.