欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

Ubuntu16.04 FFMPEG 编译与安装

程序员文章站 2022-07-13 13:23:29
...

FFMPEG下载

(如果只是想编译Android使用的库请看 Android FFMPEG 编译脚本)

安装依赖库

$ sudo apt-get update

$ sudo  apt-get install pkg-config

$ sudo apt-get install yasm

$ sudo  apt-get install libx264-dev

$ sudo  apt-get install libfaac-dev

$ sudo apt-get install libmp3lame-dev

$ sudo apt-get install libtheora-dev

$ sudo apt-get install libvorbis-dev

$ sudo apt-get install libxvidcore-dev

$ sudo apt-get install libxext-dev

$ sudo apt-get install libxfixes-dev

$ sudo  apt-get install libspeex-dev

 

安装fdk-aac

$ wget -O fdk-aac.tar.gz https://github.com/mstorsjo/fdk-aac/tarball/master


$ tar xzvf fdk-aac.tar.gz


$ mstorsjo-fdk-aac-e7d8591/


$ sudo apt install autoconf


$ autoreconf -fiv
# $ ./configure  备用方案


$ ./configure --prefix="$HOME/ffmpeg_build"--disable-shared


$ make && sudo make install


./configure

 

切换到FFMPEG目录下编译Make文件代码 

$ ./configure --prefix=/usr/local/ffmpeg  \
                  --enable-gpl  \
                  --enable-nonfree  \
                  --enable-libfdk-aac  \
                  --enable-libx264  \
                  --enable-libx265  \
                  --enable-filter=delogo  \
                  --enable-debug  \
                  --disable-optimizations  \
                  --enable-libspeex  \
                  --enable-shared  \
                  --enable-pthreads
$ sudo make && make install

打开  ld.so.conf添加 /usr/local/ffmpeg/lib

$ sudo gedit /etc/ld.so.conf
include /etc/ld.so.conf.d/*.conf
添加ffmpeg的路径
/usr/local/ffmpeg/lib
 $ sudo ldconfig

打开~/.bashrc 添加全局路径 

$ sudo vim ~/.bashrc

添加如下内容 

export PATH=$PATH:/usr/local/ffmpeg/bin
source ~/.bashrc

命令行 ffmpeg 出现如下标示配置成功

$ ffmpeg 
ffmpeg version 4.2.git Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.12) 20160609
  configuration: --prefix=/usr/local/ffmpeg --enable-gpl --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-libx265 --enable-filter=delogo --enable-debug --disable-optimizations --enable-libspeex --enable-shared --enable-pthreads
  libavutil      56. 45.100 / 56. 45.100
  libavcodec     58. 84.100 / 58. 84.100
  libavformat    58. 43.100 / 58. 43.100
  libavdevice    58.  9.103 / 58.  9.103
  libavfilter     7. 81.100 /  7. 81.100
  libswscale      5.  6.101 /  5.  6.101
  libswresample   3.  6.100 /  3.  6.100
  libpostproc    55.  6.100 / 55.  6.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Use -h to get full help or, even better, run 'man ffmpeg'

查看文档帮助 

./configure --help | more

支持的编码格式 ,可以查看到非常非常多的编码格式

./configure --list-decoders 

FFMPEG  处理 流程

Ubuntu16.04 FFMPEG 编译与安装