1. 程式人生 > 其它 >Mac FFmpeg編譯和解決nasm/yasm not found or too old錯誤

Mac FFmpeg編譯和解決nasm/yasm not found or too old錯誤

Mac FFmpeg視訊教學教材:https://pan.baidu.com/s/1Rta82eL0xiE_ciliTiA58g
提取碼:g7c4

FFmpeg編譯

  1. 下載程式碼:git clone https://git.ffmpeg.org/ffmpeg.git
  2. 然後輸入命令進行編譯:找到下載的目錄下,然後用命令進入這個資料夾下cd ffmpeg,然後輸入./configure。
  3. 竟然沒有編譯過出現錯誤是
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 ffmpeg-[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.

  

分析:yasm是彙編編譯器,ffmpeg為了提高效率使用了彙編指令,如MMX和SSE等。所以系統中未安裝yasm時,就會報上面錯誤。

解決錯誤:安裝yasm編譯器。安裝方法如下:

 1 1)下載:[yasm的下載連結](http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz)
 2 
 3 2)解壓:把下載下來的壓縮包進行解壓
 4 
 5 3)切換路徑: cd yasm-1.3.0
 6 
 7 4)執行配置: ./configure
 8 
 9 5)編譯:make
10 
11 6)安裝:make install(提示:Permission denied,就執行sudo make install)
  1. 安裝成功yasm你可以在進入到ffmpeg的資料夾下,進行./configure
  2. make
  3. make install(提示:Permission denied,就執行sudo make install)
  4. 然後打出ffmpeg
     1 ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
     2   built with Apple LLVM version 7.0.2 (clang-700.1.81)
     3   configuration: 
     4   libavutil      56. 22.100 / 56. 22.100
     5   libavcodec     58. 35.100 / 58. 35.100
     6   libavformat    58. 20.100 / 58. 20.100
     7   libavdevice    58.  5.100 / 58.  5.100
     8   libavfilter     7. 40.101 /  7. 40.101
     9   libswscale      5.  3.100 /  5.  3.100
    10   libswresample   3.  3.100 /  3.  3.100
    11 Hyper fast Audio and Video encoder
    12 usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...
    13 Use -h to get full help or, even better, run 'man ffmpeg'

    這樣ffmpeg就安裝成功了。

    ffplay: command not found
    如果你要用到ffplay的時候,發現沒有這個命令的時候,是因為ffplay和ffmpeg不是在一起的,需要單獨下載。ffplay下載地址 http://evermeet.cx/ffmpeg/ 。把下載下來的檔案雙擊開啟執行,如果提示Permission denied,到系統偏好設定,開啟安全與隱私,允許ffplay執行就可以了。執行完之後,再在.bash_profile檔案配置ffplay path就可以了(這個路徑就是ffplay檔案的位置)。

    ./configure --prefix=/usr/local/ffmpeg --enable-gpl --enable-small --arch=x86_64 --enable-nonfree --enable-libfdk-aac --enable-libx264 --enable-filter=delogo --enable-debug --disable-optimizations --enable-shared --enable-libfreetype

    ##安裝libx264
    下載地址http://download.videolan.org/pub/videolan/x264/snapshots/
    ./configure --enable-shared
    #make
    #make install

    libfdk_aac not found

    1 fdk_aac 下載地址https://sourceforge.net/projects/opencore-amr/files/fdk-aac/
    2 1.解壓縮
    3 2.  ./configure
    4 3. make
    5 4. make install (sudo make install)