当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
随机推荐
二分查找3 - 猜数字大小
802.1AS 延迟测量理解
ue4学习日记3(设置操控角色,地形)
二层交换机,三层交换机,路由器内容总结记录
Difference between @JsonProperty and JSONField?
go test执行多个文件夹下相同目录的用例
【C语言】斐波那契数列
宝塔负载均衡配置及nfs共享
域名管理常见问题:IP、域名和DNS之间的区别和关系
内网渗透之PPT票据传递攻击(Pass the Ticket)
ZEMAX | 如何创建简单的非序列系统
【七夕特效】 -- 满屏爱心
剑指 Offer II 001. 整数除法
大学毕业后,零基础想转行成为一名3D建模师,现在该做什么?
交换机access口,hybrid口,trunk口的区别
2021-06-20
C#切换输入法
学习C的第一天,尝试一下写博客
AI智能剪辑,仅需2秒一键提取精彩片段
TFS(AzureDevOps)取消离职人员的签出项









