Trying to capture video from Azure Kinect using VideoCapture.

I am trying to record a video in my scripts from Azure Kinect using VideoCapture class here: Unity - Scripting API: VideoCapture (unity3d.com)
It raised error when stop recording:

and nothing was written into the file.
The Kinect sensor is the only camera attached on my desktop.
It runs just like the Kinect device not there, I got the same output when I unplugged the Kinect.
I tried the Camera App, my Kinect work like a normal webcam.

Anyone here can show me way out? Thanks in advance!

From what I can see Failed to stop recording: VideoCapture is in an erroneous state mean an error happen during the recording but it only tells you about it when you call StopRecording. So the issue doesn’t seem to be when you stop but while recording. Are you doing something special while recording? Can you show us what you are doing in your code?

using UnityEngine;
using System.Collections;
using System.Linq;
using UnityEngine.Windows.WebCam;

public class VideoCaptureExample : MonoBehaviour
{
    static readonly float MaxRecordingTime = 10.0f;

    VideoCapture m_VideoCapture = null;
    float m_stopRecordingTimer = float.MaxValue;
    bool stopped = false;

    // Use this for initialization
    void Start()
    {
        StartVideoCaptureTest();
    }

    void Update()
    {
        if (m_VideoCapture == null || !m_VideoCapture.IsRecording)
        {
            return;
        }

        if (Time.time > m_stopRecordingTimer && !stopped)
        {
            stopped = true;
            m_VideoCapture.StopRecordingAsync(OnStoppedRecordingVideo);
        }
    }

    void StartVideoCaptureTest()
    {
        Resolution cameraResolution = VideoCapture.SupportedResolutions.OrderByDescending((res) => res.width * res.height).First();
        Debug.Log(cameraResolution);

        float cameraFramerate = VideoCapture.GetSupportedFrameRatesForResolution(cameraResolution).OrderByDescending((fps) => fps).First();
        Debug.Log(cameraFramerate);

        VideoCapture.CreateAsync(false, delegate (VideoCapture videoCapture)
        {
            if (videoCapture != null)
            {
                m_VideoCapture = videoCapture;
                Debug.Log("Created VideoCapture Instance!");

                CameraParameters cameraParameters = new CameraParameters();
                cameraParameters.hologramOpacity = 0.0f;
                cameraParameters.frameRate = cameraFramerate;
                cameraParameters.cameraResolutionWidth = cameraResolution.width;
                cameraParameters.cameraResolutionHeight = cameraResolution.height;
                cameraParameters.pixelFormat = CapturePixelFormat.BGRA32;

                m_VideoCapture.StartVideoModeAsync(cameraParameters,
                    VideoCapture.AudioState.ApplicationAndMicAudio,
                    OnStartedVideoCaptureMode);
            }
            else
            {
                Debug.LogError("Failed to create VideoCapture Instance!");
            }
        });
    }

    void OnStartedVideoCaptureMode(VideoCapture.VideoCaptureResult result)
    {
        Debug.Log("Started Video Capture Mode!");
        string timeStamp = Time.time.ToString().Replace(".", "").Replace(":", "");
        string filename = string.Format("TestVideo_{0}.mp4", timeStamp);
        string filepath = System.IO.Path.Combine(Application.persistentDataPath, filename);
        filepath = filepath.Replace("/", @"\");
        m_VideoCapture.StartRecordingAsync(filepath, OnStartedRecordingVideo);
    }

    void OnStoppedVideoCaptureMode(VideoCapture.VideoCaptureResult result)
    {
        Debug.Log("Stopped Video Capture Mode! result: " + result);
    }

    void OnStartedRecordingVideo(VideoCapture.VideoCaptureResult result)
    {
        Debug.Log("Started Recording Video! result: " + result);
        m_stopRecordingTimer = Time.time + MaxRecordingTime;
    }

    void OnStoppedRecordingVideo(VideoCapture.VideoCaptureResult result)
    {
        Debug.Log("Stopped Recording Video! result: " + result);
        m_VideoCapture.StopVideoModeAsync(OnStoppedVideoCaptureMode);
    }
}

I don’t see any issue with your code. From my understanding, the Kinect is not officially supported by Unity. If you say that the Kinect doesn’t seem to open when connected to Unity, my guess would be that you need to install an SDK for your Kinect. The SDK is here under NuGet and Unity Pro add-ons. Try this and reach out if you still have issue.