Ffmpeg 安装和转换视频:
我对安装 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我一直发现使用
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.