ffmpeg monitor and restart stream when it hung or stall
You are using ffmpeg to stream to youtube but after a while, it hung or stuck. You want to restart the streaming command when this happens.
First run the ffmpeg
command on a terminal in a while loop (this example is for fish terminal)
This will run the stream and output it to a log.txt
run this script on separate terminal to monitor and restart ffmpeg process
Basically it take some line from the log, and do it again after 30 seconds.
If the line stays the same, it assume that the stream stuck and kill the ffmpeg
process
Last updated