0

I have a 25FPS RTSP stream coming from an IP-camera. I can successfully display the video stream. But when analyzing the stream with ffmpeg (ffprobe actually), I observe fewer frames per second rate:

$ ffprobe -rtsp_transport tcp -i rtsp://camera_ip:554/stream -select_streams v:0 -show_frames -show_entries frame=coded_picture_number,pkt_pts_time -of csv=p=0
Stream #0:0: Video: h264 (Main), yuvj420p(pc, bt709, progressive), 640x480, 25 fps, 25 tbr, 90k tbn, 50 tbc
0.400000,0
0.080000,1
0.120000,2
0.200000,3
0.240000,4
0.320000,5
0.360000,6
0.440000,7
0.480000,8
0.560000,9
0.600000,10
0.680000,11
0.720000,12
0.800000,13
0.840000,14
0.920000,15
0.960000,16
1.040000,17
1.080000,18
1.160000,19
1.200000,20
1.280000,21
1.320000,22
1.400000,23
1.440000,24
1.520000,25
1.560000,26
1.640000,27
1.680000,28
1.760000,29
1.800000,30
1.880000,31
1.920000,32
2.000000,33

We can clearly see the 80ms gap between some of the frames, resulting in a ~16fps stream.

I have observed the same framerate issue with GStreamer (printing information in the rtpjitterbuffer indicates the frame gap is sometimes 80ms and sometimes 40ms). But the weird thing is, I encountered the same issue with an HDMI-RJ45 decoder, and I doubt the same issue comes from 2 different devices. I didn't get much more informations using -loglevel debug or trace. Does anybody have an idea about what is going wrong in the stream ?

(I used ffprobe 4.2.3 and the last "2021-05-09-git-8649f5dca6-full_build-www.gyan.dev" with the same results, and GStreamer 1.16.2 with a pipeline like "urisourcebin ! h264depay ! h264parse ! fakesink")

EDIT: The camera skipping of frames was caused by the activation of a third stream in the options. I find it really weird that it skips exactly the same frames every seconds. However, I still haven't found the cause of the downrate on my RTSP encoder. Anyway, this was actually hardware related and not software related.

Krapow
  • 611
  • 6
  • 26
  • Are you sure that the camera works on 25fps static? Might fps is dynamic? It seems that the issue is from the camera side. I would also try some rtsp options/flags (eg. udp?) – SuRGeoNix May 12 '21 at 10:42
  • There is no mention of dynamic FPS... The issue may come from the camera: setting encoding to H264+ fix the FPS issue, and I did not observe the issue in a camera purchased a year earlier than the one I work on... – Krapow May 12 '21 at 13:08
  • I’m voting to close this question because it turns out it was actually hardware related; despite the odds pointing to a software issue. – Krapow May 17 '21 at 09:11

1 Answers1

0

Cameras, especially cheap ones, skip frames sometimes when they can't keep up with the encoding. The camera, not GStreamer, ffmpeg, or other software, is responsible for the skipped frames. It's more or less normal.

O. Jones
  • 103,626
  • 17
  • 118
  • 172
  • You are right, but the encoder still has almost the same issue. Anyway, it is probably a bug on their side and I am currently exchanging with the provider support. The weird thing about these dropped frame is that it is very regular, that's what made me thought of a software issue on my side. – Krapow May 17 '21 at 09:13