ffmpeg: Record rtsp stream to disk in realtime and put black frames when rtsp times out

0

I need to record a rtsp video stream to disk in real time. This works nice and well with something like this(tcp not udp):

ffmpeg -i rtsp://@stream -acodec copy -vcodec copy -movflags frag_keyframe+empty_moov -f mp4 test.mp4

The source stream is done with a matrox HDX card that gets video and audio from an SDi cable.

Sadly the stream isn't 100% reliable (I suspect the internet connection and not the matrox HDX) and sometimes just times out for a bit. It is extremely crucial for me though that all the "timestamps" are intact. This means when I don't get data for 20s I want ffmpeg to write 20s of black video with 0 audio. Now it just stops the recording with a "connection timed out" thingy.

rtsp://@stream: Connection timed out

Is that somehow possible with ffmpeg? Did anyone ever achieve this? If not: is there another solution where it is possible?

Michel Chanton

Posted 2017-11-30T15:15:53.593

Reputation: 1

No answers