Ffmpeg 安装和转换视频:

发布于 2024-11-06 09:43:02 字数 1982 浏览 0 评论 0原文

我对安装 ffmpeg-php 进行视频转换的说明感到困惑...有一些 指导我们下载文件并将其放入特定文件夹中,然后转换文件,但有些通过另一种方式,您必须下载 ffmpeg.exe 并将其放置在本地,然后从 php 调用它来转换文件......

那么哪一个是最好的以及如何安装它......??????

现在我下载 ffmpeg 并执行这个脚本但不起作用,并且还授予权限...

$ffmpeg = "ffmpeg/ffmpeg.exe";
$desvfile = $_POST['file'];
$curr_dir = dirname(__FILE__);
$flvfile = $curr_dir."/converted/new1.flv";

if(file_exists($ffmpeg)){
    $cmd = "ffmpeg/ffmpeg.exe -i ".$desvfile." -ar 22050 -ab 32 -f flv -s 320×240 ".$flvfile; 
    exec($cmd, $output); 
    echo "executed command: [".$cmd."] with result: ".print_r($output, true)."<br>\n";
    echo "Successfully video Converted, to video.flv";
}
else{
    echo "There is some problem during converting!";
}

有什么方法可以测试 => exec(ffmpeg) 功能....??????

已更新!

if(file_exists($desvfile)){
    echo "Destination file Exist. <br />";
    $cmd = "$ffmpeg -i '$desvfile' -ar 22050 -ab 32 -f flv -s 320×240 '$flvfile'"; 
    exec(escapeshellcmd($cmd), $output); 
    echo "executed command: => [".$cmd."] <br />with result: => ".print_r($output, true)."<br>\n";
    echo "Successfully video Converted, to video_converted.flv";
 }
else{
    echo "There is some problem during converting!";exit;
}

这给了我输出,,,但不执行要转换的视频...

输出:

// Destination file Exist.

// executed command: => [/var/www/html/test_site/converter/ffmpeg/ffmpeg.exe -i '/var/www/html/test_site/converter/uploads/Gazzump.com - YouTube - Anders And.avi' -ar 22050 -ab 32 -f flv -s 320×240 '/var/www/html/test_site/converter/converted/new1.flv']

// with result: => Array ( )

// Successfully video Converted, to video_converted.flv

I am confused with instruction to install ffmpeg-php for video converting... There are some guide us to download and put files in particular folder and then convert files, but some instruct through another way, where you must download ffmpeg.exe and place it local and then call it from php to convert file.....

So which one is the best and how to install it....?????

Now i download ffmpeg and execute this script but not working, and give rights also...

$ffmpeg = "ffmpeg/ffmpeg.exe";
$desvfile = $_POST['file'];
$curr_dir = dirname(__FILE__);
$flvfile = $curr_dir."/converted/new1.flv";

if(file_exists($ffmpeg)){
    $cmd = "ffmpeg/ffmpeg.exe -i ".$desvfile." -ar 22050 -ab 32 -f flv -s 320×240 ".$flvfile; 
    exec($cmd, $output); 
    echo "executed command: [".$cmd."] with result: ".print_r($output, true)."<br>\n";
    echo "Successfully video Converted, to video.flv";
}
else{
    echo "There is some problem during converting!";
}

There is any way, to test => exec(ffmpeg) functionality....?????

UPDATED!

if(file_exists($desvfile)){
    echo "Destination file Exist. <br />";
    $cmd = "$ffmpeg -i '$desvfile' -ar 22050 -ab 32 -f flv -s 320×240 '$flvfile'"; 
    exec(escapeshellcmd($cmd), $output); 
    echo "executed command: => [".$cmd."] <br />with result: => ".print_r($output, true)."<br>\n";
    echo "Successfully video Converted, to video_converted.flv";
 }
else{
    echo "There is some problem during converting!";exit;
}

Which give me the output,,, but not execute the video to convert....

Output:

// Destination file Exist.

// executed command: => [/var/www/html/test_site/converter/ffmpeg/ffmpeg.exe -i '/var/www/html/test_site/converter/uploads/Gazzump.com - YouTube - Anders And.avi' -ar 22050 -ab 32 -f flv -s 320×240 '/var/www/html/test_site/converter/converted/new1.flv']

// with result: => Array ( )

// Successfully video Converted, to video_converted.flv

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

柠檬色的秋千 2024-11-13 09:43:02

我一直发现使用 exec() 调用 FFMPEG 更容易。查找 FFMPEG 的 exe 版本比 PHP 扩展要容易得多。此方法没有安装过程...只需将 EXE 放在服务器上的某个位置即可由 PHP 执行的任何帐户访问。

确实没有“最好的方法”。两种访问 FFMPEG 的方法都会产生相同的输出。

I've always found it easier to call FFMPEG with exec(). It is much easier to find exe builds of FFMPEG than the PHP extension. There is no install procedure for this method... just put the EXE somewhere on the server that is accessible by whatever account PHP is executing as.

There is no "best way" really. Both methods of accessing FFMPEG will produce the same output.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文