Answer the question
In order to leave comments, you need to log in
Why does the script stop using exec?
Hello. The scheme is as follows: the main server sends the media file using rsync to another server. This server has a script that processes a media file by calling the ffmpeg command via exec with some parameters, after which it sends the data back via gearman (indicating that the task has been completed), as well as a command to download this very file from the second to basic. The problem is that after several such successive iterations (processes 5-10 files), the script ends its work on the exec function (put the usual echo before and after the exec), without giving any errors (error_reporting, etc. are enabled), and sometimes stopping the conversion in the middle. I tried to monitor the script memory - everything is normal. There is nothing in the supervisor's logs, in the logs of the script itself and gearman. Where to dig?
PS
echo 1;
exec("ffmpeg -y -i $filepath -vf scale={$scale},setsar=1:1 -vcodec libx264 -b:v {$px['b']}k -acodec copy -threads ".(exec('nproc') - 1)." -bufsize 2000k -minrate 0k -maxrate 1450k ".$new_filepath, $output, $result_int);
echo 2;
Answer the question
In order to leave comments, you need to log in
miracles don't happen.
if it didn’t reach the second echo, it means it fell out with a fatality / threw an exception, well, what happens in 7+ puffs in these cases. and error logs are either not fully configured, or look in the book, but you see a fig. and that happened too.
or is it still hanging and running
Do it through proc open and catch everything that's going on. In ffmpeg set loglevel to max, probably exit code > 0
Not a line of code)
Read this page, paragraphs "Remarks", maybe something will do)
php.net/manual/ru/function.exec.php
Well, look what the third parameter $return_var returns
string exec ( string $command [, array &$output [, int &$return_var ]] )
And what does the direct launch of this command in the console give? Those. we take, we take out the command test in a variable and we log. We launch the fallen options with our hands.
$cmd = "ffmpeg -y -i $filepath -vf scale={$scale},setsar=1:1 -vcodec libx264 -b:v {$px['b']}k -acodec copy -threads ".(exec('nproc') - 1)." -bufsize 2000k -minrate 0k -maxrate 1450k " . $new_filepath;
echo $cmd;
exec($cmd, $output, $result_int);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question