首页 > PHP教程 > php开发知识文章

Centos6.5 安装基于PHP5环境的ffmpeg扩展

本文主要介绍了如何在Centos6.5下 安装基于PHP5.3环境的ffmpeg扩展

CentOS(Community Enterprise Operating System,意思是:社区企业操作系统)是Linux发行版之一

它是来自于Red Hat Enterprise Linux依照开放源代码规定释出的源代码所编译而成,官网:www.centos.org

Centos 操作系统

 

FFmpeg

FFmpeg是一套可以用来记录、转换数字音频、视频,并能将其转化为流的开源计算机程序。

采用LGPL或GPL许可证。它提供了录制、转换以及流化音视频的完整解决方案。

PHP能使用ffmpeg扩展来获取音/视频信息以及对音视频文件进行处理。官网:http://ffmpeg.org/

FFmpeg

 

操作系统安装yasm

wget http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
tar zxvf yasm-0.7.0.tar.gz
cd yasm-0.7.0
./configure
make && make install

操作系统安装ffmpeg

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure --enable-shared
make
make install

安装ffmpeg-php扩展

使用composer,参考:https://github.com/PHP-FFMpeg/PHP-FFMpeg

$ composer require php-ffmpeg/php-ffmpeg

ffmpeg-php基本用法

$ffmpeg = FFMpeg\FFMpeg::create();
$video = $ffmpeg->open('video.mpg');

$video
->filters()
->resize(new FFMpeg\Coordinate\Dimension(320, 240))
->synchronize();

$video
->frame(FFMpeg\Coordinate\TimeCode::fromSeconds(10))
->save('aa.jpg');

$video
->save(new FFMpeg\Format\Video\X264(), 'export-x264.mp4')
->save(new FFMpeg\Format\Video\WMV(), 'export-wmv.wmv')
->save(new FFMpeg\Format\Video\WebM(), 'export-webm.webm');

以上就是这篇文章在Centos6.5下 安装基于PHP5.3环境的ffmpeg扩展的全部内容了,希望本文的内容对大家的学习或者工作有所帮助。

关闭
感谢您的支持,我会继续努力!
扫码打赏,建议金额1-10元


提醒:打赏金额将直接进入对方账号,无法退款,请您谨慎操作。