首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

ceontOS6.x完整安装ffmpeg

ffmpeg-完整安装文档-自己整理测试好的

m3u8安装

安装ffmpeg

首先需要安装依赖包

yum -y install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

创建一个目录来存放ffmpegde的安装文件

mkdir /usr/local/finstall

安装NASM-必须安装,因为编译ffmpeg的时候需要这个

#进入目录

cd /usr/local/finstall

#下载nasm2.13.02压缩包

curl -O -Lhttp://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2

#解压

tar xjvf nasm-2.13.02.tar.bz2

#进入解压出来的目录

cd nasm-2.13.02

#编译和安装

./autogen.sh

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"

make

make install

安装Yasm-官方建议安装

cd /usr/local/finstall

curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

tar xzvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"

make

make install

h.264视频编码器。

需要配置——enable-gpl enable-libx264 ffmpeg。

进入目录

cd /usr/local/finstall

下载x264

git clone --depth 1 http://git.videolan.org/git/x264

cd x264

PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-static

make

make install

警告:如果报错Found no assembler. Minimum version is nasm-2.13。最低版本是nasm - 2.13,因为没有nasm2.13及以上。运行yum remove nasm && hash -r,然后重新安装nasm。

安装libx265

H.265 / HEVC视频编码器。看到H.265编码指南更多信息和使用的例子。

需要配置——enable-gpl enable-libx265 ffmpeg。

cd /usr/local/finstall

hg clone https://bitbucket.org/multicoreware/x265

cd /usr/local/finstall/x265/build/linux

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg" -DENABLE_SHARED:bool=off ../../source

make

make install

如果提示cmake版本过低:使用下面方法

#wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz #tar -xzvf cmake-2.8.11.2.tar.gz #cd cmake-2.8.11.2 #./bootstrap #make #make install

安装libfdk_aac

AAC音频编码器。看到AAC音频编码指南更多信息和使用的例子。

需要配置——ffmpeg enable-libfdk_aac(如果你还包括,enable-nonfree——enable-gpl)。

cd /usr/local/finstall

git clone --depth 1 https://github.com/mstorsjo/fdk-aac

cd fdk-aac

autoreconf -fiv

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

如果遇到错误:error: Libtool library used but 'LIBTOOL' is undefined

请在笔记中搜索autoconf

或按照下面方法重新安装以下程序

automake-1.12.1.tar.gz 包下载地址:http://ftp.gnu.org/gnu/automake/

autoconf-2.69.tar.gz 包下载地址:http://ftp.gnu.org/gnu/autoconf

libtool-2.2.4.tar.gz 包下载地址:http://ftp.gnu.org/gnu/libtool/

错误:autoreconf: configure.ac: not using Gettext

解决方法是安装完autoconf包之后,再安装automake包就可以了。

错误:configure.ac:36: error: possibly undefined macro: AC_PROG_LIBTOOL

解决方法是安装完autoconf包和automake包之后,再安装libtool包就可以了。

MP3音频编码器。

需要配置——enable-libmp3lame ffmpeg。

cd /usr/local/finstall

curl -O -L http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz

tar xzvf lame-3.100.tar.gz

cd lame-3.100

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --disable-shared --enable-nasm

make

make install

安装libopus

作品音频解码器和编码器。

需要配置——enable-libopus ffmpeg。

cd /usr/local/finstall

curl -O -L https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz

tar xzvf opus-1.2.1.tar.gz

cd opus-1.2.1

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

安装libogg

Ogg比特流库。所要求的libtheora和libvorbis.

cd /usr/local/finstall

curl -O -L http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz

tar xzvf libogg-1.3.3.tar.gz

cd libogg-1.3.3

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

安装libvorbis

Vorbis音频编码器。需要libogg.

需要配置——enable-libvorbis ffmpeg。

cd /usr/local/finstall

curl -O -L http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz

tar xzvf libvorbis-1.3.5.tar.gz

cd libvorbis-1.3.5

./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-shared

make

make install

VP8 / VP9视频编码器和译码器。

安装libvpx--------本次实验下载失败,另外找了一个libvpx1.6的压缩包,解压命令稍有变动

看到VP9视频编码指南更多信息和使用的例子。

需要配置——enable-libvpx ffmpeg。

cd /usr/local/finstall

git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git

tar xjvf libvpx-1.6.1.tar.bz2

cd libvpx-1.6.1

./configure --prefix="/usr/local/ffmpeg" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm

make

make install

安装FFmpeg

cd /usr/local/finstall

curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2

cd ffmpeg

PATH="/usr/local/bin:$PATH" PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure \

--prefix="/usr/local/ffmpeg" \

--pkg-config-flags="--static" \

--extra-cflags="-I/usr/local/ffmpeg/include" \

--extra-ldflags="-L/usr/local/ffmpeg/lib" \

--extra-libs=-lpthread \

--extra-libs=-lm \

--bindir="/usr/local/bin" \

--enable-gpl \

--enable-libfdk_aac \

--enable-libfreetype \

--enable-libmp3lame \

--enable-libopus \

--enable-libvorbis \

--enable-libvpx \

--enable-libx264 \

--enable-libx265 \

--enable-nonfree

make

make install

hash -r

安装完成

接下来进行测试

ffmpeg -i 20150526024734.flv -c:v libx264 -c:a aac -strict -2 -f hls -hls_time 15 -hls_list_size 0 test.m3u8

所有插件都安装,测试成功,可以正常分段视频m3u8安装

安装ffmpeg

首先需要安装依赖包

yum -y install autoconf automake bzip2 cmake freetype-devel gcc gcc-c++ git libtool make mercurial pkgconfig zlib-devel

创建一个目录来存放ffmpegde的安装文件

mkdir /usr/local/finstall

安装NASM-必须安装,因为编译ffmpeg的时候需要这个

#进入目录

cd /usr/local/finstall

#下载nasm2.13.02压缩包

curl -O -Lhttp://www.nasm.us/pub/nasm/releasebuilds/2.13.02/nasm-2.13.02.tar.bz2

#解压

tar xjvf nasm-2.13.02.tar.bz2

#进入解压出来的目录

cd nasm-2.13.02

#编译和安装

./autogen.sh

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"

make

make install

安装Yasm-官方建议安装

cd /usr/local/finstall

curl -O -L http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

tar xzvf yasm-1.3.0.tar.gz

cd yasm-1.3.0

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin"

make

make install

h.264视频编码器。

需要配置——enable-gpl enable-libx264 ffmpeg。

进入目录

cd /usr/local/finstall

下载x264

git clone --depth 1 http://git.videolan.org/git/x264

cd x264

PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --enable-static

make

make install

警告:如果报错Found no assembler. Minimum version is nasm-2.13。最低版本是nasm - 2.13,因为没有nasm2.13及以上。运行yum remove nasm && hash -r,然后重新安装nasm。

安装libx265

H.265 / HEVC视频编码器。看到H.265编码指南更多信息和使用的例子。

需要配置——enable-gpl enable-libx265 ffmpeg。

cd /usr/local/finstall

hg clone https://bitbucket.org/multicoreware/x265

cd /usr/local/finstall/x265/build/linux

cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/local/ffmpeg" -DENABLE_SHARED:bool=off ../../source

make

make install

如果提示cmake版本过低:使用下面方法

#wget http://www.cmake.org/files/v2.8/cmake-2.8.11.2.tar.gz #tar -xzvf cmake-2.8.11.2.tar.gz #cd cmake-2.8.11.2 #./bootstrap #make #make install

安装libfdk_aac

AAC音频编码器。看到AAC音频编码指南更多信息和使用的例子。

需要配置——ffmpeg enable-libfdk_aac(如果你还包括,enable-nonfree——enable-gpl)。

cd /usr/local/finstall

git clone --depth 1 https://github.com/mstorsjo/fdk-aac

cd fdk-aac

autoreconf -fiv

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

如果遇到错误:error: Libtool library used but 'LIBTOOL' is undefined

请在笔记中搜索autoconf

或按照下面方法重新安装以下程序

automake-1.12.1.tar.gz 包下载地址:http://ftp.gnu.org/gnu/automake/

autoconf-2.69.tar.gz 包下载地址:http://ftp.gnu.org/gnu/autoconf

libtool-2.2.4.tar.gz 包下载地址:http://ftp.gnu.org/gnu/libtool/

错误:autoreconf: configure.ac: not using Gettext

解决方法是安装完autoconf包之后,再安装automake包就可以了。

错误:configure.ac:36: error: possibly undefined macro: AC_PROG_LIBTOOL

解决方法是安装完autoconf包和automake包之后,再安装libtool包就可以了。

MP3音频编码器。

需要配置——enable-libmp3lame ffmpeg。

cd /usr/local/finstall

curl -O -L http://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz

tar xzvf lame-3.100.tar.gz

cd lame-3.100

./configure --prefix="/usr/local/ffmpeg" --bindir="/usr/local/bin" --disable-shared --enable-nasm

make

make install

安装libopus

作品音频解码器和编码器。

需要配置——enable-libopus ffmpeg。

cd /usr/local/finstall

curl -O -L https://archive.mozilla.org/pub/opus/opus-1.2.1.tar.gz

tar xzvf opus-1.2.1.tar.gz

cd opus-1.2.1

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

安装libogg

Ogg比特流库。所要求的libtheora和libvorbis.

cd /usr/local/finstall

curl -O -L http://downloads.xiph.org/releases/ogg/libogg-1.3.3.tar.gz

tar xzvf libogg-1.3.3.tar.gz

cd libogg-1.3.3

./configure --prefix="/usr/local/ffmpeg" --disable-shared

make

make install

安装libvorbis

Vorbis音频编码器。需要libogg.

需要配置——enable-libvorbis ffmpeg。

cd /usr/local/finstall

curl -O -L http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.5.tar.gz

tar xzvf libvorbis-1.3.5.tar.gz

cd libvorbis-1.3.5

./configure --prefix="/usr/local/ffmpeg" --with-ogg="/usr/local/ffmpeg" --disable-shared

make

make install

VP8 / VP9视频编码器和译码器。

安装libvpx--------本次实验下载失败,另外找了一个libvpx1.6的压缩包,解压命令稍有变动

看到VP9视频编码指南更多信息和使用的例子。

需要配置——enable-libvpx ffmpeg。

cd /usr/local/finstall

git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git

tar xjvf libvpx-1.6.1.tar.bz2

cd libvpx-1.6.1

./configure --prefix="/usr/local/ffmpeg" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm

make

make install

安装FFmpeg

cd /usr/local/finstall

curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2

cd ffmpeg

PATH="/usr/local/bin:$PATH" PKG_CONFIG_PATH="/usr/local/ffmpeg/lib/pkgconfig" ./configure \

--prefix="/usr/local/ffmpeg" \

--pkg-config-flags="--static" \

--extra-cflags="-I/usr/local/ffmpeg/include" \

--extra-ldflags="-L/usr/local/ffmpeg/lib" \

--extra-libs=-lpthread \

--extra-libs=-lm \

--bindir="/usr/local/bin" \

--enable-gpl \

--enable-libfdk_aac \

--enable-libfreetype \

--enable-libmp3lame \

--enable-libopus \

--enable-libvorbis \

--enable-libvpx \

--enable-libx264 \

--enable-libx265 \

--enable-nonfree

make

make install

hash -r

安装完成

接下来进行测试

ffmpeg -i 20150526024734.flv -c:v libx264 -c:a aac -strict -2 -f hls -hls_time 15 -hls_list_size 0 test.m3u8

所有插件都安装,测试成功,可以正常分段视频

传播正能量,拒绝冷漠!

  • 发表于:
  • 原文链接https://kuaibao.qq.com/s/20180522G0KH8T00?refer=cp_1026
  • 腾讯「腾讯云开发者社区」是腾讯内容开放平台帐号(企鹅号)传播渠道之一,根据《腾讯内容开放平台服务协议》转载发布内容。
  • 如有侵权,请联系 cloudcommunity@tencent.com 删除。

扫码

添加站长 进交流群

领取专属 10元无门槛券

私享最新 技术干货

扫码加入开发者社群
领券