[FFmpeg-user] Stopping FFmpeg automatically when no UDP packets are being received

Moritz Barsnick barsnick at gmx.net
Tue Jun 27 11:06:50 EEST 2017


On Tue, Jun 27, 2017 at 07:54:12 +0000, Victor Odouard wrote:
> ffmpeg -i udp://239.0.0.1:1234 output.ts
> 
> However, when I stop receiving packets, I want ffmpeg to stop running.
> Otherwise, it blocks the rest of the program.

Do have a look at the documentation:
https://www.ffmpeg.org/ffmpeg-protocols.html#udp

I haven't tried, but it sounds like the "timeout" option is made for
you:

  ‘timeout=microseconds’

      Set raise error timeout, expressed in microseconds.

      This option is only relevant in read mode: if no data arrived in
      more than this time interval, raise error.

Cheers,
Moritz


More information about the ffmpeg-user mailing list