技术中心

这里象征着我们的态度和能力

Linux安装ffmpeg-完整安装文档
作者:admin    来源:本站原创    发布时间:2018-07-30      浏览次数:7088
分享到:

Linux安装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 -L http://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

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

 

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


4000-880-989
(24小时热线)
联系客服
微信公众号

官方公众号

小程序

©2008-2022 CORPORATION ALL Rights Reserved. 昆明奥远科技有限公司版权所有 滇ICP备09003328号-1 滇公网安备 53011102000818号
昆明那家网络公司好,新媒体运营,网站优化,网络推广,网站建设,网页设计,网站设计,网站推广,云南网站公司,昆明新媒体公司,云南网红主播,昆明SEO公司,昆明网站建设,昆明网络推广,昆明网站优化,昆明网站推广,红河网站建设,大理网络公司,曲靖网络公司,丽江网站设计,昭通网络公司,保山大数据服务,智慧高速建设,智慧校园服务,云南IDC服务商,网络安全测评,等保测评,网站关键词排名优化服务,服务客户尽超2000余家,一切尽在奥远科技,服务电话:13888956730