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

Ubuntu14.04 安装ffmpeg

程序员文章站 2022-07-05 16:34:19
...

一、xvid、x264、ffmpeg源码下载

链接:https://pan.baidu.com/s/13phSFrLqkGrKDGF3_a2cSA
提取码:ls2s

二、安装

1. xvid

  1. tar zxvf xvidcore-1.3.3.tar.gz
  2. cd xvidcore/build/generic
  3. ./configure --prefix=/usr/local/soft_install --enable-shared --enable-pic
  4. make -j 8
  5. make install

2. x264

  1. tar jxvf last_x264.tar.bz2
  2. cd x264-snapshot-20161225-2245
  3. ./configure --prefix=/usr/local/soft_install --enable-shared --enable-pic --disable-asm
  4. make -j 8
  5. make install

3. ffmpeg

  1. 安装依赖包
    sudo apt-get install libfaac-dev libmp3lame-dev libtheora-dev libvorbis-dev libxvidcore-dev libxext-dev libxfixes-dev

  2. ./configure --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab --enable-libvorbis

出现错误:

Unknown option "--enable-libfaac".
See ./configure --help for available options.

原因是新版ffmpeg已经remove了 libaac
Ubuntu14.04 安装ffmpeg

又出现异常信息

nasm/yasm not found or too old. Use --disable-x86asm for a crippled build.

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
aaa@qq.com mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.

添加–disable-x86asm 编译成功

./configure --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-libvorbis --disable-x86asm

三、修改环境变量

  1. vi /etc/profile
    在文件末尾添加
# ffmpeg
export PKG_CONFIG_PATH=/usr/local/soft_install/ffmpeg/lib/pkgconfig:$PKG_CONFIG_PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/soft_install/ffmpeg/lib
export PATH=$PATH:/usr/local/soft_install/ffmpeg/lib:/usr/local/soft_install/ffmpeg/bin
  1. source /etc/profile

  2. 成功标志

aaa@qq.com:/etc# ffmpeg
ffmpeg version 4.2 Copyright (c) 2000-2019 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.4)
  configuration: --prefix=/usr/local/soft_install/ffmpeg --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-pthreads --enable-libmp3lame --enable-libtheora --enable-libx264 --enable-libxvid --enable-libvorbis --disable-x86asm
  libavutil      56. 31.100 / 56. 31.100
  libavcodec     58. 54.100 / 58. 54.100
  libavformat    58. 29.100 / 58. 29.100
  libavdevice    58.  8.100 / 58.  8.100
  libavfilter     7. 57.100 /  7. 57.100
  libswscale      5.  5.100 /  5.  5.100
  libswresample   3.  5.100 /  3.  5.100
  libpostproc    55.  5.100 / 55.  5.100
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

安装成功!