Zend certified PHP/Magento developer

How to record variable framerate with a BASH tool

I’m trying to detect frames being dropped by IP cameras over RTSP streams, in order to determine the health of the network stream. The way I’ve come up with to do this is to record a 10 second clip from the stream, then count the total frames. Since I know the expected FPS and the video length, I can tell how many frames I should get, and if I’m losing any.

The issue I’m having is that I’m not able to record a video that allows for fluctuations in the FPS. I’ve been trying to use ffmpeg so far, but all the options I’ve tried have resulted in a video with a constant framerate. This is my most recent attempt:

ffmpeg -y -t 10 -i 'rtsp://camera/ip/here' -map 0:v -vsync 2 -filter:v fps=10 -max_muxing_queue_size 9999 clip.mp4

I am not familiar with ffmpeg, so I don’t know if what I want is even possible with this tool. I also don’t know if .mp4 is the right video format to use for this. Is there an option for ffmpeg that will accomplish what I’m looking for? Or is there another package that can do it?