Skip to content

Instantly share code, notes, and snippets.

@KhaosT
Last active May 9, 2024 08:11
Show Gist options
  • Save KhaosT/e9b60fc0fb99b9f4512759b953cbf38c to your computer and use it in GitHub Desktop.
Save KhaosT/e9b60fc0fb99b9f4512759b953cbf38c to your computer and use it in GitHub Desktop.
Guide for using Apple Vision Pro as HDMI display

Displaying HDMI sources on Apple Vision Pro

While it's possible to stream most content to Apple Vision Pro directly over the internet, having the ability to use Apple Vision Pro as an HDMI display can still be useful.

Since Apple Vision Pro does not support connecting to an HDMI input directly or using an HDMI capture card, we have to be a little creative to make this work. NDI provides the ability to stream HDMI content over a local network with really low latency, and it works great with Apple Vision Pro.

This page shows the setup I’m using.

What’s needed

  • HDMI NDI Encoder
    • Personally, I recommend the Kiloview N40, as it supports streaming up to 4K60 while being fan-less, and can use USB-C as a power input.
    • Kiloview N60 comes with more features, but it’s larger and has a fan.
  • Vxio app
    • I made this one, you can also use other NDI monitor apps as well.
    • Separately, Finn made Castaway that makes it possible to use a USB Capture Card + Mac/iPad instead of an NDI encoder. It's a more cost effective option for most people I imagine.

Things to consider

  • To ensure high video quality, an NDI stream typically consumes significantly more bandwidth than a typical H.264/H.265 stream. Before purchasing the encoder, make sure your network can support data transfers at that speed.
    • For 4K60 stream, the bandwidth required is typically around 250~300mbps. If you're having issue to stream smoothly, try go to the encoder's settings page and reduce the streaming quality.
    • You can test this with some free software NDI encoders.
  • Since this setup requires encode and decode the video content, it is not latency free. From my experience, I typically see 3~4 frames (~50ms, same as moonlight based on my measurement) of delay from the content source.

Setup

Setting up an NDI encoder is pretty straightforward. Just connect the device to your local network via Ethernet, supply power, and connect the HDMI input to the encoder.

If the visionOS shows the Local Network permission dialog, and after granting the permission the app still shows searching, you may need to force close the app, and reopen it.

After that, you should be able to see the encoder show up as a source in the Vxio app. Select the source, and you'll get your HDMI display 🎉

Screenshot

Misc

Adjusting audio queue size

Depending on the NDI encoder, the default audio queue size might be too small for some devices. In that situation, try increasing the audio queue size so that the audio no longer experiences abrupt stops between samples.

Disable Multi-TCP

If your Wi-Fi channel is congested, you can try force N40 to use UDP instead of Multi-TCP. In my experience, UDP performs a lot better in those network condition. You can do so from the N40's configuration UI, select NDI Connection -> Multi-TCP Disallowed.

UDP

Portable setup

I was able to make this setup portable by getting one of those mini router (GL.iNet Beryl AX) with a LAN port.

IMG_3978 IMG_3979

#AppleVisionPro #visionOS

@IceNum
Copy link

IceNum commented Mar 30, 2024

@lucid-max Yeah sure. Apple toolchain encodes the target platform information in the binary, and the linker will check that to see if something can be linked to your app. Since iOS and visionOS are from the same origin, and the underlying APIs are identical, it's possible to override the platform information to make iOS SDK linkable by the visionOS target. You can read more about how people does that from this article (https://bogo.wtf/arm64-to-sim.html, you need to change the target platform, instead of iOS simulator, change it to visionOS and visionOS simulator).

This technique is useful for using third party binary libraries on visionOS, as most of those have iOS slices that can be repurposed for visionOS without the vendor to do things on their side.

I have no success converting ios.a to visionos.a file,Can you provide a visionos.a file for me to test? Thank you so much!

@KhaosT
Copy link
Author

KhaosT commented Mar 30, 2024

Unfortunately NDI’s SDK license agreement prevents me from redistributing their SDK so I won’t be able to upload that. What are the issues you ran into when trying to update LC_BUILD_VERSION’s platform information?

@IceNum
Copy link

IceNum commented Mar 30, 2024

image

I regenerated the visionos arm64 files. After integration, an error message about missing files appeared.

@KhaosT
Copy link
Author

KhaosT commented Mar 30, 2024

Do I only need to modify the platform information in these places?

Swapping platform should be sufficient.

I regenerated the visionos arm64 files. After integration, an error message about missing files appeared.

I didn't see this one in my conversion. When you repackage all the .o files, are you sure you included all of them?

@IceNum
Copy link

IceNum commented Apr 3, 2024

我只需要修改这些地方的平台信息就可以了吗?

交换平台应该足够了。

我重新生成了visionos arm64 文件。集成后,出现有关丢失文件的错误消息。

我在转换中没有看到这一点。当您重新打包所有 .o 文件时,您确定已包含所有这些文件吗?

Thank you

@Yamhao
Copy link

Yamhao commented Apr 6, 2024

Vxio app support NDI 6? N60 will support it with HDR feature. Thanks

@KhaosT
Copy link
Author

KhaosT commented Apr 6, 2024

@Yamhao yeah I plan to update it to support NDI 6. I’m waiting for N60 firmware update so I can test the support with a real thing before releasing the update.

@Yamhao
Copy link

Yamhao commented Apr 7, 2024

@Yamhao yeah I plan to update it to support NDI 6. I’m waiting for N60 firmware update so I can test the support with a real thing before releasing the update.

Wow!
I just bought N40 yesterday, and suddenly found N60 will support NDI6:(

@lightsailvr
Copy link

This is very cool - I'd be interested in collaborating on how to use NDI to display the video feed on a sphere for immersive video capture. This gives us immersive filmmakers a live preview on set. Would be similar to the app I made called VR.NDI (https://docs.google.com/document/d/1vFI9pNKhtdONcOa6RQ1Aa9w2iIXYvvgoHLlu42WtMyk/edit?usp=sharing) but for Apple Vision Pro. The current implementation of NDI I am using in Unity doesn't translate to Vision Pro sadly, plus I think a native approach would offer better performance.

@KhaosT
Copy link
Author

KhaosT commented Apr 7, 2024

@lightsailvr displaying NDI stream on a sphere is actually relatively straightforward, the app has all the necessary stuff integrated with RealityKit to make it work (right now it's only used to project it on a 3D model, you can check it out by long pressing on the NDI source and select Retro to see that). The challenge in this case is actually Vision Pro's terrible Wi-Fi performance... It can barely stream NDI|HB 4K right now, and I'm not sure it can do 8K+ over NDI for 360 videos without lagging all the times 😅

@jordainfg
Copy link

jordainfg commented Apr 16, 2024

Hi @KhaosT also left you a email. But maybe here’s easier to exchange thoughts.

  • A bit nitpicky, but adding rounded corners like Moonlight would be a very nice attention to detail.
  • 4K upscaling similar to Casteaway (with a toggle for non-4K inputs), making it possible to use more affordable NDI's like the Zowietek. And using less bandwidth by upscaling a 1080p 60fps input instead. I saw that Finn made the upscaler open-source. https://github.com/finnvoor/fx-upscale

@matte-schwartz
Copy link

looking forward to the upcoming NDI 6 update, would be happy to contribute to an NDI 6.0 SDK fund to get HDR encoding if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment