使用supervisor守护ffmpeg进程


由于信源的不稳定,导致我的B站直播ffmpeg总是自动退出,每次手动启动好麻烦,因此,计划使用supervisor对其进行守护。

1、安装supervisor

sudo dnf -y install supervisor

2、配置supervisor

在/etc/supervisor.d文件下创建一个ffmpeg.ini,配置内容如下:

[program:ffmpeg_multi_1]
directory = /root/ffmpeg-4.4-amd64-static
command = /root/ffmpeg-4.4-amd64-static/ffmpeg -i udp://10.252.59.93:6666 -c copy -f mpegts srt://10.80.25.59:10080?mode=caller&latency=200
autostart = true
startsecs = 5
autorestart = true
startretries = 999999
user = root
redirect_stderr = true
stdout_logfile_maxbytes = 50MB
stdout_logfile = /var/log/supervisor_ffmpeg_1.log

3、启动supervisor

sudo systemctl start supervisord.service

4、控制supervisor的任务

通过sudo supervisorctrl对supervisor守护的程序进行手动控制

,

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注