Ubuntu14.04 安裝ffmpeg

一、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

又出現異常信息

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
[email protected] 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. 成功標誌

root@chenwr-pc:/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}...

安裝成功!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章