amd和arm安装ffmpeg踩坑报错处理

一、amd安装ffmpeg(yum安装)

系统版本:CentOS Linux release 7.2.1511 (Core) 

内核版本:3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

Nux Dextop文档:http://li.nux.ro/repos.html

# 安装 epel源
yum -y install epel-release 
# 安装 nux-dextop
rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
# 安装 ffmpeg
yum install -y ffmpeg ffmpeg-devel yasm 
# 检验安装成功
ffmpeg -version

 

 

 二、arm安装ffmpeg(编译安装)

因为Nux Dextop库没有arm的包,并且不使用yum安装的话,会缺少很多依赖包

# 安装yum源
yum install -y epel-release
####(编译需要的包 可以编译后删除) 
yum -y install gcc cmake gcc-c++

# 一些报错处理(同样适用于amd编译安装)

# --enable-gnutls
# 解决 ERROR: gnutls not found using pkg-config
yum -y install gnutls-devel
# --enable-ladspa 
# 解决 ERROR: ladspa.h header not found
yum -y install ladspa-devel
# --enable-libass
# 解决 ERROR: libass not found using pkg-config
yum -y install libass-devel
# --enable-libgsm
# 解决 ERROR: libgsm not found
yum -y install gsm-devel
# --enable-libmp3lame
# 解决 ERROR: libmp3lame >= 3.98.3 not found
yum -y install lame-devel
# --enable-libopenjpeg 
# 解决 ERROR: libopenjpeg not found
yum -y install openjpeg-devel
# --enable-libopus
# 解决 ERROR: opus not found using pkg-config
yum -y install opus-devel
# --enable-libpulse
# 解决 ERROR: libpulse not found using pkg-config
yum -y install pulseaudio-libs-devel
# --enable-libschroedinger
# 解决 ERROR: schroedinger-1.0 not found using pkg-config
yum -y install schroedinger-devel
# --enable-libsoxr
# 解决 ERROR: libsoxr not found
yum -y install soxr-devel
# --enable-libspeex 
# 解决 ERROR: speex not found using pkg-config
yum -y install speex-devel
# --enable-libtheora
# 解决 ERROR: libtheora not found
yum -y install libtheora-devel
# --enable-libv4l2
# 解决 ERROR: libv4l2 not found using pkg-config
yum -y install libv4l-devel
# --enable-libvorbis
# 解决 ERROR: libvorbis not found
yum -y install libvorbis-devel
# --enable-openal
# 解决 ERROR: openal not found
yum -y install openal-devel
# --enable-libdc1394
# 解决 ERROR: libdc1394-2 not found using pkg-config
yum -y install libdc1394-devel
# --enable-libcdio
# 解决 ERROR: No usable libcdio/cdparanoia found
yum -y install libcdio-paranoia-devel
# --enable-x11grab
# 解决 ERROR: Xlib not found
yum -y install libX11-devel
# 解决 make install后没有ffplay命令的问题
yum -y install SDL-devel
# 安装yasm
yum -y install yasm
# --enable-libfdk-aac 
# 解决 ERROR: libfdk_aac not found
# 包下载地址 https://sourceforge.net/projects/opencore-amr/files/fdk-aac/
tar xf fdk-aac-0.1.6.tar.gz
cd fdk-aac-0.1.6/
./configure && make -j`nproc`&& make install -j`nproc`
cd -
rm -f fdk-aac-0.1.6.tar.gz 
rm -rf fdk-aac-0.1.6/
# --enable-libopencore-amrnb 
# --enable-libopencore-amrwb
# 解决 ERROR: libopencore_amrnb not found    
# 解决 ERROR: libopencore_amrweb not found
# 包下载地址 https://sourceforge.net/projects/opencore-amr/files/opencore-amr/
tar xf opencore-amr-0.1.5.tar.gz
cd opencore-amr-0.1.5
./configure && make -j`nproc`&& make install -j`nproc`
cd -
rm -f opencore-amr-0.1.5.tar.gz
rm -rf opencore-amr-0.1.5
# --enable-libvo-amrwbenc
# 解决 ERROR: libvo_amrwbenc not found
# 包下载地址 https://sourceforge.net/projects/opencore-amr/files/vo-amrwbenc/
tar xf vo-amrwbenc-0.1.3.tar.gz 
cd vo-amrwbenc-0.1.3/
./configure && make -j`nproc`&& make install -j`nproc`
cd -
rm -f vo-amrwbenc-0.1.3.tar.gz
rm -rf vo-amrwbenc-0.1.3/
# --enable-libxvid 
# 解决 ERROR: libxvid not found
# 包下载地址:https://ftp.osuosl.org/pub/blfs/conglomeration/xvidcore/
tar xf xvidcore-1.3.7.tar.gz 
cd xvidcore/build/generic/
./configure --build=arm-linux && make -j`nproc`&& make install -j`nproc`
cd -
rm -f xvidcore-1.3.7.tar.gz
rm -rf xvidcore
# --enable-libx264
# 解决 ERROR: libx264 not found
# 包下载地址 http://ftp.videolan.org/pub/videolan/x264/snapshots/
tar xf x264-snapshot-20191217-2245.tar.bz2 
cd x264-snapshot-20191217-2245
./configure --enable-shared && make -j`nproc`&& make install -j`nproc`
cd -
rm -f x264-snapshot-20191217-2245.tar.bz2
rm -rf x264-snapshot-20191217-2245
# --enable-libx265
# 解决 ERROR: x265 not found using pkg-config
# 代码仓库克隆地址 hg clone http://hg.videolan.org/x265
# 源码地址:http://hg.videolan.org/x265/file/tip
# x265.tar.gz 是clone 源码后tar打包生成的
# 文档地址:https://www.videolan.org/developers/x265.html
# 解决 bash: hg: command not found   
# yum -y install hg
tar xf x265.tar.gz 
cd x265/build/arm-linux/
cmake ../../source
make -j`nproc` && make install -j`nproc`
cd -
rm -f x265.tar.gz
rm -rf x265
# 此路径为.pc文件所在路径
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
# 编译安装的so文件会去到/usr/local/lib  需要加到ld.so.conf文件中加载
echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
# ffmpeg
# 包下载地址:http://ffmpeg.org/releases/
tar xf ffmpeg-2.8.15.tar.gz
cd ffmpeg-2.8.15
./configure --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=aarch64 \
	--optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' \
	--extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib \
	--disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack \
	--enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger \
	--enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab \
	--enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping \
	--shlibdir=/usr/lib64 --enable-runtime-cpudetect
make -j`nproc` && make install -j`nproc`
cd -
rm -f ffmpeg-2.8.15.tar.gz
rm -rf ffmpeg-2.8.15

 

三、dockerfile(arm)

基于centos:7安装

系统版本:CentOS Linux release 7.9.2009 (AltArch)

内核版本:4.19.90-2003.4.0.0036.oe1.aarch64 #1 SMP Mon Mar 23 19:06:43 UTC 2020 aarch64 aarch64 aarch64 GNU/Linux

FROM centos:7

ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig

# ffmpeg 依赖的包
ADD x265.tar.gz /tmp
ADD ffmpeg-2.8.15.tar.gz /tmp
ADD fdk-aac-0.1.6.tar.gz /tmp
ADD xvidcore-1.3.7.tar.gz /tmp
ADD vo-amrwbenc-0.1.3.tar.gz /tmp 
ADD opencore-amr-0.1.5.tar.gz /tmp
ADD x264-snapshot-20191217-2245.tar.bz2 /tmp

RUN yum install -y epel-release \
    # 安装编译工具
    && yum -y install gcc cmake gcc-c++ \
    # 安装 ffmpeg 依赖
    && yum -y install \
    gnutls-devel \
    ladspa-devel \
    libass-devel \
    gsm-devel \
    lame-devel \
    openjpeg-devel \
    opus-devel \
    pulseaudio-libs-devel \
    schroedinger-devel \
    soxr-devel \
    speex-devel \
    libtheora-devel \
    libv4l-devel \
    libvorbis-devel \
    openal-devel \
    libdc1394-devel \
    libcdio-paranoia-devel \
    libX11-devel \
    SDL-devel \
    yasm \
    # 编译安装 fdk-aac
    && cd /tmp/fdk-aac-0.1.6 \
    && ./configure && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/fdk-aac-0.1.6 \
    # 编译安装 opencore-amr
    && cd /tmp/opencore-amr-0.1.5 \
    && ./configure && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/opencore-amr-0.1.5 \
    # 编译安装 vo-amrwbenc
    && cd /tmp/vo-amrwbenc-0.1.3 \
    && ./configure && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/vo-amrwbenc-0.1.3 \
    # 编译安装 xvidcore
    && cd /tmp/xvidcore/build/generic \
    && ./configure --build=arm-linux && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/xvidcore \
    # 编译安装 x264
    && cd /tmp/x264-snapshot-20191217-2245 \
    && ./configure --enable-shared && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/x264-snapshot-20191217-2245 \
    # 编译安装 x265
    && cd /tmp/x265/build/arm-linux \
    && cmake ../../source \
    && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/x265 \
    # 编译安装的so文件会去到 /usr/local/lib 需要加到ld.so.conf文件中加载
    && echo "/usr/local/lib" >> /etc/ld.so.conf && ldconfig \
    # 编译 ffmpeg
    && cd /tmp/ffmpeg-2.8.15 \
    && ./configure \
    --prefix=/usr \
    --bindir=/usr/bin \
    --datadir=/usr/share/ffmpeg \
    --incdir=/usr/include/ffmpeg \
    --libdir=/usr/lib64 \
    --mandir=/usr/share/man \
    --arch=aarch64 \
    --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' \
    --extra-ldflags='-Wl,-z,relro ' \
    --enable-libopencore-amrnb \
    --enable-libopencore-amrwb \
    --enable-libvo-amrwbenc \
    --enable-version3 \
    --enable-bzlib \
    --disable-crystalhd \
    --enable-gnutls \
    --enable-ladspa \
    --enable-libass \
    --enable-libcdio \
    --enable-libdc1394 \
    --enable-libfdk-aac \
    --enable-nonfree \
    --disable-indev=jack \
    --enable-libfreetype \
    --enable-libgsm \
    --enable-libmp3lame \
    --enable-openal \
    --enable-libopenjpeg \
    --enable-libopus \
    --enable-libpulse \
    --enable-libschroedinger \
    --enable-libsoxr \
    --enable-libspeex \
    --enable-libtheora \
    --enable-libvorbis \
    --enable-libv4l2 \
    --enable-libx264 \
    --enable-libx265 \
    --enable-libxvid \
    --enable-x11grab \
    --enable-avfilter \
    --enable-avresample \
    --enable-postproc \
    --enable-pthreads \
    --disable-static \
    --enable-shared \
    --enable-gpl \
    --disable-debug \
    --disable-stripping \
    --shlibdir=/usr/lib64 \
    --enable-runtime-cpudetect \
    && make -j`nproc` && make install -j`nproc` \
    && rm -rf /tmp/ffmpeg-2.8.15 \
    # 删除编译工具 清除yum缓存
    && yum -y remove gcc cmake gcc-c++ \
    && yum clean all

你可能感兴趣的:(ffmpeg)