Saturday, April 26, 2014

ffmpeg and RTSP over TCP streams

ffmpeg, by default, will first try to connect to a given input RTSP stream over UDP and then revert to TCP if there is no UDP response. Unfortunately this switch in the transport protocol is not handled very well and some devices (e.g. DVRs and IP Cams) fail to correctly send back the stream over TCP.

In this cases ffmpeg should be forced to TCP mode only like this:
ffmpeg  -rtsp_transport tcp -i "rtsp://" -codec copy mydumpfile.mpg