LoginSignup
0
1

More than 3 years have passed since last update.

MacOS CatalinaでProcessing3のvideoライブラリを使えるようになった

Last updated at Posted at 2020-07-14

MacOS Catalinaにアップデートすると、32位のアプリはすべて使えなくなった。
これに関する記事:https://www.theverge.com/2019/10/12/20908567/apple-macos-catalina-breaking-apps-32-bit-support-how-to-prepare-avoid-update

現在ツールに提供しているvideoは32位のライブラリで使えなくなった。

解決方法はほとんどこの質問から見つけた:
https://github.com/processing/processing-video/issues/134
そこで、私の解決方法を整理して説明する。

a. このサイトで video2.0beta をダウンロードして、元のvideoライブラリを解冻したフォルダーに置き換える(元々videoがなかったらそのままライブラリのフォルダーに置いたらいい)。ライブラリフォルダーの場所はprocessingを開けたら processing - 環境設定 - スケッチブックの場所 からチェックできる。自分の場合は:/Users/codenew/Documents/Processing、その下のlibrariesにツールからダウンロードしたライブラリ全部ここに置いている。
b. ターミナルを開けて、video - library - macosxまでに行く。
コマンド:cd ~/Documents/processing/libraries/video/library/macosx
c. macosxフォルダーでこのコマンドを実行する:
xattr -p com.apple.quarantine libavcodec.58.35.100.dylib
実行した結果はこんな感じに見える:
0081;5dc1bfaa;Chrome;78F18F7D-3F71-4E55-8D58-BAB946AB4707
そこで、0081を00c1に変わって、新しい文字列を作る:
00c1;5dc1bfaa;Chrome;78F18F7D-3F71-4E55-8D58-BAB946AB4707

この文字列はパソコンによって違うので、自分の文字列で入れ替えよう

新しい文字列でこのコマンドを実行する:
xattr -w com.apple.quarantine "新しい文字列" *.dylib
そして、二つのコマンドを実行:
cd gstreamer-1.0
xattr -w com.apple.quarantine "新しい文字列" *.dylib
d. Finderを開けて、アプリケーションに行く。Processing.appを右クリックして、パッケージの内容を表示する。Contents/MacOSまで行く、Processingをダブルクリックする。
e. 開いたprocessingにカメラのテストコードを書く(ここはサンプルコードを使用した)

sample.pde
import processing.video.*;

Capture cam;

void setup() {
  size(640, 480);

  String[] cameras = Capture.list();

  if (cameras.length == 0) {
    println("There are no cameras available for capture.");
    exit();
  } else {
    println("Available cameras:");
    for (int i = 0; i < cameras.length; i++) {
      println(cameras[i]);
    }
    // The camera can be initialized directly using an 
    // element from the array returned by list():
    cam = new Capture(this, cameras[0]);
    cam.start();     
  }      
}

void draw() {
  if (cam.available() == true) {
    cam.read();
  }
  image(cam, 0, 0);
  // The following does the same, and is faster when just drawing the image
  // without any additional resizing, transformations, or tint.
  //set(0, 0, cam);
}

これを実行すると、カメラのアクセス許可が出るはず。それを許可する。
f. Contentsから開いたprocessingとターミナルを閉めて、いつものprocessingアプリを開いて、サンプルコードで実験すれば、カメラが動けるようになった!

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1