2017-03-25 7 views
0

Mac에서 임의의 응용 프로그램에 대한 프레임 버퍼를 캡처하고 프레임별로 프레임 버퍼를 처리하려고합니다. 애플리케이션 내부 프레임 버퍼를 사용할 수 있습니까? 또한 전체 화면을 캡처 할 수있는 this과 같은 일부 그래픽 API 함수가 있음을 알았습니다.임의의 MacOS 응용 프로그램을위한 프레임 버퍼에 액세스

A) 전체 화면 이미지에서 내 창을 잘라 내야합니다. 0이 아닌 시간이 걸릴 수 있습니다.

B) 하나의 창 대신 전체 화면을 캡처하기 때문에 시간이 오래 걸립니다.

초당 20 프레임을 캡처하고 처리 할 수 ​​있기를 희망하므로 속도가 매우 중요합니다.

답변

3
나는 아이디어 몇 가지있다

... 첫째

, 가장 간단하게, 당신은 시작할 수 있습니다 (맥 OS와 함께 제공됩니다)과 File로 이동 퀵타임 ->New screen recording과의 임의의 영역을 기록 화면에 저장하고 동영상에 저장하고 나중에 프레임을 분석하십시오.

둘째, 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는 일반적으로 가장 느립니다. 나는 20 개 프레임이를 사용하여 적당한 크기의 창 두 번째를 얻을 수 있습니다 : 내 다른 링크 대답에 windowlist 프로그램에서 56을 가지고

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

.

+0

실시간으로 처리해야하므로 퀵타임으로는 충분하지 않지만 screencapture는 완벽하게 보입니다. 나는 그것을 들여다 보겠습니다, 정말 고마워요! – Nathan

관련 문제