none
Kinect v2 Video framerate RRS feed

  • General discussion

  • We want to record color videos. To this end we grab the color frames and record them into a video using the VideoWriter included Emgu (managed opencv). This works okay I guess, but I'm worried about the FPS. It is stated that the Kinect v2 switches between 15 and 30 FPS depending on the lighting conditions. When recording a movie (at least using Emgu) the framerate needs to be fixed.

    Is there some way to detect in what mode the color stream is running? If I choose to record 15 FPS only it would be nice to drop any extra frames that are generated once in a while because the camera switches to 30 FPS.

    As an aside, does anyone have better (managed) solutions for recording the color stream? Our output is currently 960x540 and uncompressed YUV due to performance constraints. It would be nice to have some better compression.

    Friday, August 22, 2014 9:09 AM

All replies

  • There is no direct api to know which framerate it is running at given the runtime still runs at 30fps(depth, it, body tracking). The color frames are just arriving at 15fps of that 30fps. You would have to create your own fps counter, see samples, to determine that and adjust accordingly.

    Carmine Sirignano - MSFT


    Monday, August 25, 2014 7:02 PM
  • Have you found a solution for this issue ?
    I am having this same problem to save the color videos since they can change the FPS. 

    If you found a solution, could you share it?

    Thanks.

    Friday, June 12, 2015 3:57 PM
  • Hey everyone,

    You can calculate the ColorCamera's current FPS each time that you acquire a ColorFrame usings its FrameInterval property:

    double fps = 1.0 / frame.ColorCameraSettings.FrameInterval.TotalSeconds;

    A full code sample:

    KinectSensor sensor = KinectSensor.GetDefault();
    ColorFrameReader reader = sensor.ColorFrameSource.OpenReader();
    reader.FrameArrived += FrameArrivived;
    
    private void FrameArrived(object sender, ColorFrameArrivedEventArgs args)
    {
        using (var frame = args.FrameReference.AcquireFrame())
        {
            // The camera is either running at 30 fps (33.33ms interval) or 15 fps
            // (66.66ms interval), in case of low lighting conditions.
            // In order to keep a steady frame rate we duplicate frames when we
            // are running at 15 fps.
    
            double fps = 1.0 / frame.ColorCameraSettings.FrameInterval.TotalSeconds;
    
            if (frame != null)
            {
                WriteFrame(frame);
    
                // Write a frame twice if we are in 15 FPS mode, to keep a steady
                // 30 FPS video stream
                
                if (fps < 29)
                {
                    WriteFrame(frame);
                }
            }
        }
    }


    My programming blog: http://roy-t.nl (Mostly, C#, XNA, and tips and tricks)


    • Edited by roy-t Tuesday, June 16, 2015 7:20 AM
    Tuesday, June 16, 2015 7:18 AM
  • Dear Roy,

    I want to get information about the frame rates at which my system is working. I have used the above code for Kinect v2 but it is not working. Can you please suggest some corrections?. It will be helpful for me.


    Navati

    Thursday, January 9, 2020 10:05 AM
  • hi naveen,

    I don't think your solution should work, enven you get the fixed fps, you can't actively set VideoWriter's recording param. Maybe you can use ffmpeg as the video recorder, in this way you don't have to worry about framerate.


    • Edited by cylonce Tuesday, June 30, 2020 9:25 AM wrong name
    Tuesday, June 30, 2020 9:02 AM