Search Unity

Resolved Hololens 2, webcam recording only captures 1 second

Discussion in 'AR' started by G_K, Nov 16, 2020.

  1. G_K

    G_K

    Joined:
    Jan 12, 2014
    Posts:
    6
    Using a UWP and 2019.4.8f1, and I'm essentially using this example code with some additional logging: https://docs.unity3d.com/ScriptReference/Windows.WebCam.VideoCapture.html
    I've tried it with the default of 5 seconds, and I've also tried increasing it to 15, or 30 seconds.

    I have debug logs in the OnStartedVideoCaptureMode and OnStoppedVideoCaptureMode tracking the timestamps and it's correct for what I'm expected. I'm also logging the capture result which is always successful.

    I also see the small red recording camera icon for the expected amount of time(5+ seconds)

    It seems the videos being recorded are always about 1 second and are either 4.7 or 4.8mbs every time.

    Any help would be appreciated
     
  2. unity_8R3gaxreN6dMTA

    unity_8R3gaxreN6dMTA

    Joined:
    Apr 9, 2018
    Posts:
    3
    Believe it or not, developers don't have access to raw HoloLens sensor streams, including the photo / video camera via the MRTK SDK apart from saving an mp4 or taking single pictures. To achieve this, the device needs to be in research mode to access raw sensor streams using the HoloLensForCV API: github.microsoft/HoloLensForCV.

    I got it working in Unity using this repo:

    github.doughtmw/ArUcoDetectionHoloLens-Unity

    This guy did all the work of building and including the dlls and winmd file into a Unity project. Just build the project in Unity and then in Visual Studio. Google ARUco marker images to test it working on the device. To edit the code in the #if WINMD_ENABLE blocks you will need to enable Edit -> Preferences -> External Tools -> Player projects, and then Regenerate project files.

    Use the device's IP address to enable research mode via the browser portal under System -> Research Mode.
     
unityunity