This guide is based on a minimal installation of the latest CentOS release, and will provide a local, non-system installation of FFmpeg with support for several external encoding libraries. These instructions should also work for recent Red Hat Enterprise Linux (RHEL) and Fedora. This is a non-invasive guide and undoing all steps is simple and is shown at the end of this page.


Get the Dependencies

These are required compiling, but you can remove them when you are done if you prefer (except make; it should be installed by default and many things depend on it).

# yum install autoconf automake cmake freetype-devel gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel bzip2 
In your home directory make a new directory to put all of the source code into:
mkdir ~/ffmpeg_sources 

Compilation & Installation

Note: If you do not require certain encoders you may skip the relevant section and then remove the appropriate ./configure option in FFmpeg. For example, if libvorbis is not needed, then skip that section and then remove --enable-libvorbis from the Install FFmpeg section.

Yasm

Yasm is an assembler used by x264 and FFmpeg.

cd ~/ffmpeg_sources git clone --depth 1 git://github.com/yasm/yasm.git cd yasm autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" make && make install make distclean 

libx264

H.264 video encoder. See the H.264 Encoding Guide for more information and usage examples.

Requires ffmpeg to be configured with --enable-gpl --enable-libx264.

cd ~/ffmpeg_sources git clone --depth 1 git://git.videolan.org/x264 cd x264
PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig"./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --enable-static

make && make install make distclean

libx265

H.265/HEVC video encoder. See the H.265 Encoding Guide for more information and usage examples.

Requires ffmpeg to be configured with --enable-gpl --enable-libx265.

cd ~/ffmpeg_sources hg clone https://bitbucket.org/multicoreware/x265 cd ~/ffmpeg_sources/x265/build/linux cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source make make install 

libfdk_aac

AAC audio encoder.

Requires ffmpeg to be configured with --enable-libfdk-aac (and --enable-nonfree if you also included --enable-gpl).

cd ~/ffmpeg_sources git clone --depth 1 git://git.code.sf.net/p/opencore-amr/fdk-aac cd fdk-aac autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make && make install && make distclean 

libmp3lame

MP3 audio encoder.

Requires ffmpeg to be configured with --enable-libmp3lame.

cd ~/ffmpeg_sources curl -L -O http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz tar xzvf lame-3.99.5.tar.gz cd lame-3.99.5 ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm make make install make distclean 

libopus

Opus audio decoder and encoder.

Requires ffmpeg to be configured with --enable-libopus.

cd ~/ffmpeg_sources git clone git://git.opus-codec.org/opus.git cd opus autoreconf -fiv ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean 

libogg

Ogg bitstream library. Required by libtheora and libvorbis.

cd ~/ffmpeg_sources curl -O http://downloads.xiph.org/releases/ogg/libogg-1.3.2.tar.gz tar xzvf libogg-1.3.2.tar.gz cd libogg-1.3.2 ./configure --prefix="$HOME/ffmpeg_build" --disable-shared make make install make distclean 

libvorbis

Vorbis audio encoder. Requires libogg.

Requires ffmpeg to be configured with --enable-libvorbis.

cd ~/ffmpeg_sources curl -O http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.4.tar.gz tar xzvf libvorbis-1.3.4.tar.gz cd libvorbis-1.3.4 LDFLAGS="-L$HOME/ffmeg_build/lib" CPPFLAGS="-I$HOME/ffmpeg_build/include" ./configure --prefix="$HOME/ffmpeg_build" --with-ogg="$HOME/ffmpeg_build" --disable-shared make make install make distclean 

libvpx

VP8/VP9 video encoder.

Requires ffmpeg to be configured with --enable-libvpx.

地址要改为https://github.com/webmproject/libvpx/   git clone https://github.com/webmproject/libvpx

cd ~/ffmpeg_sources git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git cd libvpx ./configure --prefix="$HOME/ffmpeg_build" --disable-examples make make install make clean 

FFmpeg

cd ~/ffmpeg_sources git clone --depth 1 git://source.ffmpeg.org/ffmpeg cd ffmpeg PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/bin" --pkg-config-flags="--static" --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 make && make install && make distclean hash -r 

Compilation is now complete and ffmpeg (also ffprobeffserverlame, and x264) should now be ready to use. The rest of this guide shows how to update or remove FFmpeg.

编译完成后,会:

Tip: Keep the ffmpeg_sources directory and all contents if you intend to update as shown below. Otherwise you can delete this directory.


Updating

Development of FFmpeg is active and an occasional update can give you new features and bug fixes. First, remove the old files and then update the dependencies:

rm -rf ~/ffmpeg_build ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,x265,yasm,ytasm} # yum install autoconf automake cmake gcc gcc-c++ git libtool make mercurial nasm pkgconfig zlib-devel 

Update Yasm

cd ~/ffmpeg_sources/yasm make distclean git pull 

Then run ./configuremake, and make install as shown in the Install yasm section.

Update x264

cd ~/ffmpeg_sources/x264 make distclean git pull 

Then run ./configuremake, and make install as shown in the Install x264 section.

Update x265

cd ~/ffmpeg_sources/x265 rm -rf ~/ffmpeg_sources/x265/build/linux/* hg update cd ~/ffmpeg_sources/x265/build/linux 

Then run cmakemake, and make install as shown in the Install x265 section.

Update libfdk_aac

cd ~/ffmpeg_sources/fdk_aac make distclean git pull 

Then run ./configuremake, and make install as shown in the Install libfdk_aac section.

Update libvpx

cd ~/ffmpeg_sources/libvpx make clean git pull 

Then run ./configuremake, and make install as shown in the Install libvpx section.

Update FFmpeg

cd ~/ffmpeg_sources/ffmpeg make distclean git pull 

Then run ./configuremake, and make install as shown in the Install FFmpeg section.


Reverting changes made by this guide

rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,ffprobe,ffserver,lame,vsyasm,x264,yasm,ytasm} # yum erase autoconf automake cmake gcc gcc-c++ git libtool mercurial nasm pkgconfig zlib-devel hash -r 

If You Need Help

Feel free to ask your questions at the #ffmpeg IRC channel or the ​ffmpeg-user mailing list.


Also See

centos编译 Compiling FFmpeg on CentOS RHEL Fedora的更多相关文章

  1. 阿里云服务器---centos编译安装ffmpeg

    环境 系统环境:CentOS release 6.7 (Final) 需求 编译安装ffmpeg 获取依赖 安装依赖包 yum install -y autoconf automake cmake f ...

  2. 如何在CentOS/RHEL & Fedora上安装MongoDB 3.2

    MongoDB(名称取自"huMONGOus")是一个有着全面灵活的索引支持和丰富的查询的数据库.MongoDB通过GridFS提供强大的媒体存储.点击这里获取MongoDB的更多 ...

  3. centos编译ffmpeg x264

    1.安装汇编编译器(一般系统自带吧).假设没有依照以下的命令安装吧 yum install yasm 2.使用最新x264源代码编译(仅仅支持编码)    在x264官网下载最新的代码http://w ...

  4. CentOS编译安装NodeJS+Express

    NodeJS是基于Chrome’s Javascript runtime,也就是Google V8引擎执行Javascript的快速构建网络服务及应用的平台,其优点有: 在CentOS编译安装Node ...

  5. Centos编译安装PHP 5.5笔记

    本篇是在 Centos 6.4 32bit 下编译安装 php 5.5.5 的笔记,接上篇 Centos编译安装Apache 2.4.6笔记.php 5.5.x 和 centos 源里面的 php 5 ...

  6. CentOS 编译 GCC 7.2

    CentOS 编译 GCC 7.2 下载源码 wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-7.2.0/gcc-7.2.0. ...

  7. nginx php-fpm安装配置 CentOS编译安装php7.2

    CentOS编译安装php7.2 介绍: 久闻php7的速度以及性能那可是比php5系列的任何一版本都要快,具体性能有多好,建议还是先尝试下再说.如果你是升级或新安装,那你首先需要考虑php7和程序是 ...

  8. CentOS 编译安装 Redis (实测 笔记 Centos 7.3 + redis 3.2.8)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...

  9. CentOS 编译安装 Nodejs (实测 笔记 Centos 7.3 + node 6.9.5)

    环境: 系统硬件:vmware vsphere (CPU:2*4核,内存2G,双网卡) 系统版本:CentOS-7.0-1406-x86_64-DVD.iso 安装步骤: 1.准备 1.1 显示系统版 ...

随机推荐

  1. [USACO15FEB]Superbull (最小生成树)

    题目链接 Solution 基本上就是个板子. 因为 \(n\) 很小,只有 \(2000\),所以直接暴力建图,然后跑最小生成树就好了. Code #include<bits/stdc++.h ...

  2. 定时任务管理之python篇celery使用

    一.为什么要用celery celery是一个简单.灵活.可靠的,处理大量消息的分布式系统,并且提供维护这样一个系统的必须工具.他是一个专注于实时处理的任务队列,同时也支持任务调度. celery是异 ...

  3. Wmap5 测试80端口 Your port 80 is actually used by :Server: Microsoft-HTTPAPI/2.0

    问题:win7系统! 在wamp5的apache启动不了: 目录下点击[测试80端口]的时候提示:Your port 80 is actually used by : Server: Microsof ...

  4. APUE 学习笔记(四) 标准I/O库

    1.流与FILE对象 unix I/O系统调用都是针对文件描述符的 标准C的I/O函数都是针对流(文件指针)的,我们使用一个流与一个文件相关联   2.缓冲 标准I/O库提供缓冲的目的就是尽可能减少r ...

  5. Codeforces878C. Tournament

    $n \leq 50000$个人,每个人有$K \leq 10$个属性,现对每一个前缀问:进行比赛,每次任意两人比任意属性,小的淘汰(保证同一属性不会出现两个相同的数),最终有几个人有可能获胜. 明显 ...

  6. Object,String,StringBuffer,StringBuilder,System,Runtime,Date,Math介绍及用法(API)

    1       Object对象 面向对象的核心思想:“找合适的对象,做适合的事情”. 合适的对象: 自己描述类,自己创建对象. sun已经描述了好多常用的类,可以使用这些类创建对象. API(App ...

  7. 第5章-unix网络编程 TCP/服务端程序示例

    这一章主要是完成一个完整的tcp客户/服务器程序.通过一很简单的例子.弄清客户和服务器如何启动,如何终止,发生了某些错误会发生什么.这些事很重要的  客户端代码 #include "unp. ...

  8. Linux内核解析:进程间通信:管道

    管道的定义管道的用途管道的操作管道非法read与write内核实现解析管道通信原理及其亲戚通信解析父子进程通信解析亲缘关系的进程管道通信解析管道的注意事项及其性质管道有以下三条性质shell管道的实现 ...

  9. 将xml转换为PHP数组

    这里提供一个类来将XML转换为PHP数组,下面是类的代码 <?php/** * XML2Array: A class to convert XML to array in PHP * It re ...

  10. npm 安装出现 UNMET DEPENDENCY 的解决方案

    npm imuzhicloud@0.2.2 E:\com\muzhicloud_make_web+-- UNMET PEER DEPENDENCY react@15.4.2+-- react-dnd@ ...