[FFmpeg-user] Occasional corruption when streaming over UDP on localhost

Jonathan Viney jonathan.viney at gmail.com
Thu Jan 9 00:18:33 EET 2020


Hi everyone,

I am attempting to receive an RTSP stream, save it to disk, and also make
it available for other consumers to use on the same machine. Eg:

Process 1:
ffmpeg -rtsp_transport tcp -i rtsp://10.1.1.1:554/stream.asp -c copy -y
direct-copy.ts -c copy -f mpegts "udp://127.0.0.1:2345"

Process 2:
ffmpeg -f mpegts -i udp://127.0.0.1:2345 -c copy -y udp-out.ts

The problem is that the file captured by process 2 over UDP has occasional
corruption. The file written directly to disk by process 1 is correct.

I experimented with using the new zmq capabilities, and that worked fine
with both TCP and IPC transports.

Process 1:
ffmpeg -rtsp_transport tcp -i rtsp://10.1.1.1:554/stream.asp -c copy -y
direct-copy.ts -c copy -f mpegts "zmq:ipc:///tmp/feed1"

Process 2:
ffmpeg -f mpegts -i "zmq:ipc:///tmp/feed1" -c copy -y zmq-out.ts

The file captured with ZMQ does not have any corruption. Is there a way to
achieve a valid stream using UDP?

Cheers,
-Jonathan.


More information about the ffmpeg-user mailing list