piremard
شنبه 27 فروردین 1390, 18:08 عصر
سلام
من ffmpeg رو روی xampp در لوکال هاست نصب کردم .
و طبق دستور زیر برای ساخت thumbnail از ویدئو استفاده کردم . ولی نمیسازه .
<?php
// where ffmpeg is located, such as /usr/sbin/ffmpeg
$ffmpeg = 'ffmpeg';
// the input video file
$video = dirname(__FILE__) . 'siyavash.mpg';
// where you'll save the image
$image = dirname(__FILE__) . 'demo.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 $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
$return = `$cmd`;
// done! <img src="http://blog.amnuts.com/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley">
echo 'done!';
?>
ولی الان مشکل دارم اونم اینکه تصویر نمیسازه یعنی thumbnail نمیسازه کسی میتونه راهنمایی کنه من
xampp 1.7.1 دارم.
من ffmpeg رو روی xampp در لوکال هاست نصب کردم .
و طبق دستور زیر برای ساخت thumbnail از ویدئو استفاده کردم . ولی نمیسازه .
<?php
// where ffmpeg is located, such as /usr/sbin/ffmpeg
$ffmpeg = 'ffmpeg';
// the input video file
$video = dirname(__FILE__) . 'siyavash.mpg';
// where you'll save the image
$image = dirname(__FILE__) . 'demo.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 $second -t 00:00:01 -r 1 -y -vcodec mjpeg -f mjpeg $image 2>&1";
$return = `$cmd`;
// done! <img src="http://blog.amnuts.com/wp-includes/images/smilies/icon_wink.gif" alt=";-)" class="wp-smiley">
echo 'done!';
?>
ولی الان مشکل دارم اونم اینکه تصویر نمیسازه یعنی thumbnail نمیسازه کسی میتونه راهنمایی کنه من
xampp 1.7.1 دارم.