currently, I am working on a project where I need to run rtsp to rtmp conversion using ffmpeg. but some how I am getting error after several minutes running the process and the process getting exited.
I want to run the process even if it gets error. I am using this command ffmpeg -re -rtsp_transport tcp -i rtsp://my-link -c:v copy -c:a aac -ar 44100 -ac 1 -f flv -flvflags no_duration_filesize rtmp://my-url
I tried this bash script.
#!/bin/bash
cmd="ffmpeg -re -rtsp_transport tcp -i $1 -c:v copy -c:a aac -ar 44100 -ac 1 -f flv -flvflags no_duration_filesize $2"
while true; do $cmd && break; done
using this script I am able to run the process again if I get any error. but the problem is it doesn't stop even if I run kill -9 my-pid
. it just re-runs the process.