I'm using PHP script file with simple html interface to control FFMPEG process start and stop from the browser , the script goal is start live streaming on my server that usually runs for hours without stop (using ffmpeg and nginx-rtmp ) my script were working perfectly until I notice recently This is strange behaviors here is my php script variables
$cast =" /usr/sbin/ffmpeg -loglevel 0 -thread_queue_size 32768 -re -i '".$src."' -i /var/www/example/logo.png -r 23.976 -strict -2 480x360 -aspect 16:9 -filter_complex 'overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)-23' -vcodec libx264 -x264opts colormatrix=bt709 -profile:v high444 4 -b:v 290k -maxrate 290k -bufsize 250k -af "aresample=async=1:min_hard_comp=0.100000:first_pts=0" -acodec libfdk_aac -profile:a aac_he_v2 -b:a 16k -map_metadata -1 -f flv rtmp://localhost/hls/live 2>/dev/null >/dev/null & " ;
$output = shell_exec( $cast ) ;
It's like FFMPEG process continue until original php process ( that call it ) die , at first I thought this issue with the sorce or ffmpeg command but I test the same command on the sell and it works perfectly . My suspicion are with on STDIO etc were not redirected right . even when I excute the same php script from the shell it's do the same stops after few seconds .
=Edit=
Even when I tried to run ffmpeg
from the command line and make it run on the background , I got same behavior the process stop after few seconds , ffmpeg continue running only if I wait for it output .
from php ffmpeg exec & shell_exec process stops after few seconds
No comments:
Post a Comment