当前位置:网站首页>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;
}
}
边栏推荐
- window下VS2022封装静态库以及调用静态库
- ./autogen.sh: 4: ./autogen.sh: autoreconf: not found
- 二分查找1-实现一个二分查找
- How the world's leading medical technology company maximizes design productivity | SOLIDWORKS Product Exploration
- 二分查找4 - 搜索旋转排序数组
- 二、Exception和Error有什么区别?
- VS2022 encapsulates static libraries and calls static libraries under window
- 域名怎么管理,域名管理注意事项有哪些?
- 全球一流医疗技术公司如何最大程度提高设计工作效率 | SOLIDWORKS 产品探索
- 2-php学习笔记之控制语句,函数
猜你喜欢
随机推荐
ZEMAX | 在设计抬头显示器(HUD)时需要使用哪些工具?
MySQL的主从复制
Unity Animation从UAS获取动画资产到编制状态机控制简单的人物动画
3. What is the difference between final, finally, and finalize?
ZEMAX | 探索 OpticStudio中的序列模式
3D建模为什么会变得无处不在
./autogen.sh: 4: ./autogen.sh: autoreconf: not found
二分查找5 - 第一个错误的版本
ZEMAX | 如何使用渐晕系数
【面试准备】游戏开发中的几个岗位分别做什么&考察侧重点
servlet学习(七)ServletContext
【C语言】输出100~200之间的素数/质数(3种方法)
【3D建模制作技巧分享】ZBrush快捷键如何设置
数组与字符串10-实现 strStr()
BurpSuite 进阶玩法
Dynamic adjustment of web theme (2) Extraction
MATLAB自带的dwt2和wavedec2函数实现基于小波变换的自适应阈值图像边缘检测
SSL证书过期后怎么办?
ARP协议及简单路由器原理(1)
SolidWorks 操作视频 | 隐藏高手必备工具Defeature,让设计隐藏更彻底