当前位置:网站首页>contos install php-ffmpeg and tp5.1 using plugin
contos install php-ffmpeg and tp5.1 using plugin
2022-08-03 06:32:00 【dd00bb】
Centos 安装 ffmpeg
1.安装EPEL Release,因为安装需要使用其他的repo源,所以需要EPEL支持:
yum install -y epel-release
2.如果出现缺少Code提示,可以:
sudo rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
3.安装完成之后,可以查看是否安装成功
yum repolist
4.安装Nux-Dextop源
#导入一个Code
sudo rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro
#安装nux-dextop 源
sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-1.el7.nux.noarch.rpm
5.查看repo源是否安装成功
yum repolist
6.yum安装ffmpeg:
yum install -y ffmpeg
7.安装完成后检查ffmpeg 版本:
ffmpeg -version
ThinkPHP 5.1 安装php-ffmpeg
1.进入TP5.1Execute in the project directory directory
composer require php-ffmpeg/php-ffmpeg
2.控制器中引入
<?php
namespace app\index\controller;
use FFMpeg;
class Index
{
public function index()
{
$configuration = array(
// windows调用插件
'ffmpeg.binaries' => env('root_path').'ffmpeg/bin/ffmpeg.exe',
'ffprobe.binaries' => env('root_path').'ffmpeg/bin/ffprobe.exe', //This is where it is installed on the computer or server
// linuxHow to call the plugin to report an error,在项目根目录下创建ffmpeg目录,Then create a hard link file in the directoryffmpeg
//'ffmpeg.binaries' => '/usr/bin/ffmpeg.exe',
//'ffprobe.binaries' => 'usr/bin/ffprobe.exe',
//'ffmpeg.binaries' => env('root_path').'ffmpeg/ffmpeg',
//'ffprobe.binaries' => env('root_path').'ffmpeg/ffprobe',
//'timeout' => 3600, // The timeout for the underlying process
//'ffmpeg.threads' => 12, // The number of threads that FFMpeg should use
);
$ffmpeg = FFMpeg\FFMpeg::create($configuration);
// New file after synthesis
$outfile_path = env('root_path')."public/audio/new_file.wav";
// audio source file
$audio_path = env('root_path')."audio/";
$audio = $ffmpeg->open($audio_path.'0.wav');
// List of audio files to be synthesized
$file_arr[] = $audio_path.'0.wav';
$file_arr[] = $audio_path.'1.wav';
$file_arr[] = $audio_path.'2.wav';
// The new file after synthesis exists,则先删除掉,重新合成
if(file_exists($outfile_path)){
unlink($outfile_path);
}
// Perform synthesis of audio files
$audio->concat($file_arr)->saveFromSameCodecs($outfile_path, TRUE);
return true;
}
}
边栏推荐
猜你喜欢

ZEMAX | 如何使用ZOS-API创建自定义操作数

数组与字符串10-实现 strStr()

Automatic ticket issuance based on direct reduction of China Southern Airlines app

内网渗透之PPT票据传递攻击(Pass the Ticket)

All-round interpretation of POE switches (middle)

【随笔】我为啥想写无关紧要的随笔?

什么是国密SSL协议?国密证书与传统SSL证书有什么区别?

How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration

【随笔】平常心

二分查找2 - x的平方根
随机推荐
ZBrush+Substance Designer2021制作高品质3D角色模型全流程!
在Maya和ZBrush中制作战士模型
看了都收藏的3D游戏建模全流程解析,角色模型就该这么做!
servlet learning (7) ServletContext
MySql的Sql语句的练习(试试你能写出来几道呢)
VS2022 encapsulates static libraries and calls static libraries under window
C#切换输入法
2. What is the difference between Exception and Error?
ZEMAX | 在设计抬头显示器(HUD)时需要使用哪些工具?
TFS(Azure DevOps)禁止多人同时签出
Eight, the difference between the interface of the abstract class
大佬!Maya+ZBrush+Substance制作泰坦野兽全流程!
检测微信显示无效头像图片链接
802.1AS的BMCA(最佳主时钟选举)理解
2021-06-14
IP数据包的格式(1)
数组与字符串9-翻转字符串里的单词
cobalt strike 的基础使用
What is parametric design, let's understand it through practical operation?| SOLIDWORKS How-To Videos
申请公网ip后,配置光猫,路由器使用公网ip步骤