I run the following command through shell_exec
C:\wamp\bin\ffmpeg\bin>start /b ffmpeg -i input2.mp4 -codec:v libx264 -profile:v high -b:v 600k -maxrate 600k -bufsize 1000k -vf scale=854:480 -threads 0 -codec:a libvo_aacenc -b:a 128k output2.mp4 <NUL >NUL 2>NUL The script is still waiting ... The shell_exec () constraint seems to have taken into account that you need to output stdou and stderr somewhere so that you can leave the command in the "background" and not wait for the end of its execution. At the same time, launching it directly via the command line, like the conversion goes to the "background", that is, there is no output, and the command is all done exactly. Does anyone have any ideas about this?
UPD
$cmd = 'START /DC:\wamp\bin\ffmpeg\bin\ /B CMD /C ffmpeg -y -i ' . $content['upload_data']['full_path'] . ' -codec:v libx264 -profile:v high -b:v 600k -maxrate 600k -bufsize 1000k -vf scale=854:480 -threads 0 -codec:a libvo_aacenc -b:a 128k ' . $content['upload_data']['file_path'] . $content['upload_data']['raw_name'] . '.480' . $content['upload_data']['file_ext'] . ' <NUL >NUL 2>NUL'; exec($cmd); Here is the command in php. Changing shell_exec to exec did not help either.
exec()and similar ones are needed to execute the command, get an answer and pass on to the code, whileproc_open()and its like represent a kind of terminal, perhaps)) They run the program a separate thread can continue to "interact" with this program. Whyexecdoes not work as expected - I will not answer. I myself once ran into this, did not overcome it, found another solution - and that’s all :-) - Johny