My software needs to connect to each surveillance camera every few hours to get a picture for analysis. I use this command to connect via RTSP
ffmpeg -rtsp_transport tcp -t 10 -reorder_queue_size 10M -stimeout 10000000 \ -i [stream URI] -vframes 1 -fps 25 -vsync 2 -ss 2 -y vid.mp4
I'm noticing the behavior that FFmpeg (also VLC) are always able to connect to the camera (the cameras are all definitely live) but about 10-20% of the time they'll error out when trying to get an image. Otherwise, this command works with no problem.
Things I've tried at times when FFmpeg fails:
- (1) adding
-probesizeto their max values, but to no avail
- (2) Connecting to the camera directly with RTSP commands over telnet. I notice that the output from DESCRIBE seems like it's missing information compared to when it does work.
- (3) The error from FFmpeg says that it is unable to set up the feed because it's missing information.
Question: where is the lack of predictability coming from? I am able to connect to 100% of the cameras, but only 80-90% of the time.
This happens with ONVIF cameras, as well as rtsp streams provided by the DVR manufacturer for analog cameras. I'd think it wouldn't matter because they both provide RTSP links... Can this be a manufacturer dependent question?