Search code examples
c++ffmpegudpvideo-streaming

UDP Streaming with ffmpeg - overrun_nonfatal option


I'm working on a software which uses FFMPEG C++ libs to make an acquisition from an UDP streaming.

FFMPEG (1.2) is implemented and running but I get some errors (acquisition crashes and restarts). The log displays the following message:

*Circular buffer overrun. To avoid, increase fifo_size URL option. To survive in such case, use overrun_nonfatal option*

I searched online for documentation about how to use this option, but I only got informations about how to use when running directly ffmpeg executable.

Would someone know how to set the correct option in my C++ code to: - increase fifo_size - use overrun_nonfatal option

Thanks


Solution

  • The same option works from command line or C++ libraries, you need to modify your UDP URL as follows: If you original URL looks like this:

    udp://@239.1.1.7:5107
    

    Add the fifo_size and overrun parameters like this:

    "udp://@239.1.1.7:5107?overrun_nonfatal=1&fifo_size=50000000"
    

    Remember to escape the URL with quotes.

    overrun_nonfatal=1 prevents ffmpeg from exiting, it can recover in most circumstances.

    fifo_size=50000000 uses a 50MB udp input buffer (default 5MB)

    The only documentation is in the source code: http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavformat/udp.c;h=5b5c7cb7dfc1aed3f71ea0c3e980be54757d3c62;hb=dd0a9b78db0eeea72183bd3f5bc5fe51a5d3f537