PHP detects shell_exec () command not executed

I run the ffmpeg command in PHP shell_exec () to convert multiple videos to a list. In any case, to determine if an error occurred during the conversion of the video (or at least make sure that it completed the conversion completely)?

I do not want to stop converting other videos if an error occurs, as well as the ability to record errors.

<?php shell_exec('ffmpeg -i downloads/flv/file1.flv -vcodec libvpx -acodec libvorbis downloads/webm/file1.webm'); if(error) { //run a command here to report the error (ie. MySQL or email) } ?> 
+4
source share
2 answers

Capturing exit code using another system call function, such as exec :

 exec('ffmpeg ...', $output, $return); if ($return != 0) { // an error occurred } 

Any decent utility will exit with a code other than 0 on error.

+10
source
 $return=shell_exec('ffmpeg ...'); if ($return) { //look at what it returns do what you will with the data } 
-1
source

All Articles