Simple H264 Encoder and Decoder for HoloLens 2 using Media Foundation.
A sample Unity project (2020.3.42f1) can be found in the hl2av_unity directory. See the IPCSkeleton.cs script for an example of using the hl2av plugin in Unity. The example works as follows:
- The Unity App uses hl2ss to stream video from the HoloLens RGB camera over WiFi.
- The Python script viewer/test_hl2av_2.py receives the video stream, uses PyAV to re-encode the video, and sends it back to the Unity App running on the HoloLens.
- The Unity App uses the hl2av plugin to decode the stream, then re-encodes it and sends it back to the Python script running on the PC.
- The Python script uses PyAV to decode the video and displays it using OpenCV.
Build and run the sample project
- Open the project in Unity. If the MRTK Project Configurator window pops up just close it.
- Go to Build Settings (File -> Build Settings).
- Switch to Universal Windows Platform.
- Set Target Device to HoloLens.
- Set Architecture to ARM64.
- Set Build and Run on Remote Device (via Device Portal).
- Set Device Portal Address to your HoloLens IP address (e.g., https://192.168.1.7) and set your Device Portal Username and Password.
- Click Build and Run. Unity may ask for a Build folder. You can create a new one named Build.
This project is part of the hl2ss project.