[FFmpeg-user] Autolaunch FFMPEG when network traffic detected

Anthony Griffiths neuronetv at gmail.com
Mon Jul 23 19:39:08 EEST 2018

On Mon, Jul 23, 2018 at 4:34 PM, yannickb <ybarbeaux+ffmpeg at gmail.com> wrote:
> Yes, I should have started with the setup description:
> I have several (i)Phones that send mpeg-ts/udp video stream over LTE to a
> debian 9.0 computer with a Blackmagic Decklink Quad with up to 8 SDI output.
> I link each phone to a SDI Output.
> from the command line, I manually launch an instance of ffmpeg for each
> stream received:

ok so you need to get ffmpeg to log its output. This can be done two
ways (without thinking much)

1) # ffmpeg <rest of command> 2>&1 | tee ffmpeg.log
2) use an init script to start ffmpeg - one that creates a pid and a
log file at the same time. I may be able to help if you don't have a

> One ugly solution would be to launch all ffmpeg at boot and let them run but
> if one stream is interrupted (a phone stops its stream for a while), when it
> resumes, ffmpeg has audio problems (no sound at all), so I have to restart
> ffmpeg manually to address this issue. I should investigate this problem
> too.

this is not so ugly. monit can watch the log file (above) being
created by ffmpeg. If the stream is interrupted that should show up in
the log. You can configure monit to recognise the string that shows up
in the log and then monit will stop and restart ffmpeg as outlined in
my previous reply.

ps: when a stream starts from the phone surely something appears in

one other solution would be wireshark.
# /usr/sbin/tshark -f "tcp port <port-number>" 2>&1 | tee /var/log/tshark.log
this would create a log of all traffic coming from <port number> -
maybe monit could watch that....

More information about the ffmpeg-user mailing list