我已经在我的Windows 2008服务器上安装了ffmpeg。
我在 CMD 中使用此字符串,我得到了我想在我的字符串中得到的东西
PHP文件:
ffprobe -v quiet -print_format json -show_format -show_streams "C:wampwwwuploadsfc30e528b500b26a391ed4f5ed484310.mp4"
这是我在另一个堆栈溢出问题中找到的 PHP 函数,它有很好的反馈,所以我测试了它。
$file_name = 'fc30e528b500b26a391ed4f5ed484310';
$file_ext = 'mp4';
$ffprobe = 'C:\ffmpeg\bin\ffprobe.exe';
$videoFile = 'C:\wamp\www\uploads\'.$file_name.'.'.$file_ext;
$cmd = shell_exec($ffprobe .' ffprobe -v quiet -print_format json -show_format -show_streams "'.$videoFile.'"');
$parsed = json_decode($cmd, true);
print_r($parsed);
什么都不是。我还尝试使用与ffmpeg相同的功能(我为ffmpeg工作)。
$cmd = $ffprobe.' ffprobe -v quiet -print_format json -show_format -show_streams "'.$videoFile.'" 2>&1';
echo shell_exec($cmd);
这也什么也没带回来。
有什么想法吗?
包含.exe后删除了ffprobe,解决了问题:
$file_name = 'fc30e528b500b26a391ed4f5ed484310';
$file_ext = 'mp4';
$ffprobe = 'C:\ffmpeg\bin\ffprobe.exe';
$videoFile = 'C:\wamp\www\uploads\'.$file_name.'.'.$file_ext;
$cmd = shell_exec($ffprobe .' -v quiet -print_format json -show_format -show_streams "'.$videoFile.'"');
$parsed = json_decode($cmd, true);
print_r($parsed);