flo*_*eft 4 php ffmpeg shell-exec
我正在PHP的shell_exec()中运行ffmpeg命令来转换列表中的多个视频.无论如何都要检测视频转换时是否发生了错误(或至少验证它是否完全完成了转换)?
如果发生错误,我不想停止转换其他视频,只是记录错误的能力.
<?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)
}
?>
Run Code Online (Sandbox Code Playgroud)
dec*_*eze 10
使用另一个系统调用函数捕获退出代码,如exec:
exec('ffmpeg ...', $output, $return);
if ($return != 0) {
// an error occurred
}
Run Code Online (Sandbox Code Playgroud)
任何不错的实用程序将在出错时以0以外的代码退出.