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

Victor Odouard vicviodlogin at gmail.com
Tue Jun 27 10:54:12 EEST 2017

I am writing a program in which I am using a udp stream as an input and
outputting a simple .ts file. I am using this command within the program:

ffmpeg -i udp:// output.ts

However, when I stop receiving packets, I want ffmpeg to stop running.
Otherwise, it blocks the rest of the program.

I read about different ways to make the command run in the background,
which would be fine except the next part of the script uses the output file
to do other stuff.

So, is there any way to make ffmpeg stop automatically when udp packets
stop arriving? And if there isn't a "conventional" way to do it, do you
know of any workarounds?


More information about the ffmpeg-user mailing list