2017-03-25 20 views
0

Mac上の任意のアプリケーションのフレームバッファをキャプチャし、フレームごとにフレームバッファを処理しようとしています。アプリケーションの内部フレームバッファにアクセスする方法はありますか?私はまた、画面全体をキャプチャすることができるthisのようないくつかのGraphics API関数があることに気づいたが、私は心配している。任意のMacOSアプリケーション用のフレームバッファへのアクセス

A)私は自分のウィンドウがどこにあるのか把握し、 0以外の時間がかかる可能性があります。

B)1つのウィンドウではなく画面全体をキャプチャしているので、時間がかかると思います。

私は、毎秒20フレームをキャプチャして処理できることを望んでいるので、速度はかなり重要です。

答えて

3

私はアイデアのカップルを持っている...まず

、最も単純に、あなたは(MacOSのが供給されている)のQuicktimeを開始し、Fileに行くことができます - >New screen recordingとの任意の領域を記録画面に保存してムービーに保存し、後でフレームを分析します。

第2に、screencapture/usr/sbin/screencapture)を使用して、キャプチャする矩形またはウィンドウIDを指定できます。マニュアルページが正しくないとゴミなので、実際のオプションを表示するには、以下の使用:あなたが見ることができるように

screencapture -h 

出力

usage: screencapture [-icMPmwsWxSCUtoa] [files] 
    -c   force screen capture to go to the clipboard 
    -b   capture Touch Bar - non-interactive modes only 
    -C   capture the cursor as well as the screen. only in non-interactive modes 
    -d   display errors to the user graphically 
    -i   capture screen interactively, by selection or window 
       control key - causes screen shot to go to clipboard 
       space key - toggle between mouse selection and 
          window selection modes 
       escape key - cancels interactive screen shot 
    -m   only capture the main monitor, undefined if -i is set 
    -M   screen capture output will go to a new Mail message 
    -o   in window capture mode, do not capture the shadow of the window 
    -P   screen capture output will open in Preview 
    -I   screen capture output will in a new Messages message 
    -s   only allow mouse selection mode 
    -S   in window capture mode, capture the screen not the window 
    -t<format> image format to create, default is png (other options include pdf, jpg, tiff and other formats) 
    -T<seconds> Take the picture after a delay of <seconds>, default is 5 
    -w   only allow window selection mode 
    -W   start interaction in window selection mode 
    -x   do not play sounds 
    -a   do not include windows attached to selected windows 
    -r   do not add dpi meta data to image 
    -l<windowid> capture this windowsid 
    -R<x,y,w,h> capture screen rect 
    -B<bundleid> screen capture output will open in app with bundleidBS 
    files where to save the screen capture, 1 file per screen 

を、-l-Rオプションは非常に便利です。

windowidsin another answer, hereのリストを取得するための小さなプログラムを作成しました。

ウィンドウのサイズとファイル形式が速度に違います。私はJPEGが通常最も速く、PNGが通常最も遅いことを見つける。私は私の他、リンクされた答えにwindowlistプログラムから56を得た

time for i in {0..99}; do screencapture -l 56 -t jpg fred-$i.jpg; done 

:私は20のフレーム、これを使用して、合理的なサイズのウィンドウを有する第二を得ることができます。

+0

リアルタイムで処理する必要があるためQuicktimeでは不十分ですが、screencaptureは完璧に見えます。私はそれを見て、ありがとう! – Nathan

関連する問題