How can a macOS screen be sent to an Android-based Google Cardboard VR as a side-by-side image?
How to mirror macOS screen to an Android-based Google Cardboard VR as a side-by-...
Top Answer/Comment:
Note: Beware of latency, which can go up to 1 minute. I recommend a tandem audio stream while using earbuds connected to the Google Cardboard Android phone. This makes the solution suitable for video and image viewing such as a movie, but not dynamic tasks like office work, web surfing, or gaming.
First, a web stream must be set up.
FireWall
- Disable macOS firewall by Settings -> Network -> Firewall and toggle it off.
Now, VLC and OBS will be used together to create a local network stream. However, if audio is not needed, VLC alone will work.
VLC Network Stream
- Install VLC.
- In the top menu, under "File", press "Open Capture Device."
- Press "Input Devices" and change it to "Screen".
- Check the "Stream Output" box and press the "Settings" button across it.
- Press the round button next to "Stream" and enter your computer's local IP address upon the box next to "Address", findable via "ipconfig getifaddr en0" in the terminal ( How to know the IP address of a Mac when it is in network)
- Keep "Encapsulation Method" as MPEG TS.
- Press the checkbox next to "Video" and change it to h264.
- Now your stream is live. Do a test on your Android by the VLC Android app.
- In the VLC Android app, press the three-dotted "More", and then "New Stream", and enter
http://[local computer IP from earlier]:[Port set in steps 6~8, typically "1234"] - Let the VLC app wait for up to 1 minute. If it works, you can move on to the VR Android app.
Home Theater VR
Though the stream is a single video, for the side-by-side mirroring, it can be done via an app called "Home Theater VR."
- Install "Home Theater VR." In the app, press "Open Media" -> "Network Stream."
- In the textbox, enter "http://[local computer IP from earlier]:[Port set in steps 6~8, typically "1234"]", verified to be working from earlier, and press "open."
- Wait for up to 2 minutes, the buffer amount of video the app seems to require.
- If it works, congratulations. If not, it is most likely due to VLC encoding issues. For this particular VR app, the video feed seems to prefer TS + H264. Any other setting tends to lead to an error.
- If you get a single image, press the Google Cardboard icon. Now, despite most apps such as TrinusVR, iVRy, and VRidge being unable to mirror macOS to Google Cardboard (VRidge has an indirect method involving Sunshine/Moonlight), you have against all odds succeeded.
(Optional) OBS
In theory, if you use OBS's Virtual Camera instead of "Screen" in step 4 via keeping "Input Devices", pressing the checkbox next to "Video", and using "OBS Virtual Camera", you can stream the macOS screen. If a virtual method of capturing computer audio is used, this can allow an audio-video tandem screen, though I have not tried it yet.
I strongly recommend for individual movies or shows, to just use VLC -> File menu -> Convert/Stream -> use video as needed, and use "Video - H.264 + MP3 (MP4)" settings in "Choose Profile". Then press "Stream" -> and in Address, type in the local computer IP address from step 6. This typically allows audio streams, in real time instead of OBS + virtual microphone which may not always sync.
Conclusion
I don't know why this method works. Software works in mysterious ways. Rigorous rote testing is the key to finding the correct settings. If this becomes obsolete, in the future use VLC streams from macOS to Android as a testing ground before the VR app.