Why I use gstreamer to decode stream, the frame rate may appear negative number ?

I used gstreamer to launch a camera stream. But I found the frame rate varied from negative number such as -6 to 25. when I connected another camera, it wouldn’t happen this phenomenon.

gst-launch-1.0 rtspsrc location=... protocols=4 ! decodebin ! nvvidconv ! autovideosink

the terminal like this:

nvidia@tegra-ubuntu:~$ gst-launch-1.0 rtspsrc location=rtsp://192.168.12.100:554/Onvif/live/4/1 protocols=4 latency=2000 ! decodebin ! nvvidconv ! autovideosink
Setting pipeline to PAUSED ...
Pipeline is live and does not need PREROLL ...
Progress: (open) Opening Stream
Progress: (connect) Connecting to rtsp://192.168.12.100:554/Onvif/live/4/1
Progress: (open) Retrieving server options
Progress: (open) Retrieving media info
Progress: (request) SETUP stream 0
Progress: (request) SETUP stream 1
Progress: (request) SETUP stream 2
Progress: (open) Opened Stream
Setting pipeline to PLAYING ...
New clock: GstSystemClock
Progress: (request) Sending PLAY request
Progress: (request) Sending PLAY request
Progress: (request) Sent PLAY request
NvMMLiteOpen : Block : BlockType = 261 
TVMR: NvMMLiteTVMRDecBlockOpen: 7907: NvMMLiteBlockOpen 
NvMMLiteBlockCreate : Block : BlockType = 261 
TVMR: cbBeginSequence: 1223: BeginSequence  2048x1536, bVPR = 0
TVMR: LowCorner Frequency = 345000 
TVMR: cbBeginSequence: 1622: DecodeBuffers = 9, pnvsi->eCodec = 4, codec = 0 
TVMR: cbBeginSequence: 1693: Display Resolution : (2048x1536) 
TVMR: cbBeginSequence: 1694: Display Aspect Ratio : (2048x1536) 
TVMR: cbBeginSequence: 1762: ColorFormat : 5 
TVMR: cbBeginSequence:1767 ColorSpace = NvColorSpace_YCbCr709_ER
TVMR: cbBeginSequence: 1904: SurfaceLayout = 3
TVMR: cbBeginSequence: 2005: NumOfSurfaces = 16, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1, BitDepthForSurface = 8 LumaBitDepth = 8, ChromaBitDepth = 8, ChromaFormat = 5
TVMR: cbBeginSequence: 2007: BeginSequence  ColorPrimaries = 1, TransferCharacteristics = 1, MatrixCoefficients = 1
Allocating new output: 2048x1536 (x 16), ThumbnailMode = 0
OPENMAX: HandleNewStreamFormat: 3464: Send OMX_EventPortSettingsChanged : nFrameWidth = 2048, nFrameHeight = 1536 
reference in DPB was never decoded
TVMR: FrameRate = 36 
TVMR: NVDEC LowCorner Freq = (414000 * 1024) 
TVMR: FrameRate = 24.459626 
TVMR: FrameRate = 25.006377 
TVMR: FrameRate = 24.955268 
TVMR: FrameRate = 25.006001 
TVMR: FrameRate = -6.213658 
TVMR: FrameRate = 4.150881 
TVMR: FrameRate = 25.005189 
TVMR: FrameRate = 24.956202 
TVMR: FrameRate = 25.006752 
TVMR: FrameRate = -2.770359 
TVMR: FrameRate = 2.267876 
TVMR: FrameRate = 24.954769 
TVMR: FrameRate = 25.006939 
TVMR: FrameRate = 25.007252 
TVMR: FrameRate = -1.782559 
TVMR: FrameRate = 1.559933 
TVMR: FrameRate = 25.007190 
TVMR: FrameRate = 25.007377 
TVMR: FrameRate = 25.007064 
TVMR: FrameRate = -1.314028 
TVMR: FrameRate = 1.188945 
TVMR: FrameRate = 25.007315 
TVMR: FrameRate = 25.007315 
TVMR: FrameRate = 24.954022

Hi ClancyLian,
FrameRate is calculated based on timestamps. So it looks like sometimes rtspsrc does not give correct timestamps. It must not happen in local video file playback.

I think i also had encounter the same problems relating to the frame rate too.

My pipeline like this: rtspsrc ! decodebin ! nvvidconv ! nvvideosink, and i get the frames via EGL stream with mailbox mode.

As time goes on, video delay grows, and the process’s memory also grows.

The camera output 2048x1536 h264 video stream at about 25fps, and the camera and tx2 both connected to the same ethernet, the stream bitrates about 3Mbps, so the network latency can be excluded.

I examine the usage via tegrastats, the CPU/GPU/NVDEC reports low usage. After running for some time, the EGL stream state often not in EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR state.

So, i think the problem is the decoder output lower frame rate than actually is.

Hi SongjianSu, please make a new post about your issue. This post is not about EGL stream and nvvideosink.