Skip to content

Video track.Data.Video.FrameRateNum = 0 for RTSP

For RTSP, track.Data.Video.FrameRateNum is always zero and track.Data.Video.FrameRateDen is always 1. The audio channels/rate and video height/width is correct. I've tested this with four different videos being streamed on the local network and two videos on the internet. Official VLC player displays the frame rate for the RTSP streams.

When playing multiple MP4s from disk or multiple http files from the internet (https://gist.github.com/jsturgis/3b19447b304616f18657), the track.Data.Video.FrameRateNum is non-zero after the first or second pass.

Below is the code that is called every second until FrameRateNum is not zero. Am I supposed to do something differently for RTSP?

VLC log files are attached.

Thank you

    public async void GetMediaInfo()
    {
        await _mediaPlayer.Media.Parse(MediaParseOptions.ParseNetwork);

        foreach (var track in _mediaPlayer.Media.Tracks)
        {
            switch (track.TrackType)
            {
                case TrackType.Audio:
                    Debug.Log(System.DateTime.Now.ToString() + $" {nameof(track.Data.Audio.Channels)}: {track.Data.Audio.Channels}" + $" {nameof(track.Data.Audio.Rate)}: {track.Data.Audio.Rate}");
                    break;
                case TrackType.Video:
                    Debug.Log(System.DateTime.Now.ToString() + $" {nameof(track.Data.Video.FrameRateNum)}: {track.Data.Video.FrameRateNum}" + $" {nameof(track.Data.Video.FrameRateDen)}: {track.Data.Video.FrameRateDen}");
                    Debug.Log(System.DateTime.Now.ToString() + $" {nameof(track.Data.Video.Height)}: {track.Data.Video.Height}" + $" {nameof(track.Data.Video.Width)}: {track.Data.Video.Width}");
                    if (track.Data.Video.FrameRateNum > 0)
                    {
                        mediaInfoPending = false;
                    }
                    break;
            }
        }
    }

rtsp_01.log

rtsp_02.log

rtsp_03.log

rtsp_04.log

http_01.log

http_02.log