ffmpeg在centos系统下的源文件下载脚本及编译脚本

下载脚本:

bash 复制代码
#只做下载的动作,之后可以移动到其它环境下编译
#from https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
#yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2
curl -O -L https://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
curl -O -L https://downloads.sourceforge.net/project/lame/lame/3.100/lame-3.100.tar.gz
curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
git clone --branch stable --depth 1 https://code.videolan.org/videolan/x264.git
git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git
git clone --depth 1 https://github.com/mstorsjo/fdk-aac
git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git

对于没有条件下载的同学,可使用本人下载好的文件(长期有效,包中有下载脚本和编译脚本及编译说明):

链接: https://pan.baidu.com/s/1seJxmmk21xiUl1AaLFJ0EA 提取码: hn6u

注意事项,重要事件说三遍:

注意下载的包解压之后路径一定要是:~/ffmpeg_sources

注意下载的包解压之后路径一定要是:~/ffmpeg_sources

注意下载的包解压之后路径一定要是:~/ffmpeg_sources

路径原因说明,见CompilationGuide/Centos -- FFmpeg

  • ffmpeg_sources -- Where the source files will be downloaded. This can be deleted if desired when finished with the guide.
  • ffmpeg_build -- Where the files will be built and libraries installed. This can be deleted if desired when finished with the guide.
  • bin -- Where the resulting binaries (ffmpeg, ffprobe, x264, x265) will be installed.

编译脚本:

bash 复制代码
# 只做编译的动作
#from https://trac.ffmpeg.org/wiki/CompilationGuide/Centos
yum install autoconf automake bzip2 bzip2-devel cmake freetype-devel gcc gcc-c++ git libtool make pkgconfig zlib-devel
#mkdir ~/ffmpeg_sources

cd ~/ffmpeg_sources
#curl -O -L https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/nasm-2.15.05.tar.bz2
tar xjvf nasm-2.15.05.tar.bz2
cd nasm-2.15.05
./autogen.sh
./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install


cd ~/ffmpeg_sources
#curl -O -L https://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="$HOME/ffmpeg_build" --bindir="$HOME/bin"
make
make install



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


cd ~/ffmpeg_sources
#git clone --branch stable --depth 2 https://bitbucket.org/multicoreware/x265_git
cd ~/ffmpeg_sources/x265_git/build/linux
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$HOME/ffmpeg_build" -DENABLE_SHARED:bool=off ../../source
make
make install



cd ~/ffmpeg_sources
#git clone --depth 1 https://github.com/mstorsjo/fdk-aac
cd fdk-aac
autoreconf -fiv
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install



cd ~/ffmpeg_sources
#curl -O -L https://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="$HOME/ffmpeg_build" --bindir="$HOME/bin" --disable-shared --enable-nasm
make
make install




cd ~/ffmpeg_sources
#curl -O -L https://archive.mozilla.org/pub/opus/opus-1.3.1.tar.gz
tar xzvf opus-1.3.1.tar.gz
cd opus-1.3.1
./configure --prefix="$HOME/ffmpeg_build" --disable-shared
make
make install



cd ~/ffmpeg_sources
#git clone --depth 1 https://chromium.googlesource.com/webm/libvpx.git
cd libvpx
./configure --prefix="$HOME/ffmpeg_build" --disable-examples --disable-unit-tests --enable-vp9-highbitdepth --as=yasm
make
make install


cd ~/ffmpeg_sources
#curl -O -L https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2
tar xjvf ffmpeg-snapshot.tar.bz2
cd ffmpeg
PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure \
  --prefix="$HOME/ffmpeg_build" \
  --pkg-config-flags="--static" \
  --extra-cflags="-I$HOME/ffmpeg_build/include" \
  --extra-ldflags="-L$HOME/ffmpeg_build/lib" \
  --extra-libs=-lpthread \
  --extra-libs=-lm \
  --bindir="$HOME/bin" \
  --enable-gpl \
  --enable-libfdk_aac \
  --enable-libfreetype \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvpx \
  --enable-libx264 \
  --enable-libx265 \
  --enable-nonfree
make
make install
hash -d ~/bin/ffmpeg

参考:

CompilationGuide/Centos -- FFmpeg

相关推荐
Re.不晚12 分钟前
Java图书管理系统(简易&保姆级)
java·linux·服务器·开发语言·学习·算法·intellij-idea
lly_csdn12321 分钟前
【Docker】常用命令汇总
linux·运维·docker·容器
敲上瘾25 分钟前
虚拟地址空间与物理内存(Linux系统)
linux·运维·服务器·开发语言·c++·算法·aigc
云边的快乐猫42 分钟前
在Linux中对mysql用户进行管理
linux·数据库·mysql·用户管理·用户权限
努力的Andy1 小时前
修改Docker 默认存储目录( Docker Root Dir: /var/lib/docker)
linux·docker·容器
MANX981 小时前
Linux Deploy安装Debian桌面
linux
李小白202002021 小时前
Linux 生成/proc/config.gz
linux·服务器·前端
我们的五年1 小时前
【Linux课程学习】:《简易版shell实现和原理》 《哪些命令可以让子进程执行,哪些命令让shell执行(内键命令)?为什么?》
linux·运维·服务器·学习
阿俊仔(摸鱼版)1 小时前
GPT分区、格式化与自动挂载
linux·服务器·云计算
康熙38bdc2 小时前
Linux 线程互斥
linux·运维·开发语言