[FFmpeg-user] Fault-tolerant multicast UDP streaming

Sam Gardner samgardner90 at gmail.com
Tue Jan 13 00:52:00 CET 2015

I am using ffmpeg to capture an input video feed from a capture device,
save to disk, and relay the feed via udp to a host machine. When the
network is down, i.e. an unplugged cable, or faulty switch, or the host is
down, ffmpeg crashes with:

"[mpeg1video @ 0x2fdcb20] ignoring invalid SAR: 0/0 Last message repeated
38 times av_interleaved_write_frame(): Network is unreachable frame= 758
fps= 25 q=1.0 size= 616kB time=00:00:30.24 bitrate= 166.7kbits/sframe= 758
fps= 25 q=1.0 Lsize= 616kB time=00:00:30.24 bitrate= 166.7kbits/s
video:616kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.000000% Conversion failed!"

When the network crashes, this also crashes the saving to disk.
Unfortunately my capture device cannot handle multiple simultaneous access
so I can't split this into two processes (easily).

I would like to make the UDP streaming fault tolerant to continue trying to
stream the next frame if it can't send any packets - the process should not
exit. Surely this has happened to other ffmpeg users who are using headless
media servers? I don't want to use a daemon to restart the process as this
will cause more headaches dealing with the frames saved to disk - they
would be split to separate files on every frame! I have tried the tee muxer
but I can't make the child processes continue if one of them fails.

Is there a flag I can set to continue/ignore the "Network is unreachable"
exception thrown?

I'd like to do this without making a custom build of ffmpeg, but if anyone
has tried this before I would appreciate any pointers.


Sam Gardner

More information about the ffmpeg-user mailing list