How To Automatically Restart FFmpeg Linux On Error

How To Automatically Restart FFmpeg Linux On Error

Here is example ffmpeg restart script.

Create new script, for example ffmpeg_start.sh and make that script executable:

# chmod +x  ffmpeg_start.sh

Edit file ffmpeg_start.sh and add next commands:

#!/bin/bash
cmd="ffmpeg YOUR_FFMPEG_COMMAND"
until $cmd > /dev/null 2>&1 < /dev/null; do
echo "restarting ffmpeg command..."
sleep 2
done

Do not forget edit YOUR_FFMPEG_COMMAND.

Then run:

# ./ffmpeg_start.sh

 


 

 

If you like what you are reading, please:

Buy me a coffeeBuy me a coffee

arstech

Leave a Reply