gpt4 book ai didi

PHP FFmpeg 无法在 windowsxp 和实时网站上运行,在 ubuntu 中运行相同的代码

转载 作者:行者123 更新时间:2023-12-04 23:30:01 25 4
gpt4 key购买 nike

这是我想在所有情况下都可以使用的脚本:
它仅在 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"/>

最佳答案

我认为您错过了执行如下所示的“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);

关于PHP FFmpeg 无法在 windowsxp 和实时网站上运行,在 ubuntu 中运行相同的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19973740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com