How to find out an error in a command in an exec function?

I use ffmpeg command to cut video with exec function in php. But it does not create a video file and does not show any errors. I used exec as below

exec("ffmpeg -i input.flv -ss 00:00:30.0 -t 00:00:10.0 -acodec copy -vcodec copy -async 1 output.flv");

Can I get any help to find out what is going on here?

exec("ffmpeg -i input.flv -ss 00:00:30.0 -t 00:00:10.0 -acodec copy -vcodec copy -async 1 output.flv",$output);

I tried it too. But I did not receive an error message in the variable$output

+3
source share
1 answer

As a rule, you first need to check the return value: non-zero values ​​indicate the presence of an error (given that the author of the program you work with adheres to the standard). This value is fixed in exec () the third argument.

-, . . :

exec("ffmpeg -i input.flv -ss 00:00:30.0 -t 00:00:10.0 -acodec copy -vcodec copy -async 1 output.flv 2>&1", $output, $return_value);
+5

Source: https://habr.com/ru/post/1752429/


All Articles