这是我想在所有情况下工作的脚本: 它仅在ubuntu中工作,但在所有情况下都不像windowsxp 请建议我......
// where ffmpeg is located, such as /usr/sbin/ffmpeg
$ffmpeg = 'ffmpeg';
// the input video file
$video = "upload/uploads/movies/animations/dhoom-2.mp4";
// where you'll save the image
$image = "upload/uploads/movies/animations/images/dhoom-2.jpg";
// default time to get the image
$second = 1;
// get the duration and a random place within that
$cmd = "$ffmpeg -i $video 2>&1";
if (preg_match('/Duration: ((\d+):(\d+):(\d+))/s', `$cmd`, $time))
{
$total = ($time[2] * 3600) + ($time[3] * 60) + $time[4];
$second = rand(1, ($total - 1));
}
// get the screenshot
$cmd = "$ffmpeg -i $video -deinterlace -an -ss 04 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
$return = `$cmd`;
echo "<script>alert('done!');</script>";
?>
<img src="upload/uploads/movies/animations/images/dhoom-2.jpg" alt=";-)" class="wp-smiley"/>
答案 0 :(得分:0)
我认为您错过了“exec”/“shell_exec”执行如下,尝试相同。
$cmd = "$ffmpeg -i $video -deinterlace -an -ss 04 -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
return exec($cmd);