Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin

Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin

1 year ago -  by Daniel -  howto centos virtualmin ffmpeg ffmpeg-php

The other day I was requested to set-up few requirements for a client such as mod_rewriteGD libraryPHP Dombcmath etc.. and among these in the list there was theFFMPEG library and the FFMPEG-PHP extension. OK, no big deal, but this box has CentOS 6 (RHEL6) with Virtualmin/Webmin set-up on top of it using the base repositories only, so let‘s do it I said...

ok, I took the following steps in order to install and set-up FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin

  1. Update the system
  2. Install Development Tools
  3. Protect base repositories
  4. Add dag‘s repository
  5. Install FFMPEG
  6. Install FFMPEG-PHP
  7. Load FFMPEG-PHP extension

1. Make sure the CentOS 6 system is fully up-to-date

yum update

2. Install Development Tools

yum groupinstall "Development tools"

3. Protect the base repositories so the packages don‘t get updated by the unprotected ones

Install the ProtectBase yum plugin by

yum install yum-protectbase

and then navigate to /etc/yum.repos.d

cd /etc/yum.repos.d/

before doing any changes to the repositories, always do backup of the original ones.

cp -prv ../yum.repos.d{,.orig}

in order for a repository to be protected, a line protect=1 needs to be added to each repository section in CentOS-Base.repoCentOS-Media.repo and virtualmin.repo.

So, edit these files using your favourite editor or do the sed if you‘re feeling brave

sed -i ‘/gpgkey=/a\protect=1‘ CentOS-{Base,Media}.repo
sed -i ‘/gpgkey=/a\protect=1‘ virtualmin.repo

4. Add dag‘s repository by adding the following to /etc/yum.repos.d/dag.repo

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
gpgkey=http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt
enabled=1
protect=0

next import dag‘s rpm gpg key by

wget http://dag.wieers.com/packages/RPM-GPG-KEY.dag.txt -P /tmp
rpm --import /tmp/RPM-GPG-KEY.dag.txt

5. Proceed with installing FFMPEG and some development packages

yum install ffmpeg-devel php-devel re2c php-xml ffmpeg

verify FFMPEG is installed successfully by executing

ffmpeg

you should get something like

FFmpeg version 0.6.5, Copyright (c) 2000-2010 the FFmpeg developers
built on Jan 29 2012 17:52:15 with gcc 4.4.5 20110214 (Red Hat 4.4.5-6)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --incdir=/usr/include --disable-avisynth --extra-cflags=‘-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fPIC‘ --enable-avfilter --enable-avfilter-lavf --enable-libdc1394 --enable-libdirac --enable-libfaac --enable-libfaad --enable-libfaadbin --enable-libgsm --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libx264 --enable-gpl --enable-nonfree --enable-postproc --enable-pthreads --enable-shared --enable-swscale --enable-vdpau --enable-version3 --enable-x11grab
libavutil 50.15. 1 / 50.15. 1
libavcodec 52.72. 2 / 52.72. 2
libavformat 52.64. 2 / 52.64. 2
libavdevice 52. 2. 0 / 52. 2. 0
libavfilter 1.19. 0 / 1.19. 0
libswscale 0.11. 0 / 0.11. 0
libpostproc 51. 2. 0 / 51. 2. 0
Hyper fast Audio and Video encoder

6. Compile and install the FFMPEG-PHP extension

mkdir /srv/build
cd /srv/build
wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2
tar -xjf ffmpeg-php-0.6.0.tbz2
cd ffmpeg-php-0.6.0/

phpize
./configure

now run the following to prevent compilation failure with something like ffmpeg_frame.c:421: error: ‘PIX_FMT_RGBA32’ undeclared (first use in this function)

sed -i ‘s#PIX_FMT_RGBA32#PIX_FMT_RGB32#‘ ./ffmpeg_frame.c

and compile and install using

make
make install

you should end up with something like

Installing shared extensions:     /usr/lib64/php/modules/

7. Load the FFMPEG-PHP extension and reload Apache

echo -e "extension=ffmpeg.so\n" > /etc/php.d/ffmpeg.ini

restart the webserver by

/etc/init.d/httpd restart

verify that the FFMPEG-PHP extension is loaded

php -i | grep ffmpeg
php -m | grep ffmpeg
时间: 2024-12-21 01:25:27

Install FFMPEG and FFMPEG-PHP in CentOS 6 with Virtualmin的相关文章

(转载)[FFmpeg]使用ffmpeg从各种视频文件中直接截取视频图片

你曾想过从一个视频文件中提取图片吗?在Linux下就可以,在这个教程中我将使用ffmpeg来从视频中获取图片. 什么是ffmpeg?What is ffmpeg? ffmpeg是一个非常有用的命令行程序,它可以用来转码媒体文件.它是领先的多媒体框架FFmpeg的一部分,其有很多功能,比如解码.编码.转码.混流.分离.转化为流.过滤以及播放几乎所有的由人和机器创建的媒体文件. 在这个框架中包含有各种工具,每一个用于完成特定的功能.例如,ffserver能够将多媒体文件转化为用于实时广播的流,ffp

【FFmpeg】ffmpeg推流+播放器命令总结,常用16条汇总

前叙 一直以来用的是Mac自带VLC工具播放直播生成的url链接,简单但不够用,所以还是要入门FFmpeg. 安装 ~ brew install ffmpeg ~ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg    ~ man ffmpeg 命令 1.查看一个视频去掉多余修身部分 ~ ffmpeg -i IMG_3158.MOV -hide_banner 2.mp4转换avi ~ ffmpeg -i test.avi test.mp4 3.

How to Install Apache Solr 4.5 on CentOS 6.4

By Shay Anderson on October 2013 Knowledge Base  /  Linux  /  How to Install Apache Solr 4.5 on CentOS 6.4 In this tutorial I explain how to install Apache Solr 4.5 on CentOS 6.4. In all the examples below I am using the root user, if you are not you

Install Apache, PHP And MySQL On CentOS 7 (LAMP)

原文 Install Apache, PHP And MySQL On CentOS 7 (LAMP) This tutorial shows how you can install an Apache2 webserver on a CentOS 7.0 server with PHP5 support (mod_php) and MySQL support. LAMP is short for Linux, Apache,MySQL, PHP. 1 Preliminary Note In t

Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux

Install MongoDB on Red Hat Enterprise, CentOS, Fedora, or Amazon Linux? Overview Use this tutorial to install MongoDB on Red Hat Enterprise Linux, CentOS Linux, Fedora Linux, or a related system. The tutorial uses .rpm packages to install. While some

How to Install Apache Tomcat 8.5 on CentOS 7.3

How to Install Apache Tomcat 8.5 on CentOS 7.3 From: https://www.howtoforge.com/tutorial/how-to-install-tomcat-on-centos/ This tutorial exists for these OS versions CentOS 7.3 CentOS 7 On this page Step 1 - Install Java (JRE and JDK) Step 2 - Configu

【FFmpeg】FFmpeg常用基本命令

转自:http://www.cnblogs.com/dwdxdy/p/3240167.html 1.分离视频音频流 ffmpeg -i input_file -vcodec copy -an output_file_video //分离视频流 ffmpeg -i input_file -acodec copy -vn output_file_audio //分离音频流 2.视频解复用 ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264 ffmp

Install Galera MariaDB 5.5 on CentOS 6.5

vi /etc/yum.repos.d/galera.repo# MariaDB 5.5 CentOS repository list - created 2014-08-28 06:32 UTC# http://mariadb.org/mariadb/repositories/[mariadb]name = MariaDBbaseurl = http://yum.mariadb.org/5.5/centos6-amd64gpgkey=https://yum.mariadb.org/RPM-GP

【FFmpeg】FFmpeg常用基本命令(转载)

转自:http://www.cnblogs.com/dwdxdy/p/3240167.html 1.分离视频音频流 ffmpeg -i input_file -vcodec copy -an output_file_video //分离视频流 ffmpeg -i input_file -acodec copy -vn output_file_audio //分离音频流 2.视频解复用 ffmpeg –i test.mp4 –vcodec copy –an –f m4v test.264 ffmp