1. 程式人生 > 實用技巧 >Processing 3.X 無法使用Video視訊庫並報錯的問題【已解決】

Processing 3.X 無法使用Video視訊庫並報錯的問題【已解決】

最近小朋友想玩攝像頭相關的數字藝術作品,於是開啟PDE,用自帶工具下載Video庫準備開始創作。

結果,一串鮮豔的紅字伴隨著PDE的卡死爆了出來:

UnsatisfiedLinkError: Could not load library: gstreamer
UnsatisfiedLinkError: Could not load library: gstreamer
A library relies on native code that's not available.
Or only works properly when the sketch is run as a 32-bit application.
UnsatisfiedLinkError: Could not load library: gstreamer
UnsatisfiedLinkError: Could not load library: gstreamer

心裡想著:不應該啊,Video基於GStream,已經用了好多年了,咋會突然報錯呢?

於是用上降版本大F,用2.2.1(32位)再執行一遍例子,此時更詳細的資訊冒出來了:

這裡PDE說“存在重複庫”,那問題就清楚了,是processing內建庫和第三方庫衝突了。

知道了問題產生的原因,解決起來就十分容易。

第1步:刪除Libraries資料夾中的Video庫
第2步:檢查3.X版本的Processing資料夾中是否有Video庫,如果沒有則將它複製過去

經過檢查,我發現從官網下載的3.5.3(64位)中沒有video庫,於是複製一個,問題解決。

Processing內建庫資料夾地址:
XXXX\processing
-3.5.3\modes\java\libraries\

最後,Video庫中其實是包含三種作業系統支援檔案的,分別是 MacOS 64位、Windows 32位、Windows 64位,如果你用的是蘋果電腦,那麼有可能需要將支援檔案拷貝一下即可。