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

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

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  
[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)下載:[yasm的下載連結](http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz)

2)解壓:把下載下來的壓縮包進行解壓

3)切換路徑: cd yasm-1.3.0

4)執行配置: ./configure

5)編譯:make

6)安裝:make install(提示:Permission denied,就執行sudo make install)
  1. 安裝成功yasm你可以在進入到ffmpeg的資料夾下,進行./configure
  2. make
  3. make install(提示:Permission denied,就執行sudo make install)
  4. 然後打出ffmpeg
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with Apple LLVM version 7.0.2 (clang-700.1.81)
  configuration: 
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.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'

這樣ffmpeg就安裝成功了。

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