Ubuntu Desktop 编译 ffmpeg (简略的写写)

关于ffmpeg

FFmpeg是一個自由軟體,可以執行音訊和視訊多種格式的錄影、轉檔、串流功能,包含了libavcodec——這是一個用於多個專案中音訊和視訊的解碼器函式庫,以及libavformat——一個音訊與視訊格式轉換函式庫。

--以上内容摘自 https://zh.wikipedia.org/wiki/FFmpeg

环境

Ubuntu Desktop 16.04 LTS

FFmpeg配置

1.关于yasm

在安装ffmpeg之前,还是先安装下yasm吧

(其实,也可以不装,在编译ffmpeg的时候加上 --disable-yasm 参数即可)

那么yasm是做什么用的呢?

Yasm is a complete rewrite of the NASM assembler under the “new” BSD License (some portions are under other licenses, see COPYING for details).

Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats.

Yasm can be easily integrated into Visual Studio 2005/2008 and 2010 for assembly of NASM or GAS syntax code into Win32 or Win64 object files.

以上是yasm官网的解释

其实就是英特尔X86架构下的汇编器和反汇编器,可以用来编写16位、32位(IA-32)和64位(x86-64)的程序。

2.安装yasm

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
tar -zxf yasm-1.3.0.tar.gz
cd yasm-1.3.0/
./configure
make
sudo make install
sudo ldconfig

3.编译ffmpeg

tar -jxf ffmpeg-4.0.1.tar.bz2 #我这里已经下载好了
cd ffmpeg-4.0.1/
./configure --prefix=/usr/local/ffmpeg --enable-shared
make
sudo make install

--enable-shared 参数据说是允许其编译产生动态库,在以后的编程中要用到这个几个动态库。

4.为了防止执行程序找不到库文件

可以将/usr/local/ffmpeg/lib目录设置到LD_LIBRARY_PATH环境变量

我是在Ubuntu的桌面版安装的,如果你是server版,可能会缺少很多库。请参考这里 在Ubuntu Server上编译FFmpeg

猜你喜欢

转载自www.cnblogs.com/wpjamer/p/9192141.html