This guide is based on aminimal 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) andFedora. 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 (exceptmake; 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./configureoption in FFmpeg. For example,if libvorbis is not needed,then skip that section and then remove--enable-libvorbisfrom theInstall FFmpegsection.

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 theH.264 Encoding Guidefor more information and usage examples.

Requiresffmpegto 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 installmake distclean

libx265

H.265/HEVCvideo encoder. See theH.265 Encoding Guidefor more information and usage examples.

--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 audioencoder.

--enable-libfdk-aac(and--enable-nonfreeif 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.

--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 audiodecoder and encoder.

--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

Oggbitstreamlibrary. required bylibtheoraandlibvorbis.

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

Vorbisaudioencoder. Requireslibogg.

--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.

--enable-libvpx.


地址要改为https://github.com/webmproject/libvpx/ git clonehttps://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 andffmpeg(alsoffprobe,ffserver,250)">lame,andx264) should Now be ready to use. The rest of this guide shows how to update or remove FFmpeg.

编译完成后,会:


Tip:Keep theffmpeg_sourcesdirectory and all contents if you intend toupdateas 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./configure,250)">make,250)">make installas shown in theInstall yasmsection.

Update x264

cd ~/ffmpeg_sources/x264
make distclean
git pull

make installas shown in theInstall x264section.

Update x265

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

cmake,250)">make installas shown in theInstall x265section.

Update libfdk_aac

cd ~/ffmpeg_sources/fdk_aac
make distclean
git pull

make installas shown in theInstall libfdk_aacsection.

Update libvpx

cd ~/ffmpeg_sources/libvpx
make clean
git pull

make installas shown in theInstall libvpxsection.

Update FFmpeg

cd ~/ffmpeg_sources/ffmpeg
make distclean
git pull

make installas shown in theInstall FFmpegsection.


Reverting changes made by this guide
rm -rf ~/ffmpeg_build ~/ffmpeg_sources ~/bin/{ffmpeg,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-usermailing list.


Also See
  • H.264 Video Encoding Guide
  • AAC Audio Encoding Guide

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

  1. HTML5 播放 RTSP 视频的实例代码

    目前大多数网络摄像头都是通过 RTSP 协议传输视频流的,但是 HTML 并不标准支持 RTSP 流。本文重点给大家介绍HTML5 播放 RTSP 视频的实例代码,需要的朋友参考下吧

  2. ios – ffmpeg不会在我的项目中构建,在示例应用程序中运行良好

    我已经尝试了几个小时,但我无法弄清楚这一点.我在我的项目中使用KXMOVIE.我按照指示下载并编译了ffmpeg二进制文件.示例应用程序实际上工作正常,但我不能让它在我自己的项目中构建.所有.a文件都在那里,它与示例应用程序中的文件完全相同.当我尝试为模拟器构建时,我收到此错误.我究竟做错了什么?我甚至不知道从哪里开始.解决方法您还需要与libiconv链接.假设你拥有它,请将-liconv作为链接选项.

  3. ios – 如何将YUVJ420P中的FFMPEG AVFrame转换为AVFoundation cVPixelBufferRef?

    我在YUVJ420P中有一个FFMPEGAVFrame,我想用CVPixelBufferCreateWithBytes将它转换为CVPixelBufferRef.我想这样做的原因是使用AVFoundation来显示/编码帧.我选择了kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange并尝试转换它,因为AVFrame有三个平面的数据Y480Cb240Cr24

  4. Project Perfect让Swift在服务器端跑起来-在Linux上创建你的Perfect项目(三)

    前两篇,分别讲述了入门和在Linux下部署,现在得说说如何在Linux下开发了。在Linux下开发,相对比在Mac下开发更灵活。我们先来看看构建基于Perfect的网站服务的编译方式如图通过引用基础库PerfectLib和数据链接,中间件模块创建你的网页文件,并用makefile打包生成你的网站动态库。所以如果你只是在Linux下构建项目,你只需要先创建好你的Handlers.swift即可。根据上面的方式我们开始在Linux下创建我们的Perfect项目。这里我在Perfect文件夹创建了一个Demo文

  5. 使用 Swift 语言编写 Android 应用入门

    Swift标准库可以编译安卓armv7的内核,这使得可以在安卓移动设备上执行Swift语句代码。做梦,虽然Swift编译器可以胜任在安卓设备上编译Swift代码并运行。这需要的不仅仅是用Swift标准库编写一个APP,更多的是你需要一些框架来搭建你的应用用户界面,以上这些Swift标准库不能提供。简单来说,构建在安卓设备上使用的Swiftstdlib需要libiconv和libicu。通过命令行执行以下命令:gitclonegit@github.com:SwiftAndroid/libiconv-libi

  6. Project Perfect让Swift在服务器端跑起来-Hi Linux(二)

    开篇写了一个简单的入门,今天想说说怎么让Perfect项目在Linux上运行。Swift开源后,苹果让Swift不仅在OSX/iOS上跑,更让Swift在Linux/Windows上跑。作为服务端的Perfect框架+RemObjectSilver,让Swift成为了一个全栈语言。Perfect由于是服务端的,让Perfect在Linux上跑是必然的事情。从第一篇文章中我们可以了解到Perfect由PerfectLib和PerfectServer组成。

  7. Project Perfect让Swift在服务器端跑起来-在Linux上创建你的Perfect项

    前两篇,分别讲述了入门和在Linux下部署,现在得说说如何在Linux下开发了。在Linux下开发,相对比在Mac下开发更灵活。我们先来看看构建基于Perfect的网站服务的编译方式如图通过引用基础库PerfectLib和数据链接,中间件模块创建你的网页文件,并用makefile打包生成你的网站动态库。所以如果你只是在Linux下构建项目,你只需要先创建好你的Handlers.Swift即可。根据上面的方式我们开始在Linux下创建我们的Perfect项目。

  8. Swift for OS X编译Linux?

    我对其他平台上Swift的构建过程感到困惑.Swift是否允许我在OSX上构建Linux项目,或者我是否需要在Linux上专门使用Swift来构建我计划在那里使用的任何东西?我查看了documentation,但这个主题并不是很清楚……

  9. Swift 2和Linux / OS X的区别

    我正在尝试将一些基本的应用程序从OSX移植到Linux,但似乎Linux平台上缺少基本的东西.有些文件缺少什么?

  10. 将Trickle移植到android

    >如何告诉编译器链接我之前为android交叉编译的共享库,以便为android生成最终的可执行命令行应用程序.而且这甚至可以在Android上移植涓流?

随机推荐

  1. 在airgapped(离线)CentOS 6系统上安装yum软件包

    我有一个CentOS6系统,出于安全考虑,它已经被空气泄漏.它可能从未连接到互联网,如果有,它很长时间没有更新.我想将所有.rpm软件包放在一个驱动器上,这样它们就可以脱机安装而无需查询互联网.但是,我在测试VM上遇到的问题是,即使指定了本地路径,yum仍然会挂起并尝试从在线存储库进行更新.另外,有没有办法使用yum-utils/yumdownloader轻松获取该包的所有依赖项和所有依赖项?目前

  2. centos – 命名在日志旋转后停止记录到rsyslog

    CentOS6.2,绑定9.7.3,rsyslog4.6.2我最近设置了一个服务器,我注意到在日志轮换后,named已停止记录到/var/log/messages.我认为这很奇怪,因为所有日志记录都是通过rsyslog进行的,并且named不会直接写入日志文件.这更奇怪,因为我在更新区域文件后命名了HUPed,但它仍然没有记录.在我停止并重新启动命名后,记录恢复.这里发生了什么?

  3. centos – 显示错误的磁盘大小

    对于其中一个磁盘,Df-h在我的服务器上显示错误的空白区域:Cpanel表明它只有34GB免费,但还有更多.几分钟前,我删除了超过80GB的日志文件.所以,我确信它完全错了.fdisk-l/dev/sda2也显示错误:如果没有格式化,我该怎么做才能解决这个问题?并且打开文件描述符就是它需要使用才能做到这一点.所以…使用“lsof”并查找已删除的文件.重新启动写入日志文件的服务,你很可能会看到空间可用.

  4. 如何在centos 6.9上安装docker-ce 17?

    我目前正在尝试在centOS6.9服务器上安装docker-ce17,但是,当运行yuminstalldocker-ce时,我收到以下错误:如果我用跳过的标志运行它我仍然得到相同的消息,有没有人知道这方面的方法?

  5. centos – 闲置工作站的异常负载平均值

    我有一个新的工作站,具有不寻常的高负载平均值.机器规格是:>至强cpu>256GB的RAM>4x512GBSSD连接到LSI2108RAID控制器我从livecd安装了CentOS6.564位,配置了分区,网络,用户/组,并安装了一些软件,如开发工具和MATLAB.在启动几分钟后,工作站负载平均值的值介于0.5到0.9之间.但它没有做任何事情.因此我无法理解为什么负载平均值如此之高.你能帮我诊断一下这个问题吗?

  6. centos – Cryptsetup luks – 检查内核是否支持aes-xts-plain64密码

    我在CentOS5上使用cryptsetupluks加密加密了一堆硬盘.一切都很好,直到我将系统升级到CentOS6.现在我再也无法安装磁盘了.使用我的关键短语装载:我收到此错误:在/var/log/messages中:有关如何装载的任何想法?找到解决方案问题是驱动器使用大约512个字符长的交互式关键短语加密.出于某种原因,CentOS6中的新内核模块在由旧版本创建时无法正确读取512个字符的加密密钥.似乎只会影响内核或cryptsetup的不同版本,因为在同一系统上创建和打开时,512字符的密钥将起作用

  7. centos – 大量ssh登录尝试

    22个我今天登录CentOS盒找到以下内容这是过去3天内的11次登录尝试.WTF?请注意,这是我从我的提供商处获得的全新IP,该盒子是全新的.我还没有发布任何关于此框的内容.为什么我会进行如此大量的登录尝试?是某种IP/端口扫描?基本上有4名匪徒,其中2名来自中国,1名来自香港,1名来自Verizon.这只发生在SSH上.HTTP上没有问题.我应该将罪魁祸首子网路由吗?你们有什么建议?

  8. centos – kswap使用100%的CPU,即使有100GB的RAM也可用

    >Linux内核是否应该足够智能,只需从内存中清除旧缓存页而不是启动kswap?

  9. centos – Azure将VM从A2 / 3调整为DS2 v2

    我正在尝试调整前一段时间创建的几个AzureVM,从基本的A3和标准A3到标准的DS2v2.我似乎没有能力调整到这个大小的VM.必须从头开始重建服务器会有点痛苦.如果它有所不同我在VM中运行CentOS,每个都有一个带有应用程序和操作系统的磁盘.任何人都可以告诉我是否可以在不删除磁盘的情况下删除VM,创建新VM然后将磁盘附加到新VM?

  10. centos – 广泛使用RAM时服务器计算速度减慢

    我在非常具体的情况下遇到服务器速度下降的问题.事实是:>1)我使用计算应用WRF>2)我使用双XeonE5-2620v3和128GBRAM(NUMA架构–可能与问题有关!

返回
顶部