1

i have about 10-15 FFmpeg Process for streaming server like this:

ffmpeg -i "http://ip/play/a03i" -vcodec copy -acodec copy -f flv "rtmp://ip:80/APP/Name"

am use the Nginx-rtmp module to run it using the exec_static Directive but i can't monitoring every channels or process, can't stop start restart edit any stream without stop all channels

any idea Please?

Best,

Mohammed
  • 11
  • 2

1 Answers1

0

Try with something like (this is in PHP but you can use similar procedure from other scripts):

                    $cmd = "ps aux | grep '-vcodec copy -acodec copy -f flv'";
                    exec($cmd, $output, $returnvalue);

                    $transcoders = 0;
                    foreach ($output as $line) if (strstr($line, "ffmpeg"))
                        {
                            $columns = preg_split('/\s+/',$line);

                            if ($kill) //customise this to kill a process
                            {
                                $kcmd = 'kill -KILL ' . $columns[1];
                                exec($kcmd, $koutput, $kreturnvalue);
                            }
                         }

Functionality is inspired from a WP Videochat Plugin that has a backend section for monitoring and killing FFMPEG processes (used for transcoding live streams for HLS playback and generating snapshots from streams).

TopReseller
  • 101
  • 2