当前位置:网站首页>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;
}
}
边栏推荐
猜你喜欢
随机推荐
各种cms getshell技巧
g++ parameter description
VS2022 encapsulation under Windows dynamic library and dynamic library calls
C#程序默认以管理员权限打开
Typora
./autogen.sh: 4: ./autogen.sh: autoreconf: not found
go test执行多个文件夹下相同目录的用例
笛卡尔积处理商品属性sku
数组与字符串14-使用双指针移除元素
ZEMAX | 如何创建简单的非序列系统
关于C语言中getchar()函数的用法
BOA服务器移植之嵌入式开发板(FS4412)
阿里云短信服务的使用(创建,测试笔记)
5. What is the difference between int and Integer?
3D游戏建模师在国内的真实现状,想转行,先来看看!
SolidWorks 操作视频 | 流体分析结果演示
看了都收藏的3D游戏建模全流程解析,角色模型就该这么做!
MySql的Sql语句的练习(试试你能写出来几道呢)
二分查找2 - x的平方根
ZEMAX | 如何倾斜和偏心序列光学元件