[FFmpeg-user] FFmpeg as a "service" with nginx

James Greenlee james at madsonics.com
Thu Sep 26 14:54:21 EEST 2024


Hello all, 

I'm looking at trying to "distribute" some Axis cameras to various endpoints. The thought process I have on this is to startup an NginX instance, have a process(es) that connect to the Axis cameras (RTSP), and then mount those feeds to NginX RTMP points. From there I should be able to push/pull etc these feeds to where I need them. 

While NginX provides some of these functions (for example "exec_pull"), it seems a little inefficient to do so. First off, it only establishes a connection to the cameras when somebody connects to the RTMP mount point. I would rather have the mount point already be there. Then there's keeping the quantity of NginX workers down, and managing the ffmpeg sessions. 

It seems to me that starting ffmpeg outside of NginX and managing it as a system service makes sense. I would want ffmpeg to start on system startup and recover automatically if the ffmpeg instance crashes, or if there's a disruption to the connection to the cameras. 

I've had some success with this, but it's not as robust or reliable as I'd like. This is most definitely "skill issue" on my part as my knowledge about ffmpeg and systemd is just not deep enough. 

I'm open to suggestions about how to do this or some suggestions about how to get ffmpeg working properly as a service. 

Thanks!! 

James 


More information about the ffmpeg-user mailing list