ios-minicap

优质
小牛编辑
124浏览
2023-12-01

ios-minicap

iOS Minicap provides a socket interface for streaming realtime screen capture data out of iOS devices.

ios-minicap

Requirements

  • brew install libjpeg-turbo (>=1.5 is required)
  • Xcode (for the Frameworks)
  • cmake (使用homebrew安装)
  • OS X Yosemite (10.9) or higher
  • iOS 8 or higher
  • Lightning cable. See the list of devices.

安装

  1. 下载项目, 如果有特殊要求, 比如存放路径请指明路径

     git clone https://github.com/openstf/ios-minicap
    
  2. 编译项目

     cd .../ios-minicap
    
     ./build.sh
    
     ./run.sh
    

    运行结果:

     ++ system_profiler SPUSBDataType
     ++ sed -n -E -e '/(iPhone|iPad)/,/Serial/s/ *Serial Number: *(.+)/\1/p'
     2020-11-26 10:11:57.631 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.632 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.632 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.632 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.633 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.633 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     2020-11-26 10:11:57.633 system_profiler[69681:1609223] SPUSBDevice: IOCreatePlugInInterfaceForService failed 0xe00002be
     + UDID=b6016a4b183682760ab483d3589b0c7da92d51fe
     + PORT=12345
     + RESOLUTION=400x600
     + ./build/ios_minicap --udid b6016a4b183682760ab483d3589b0c7da92d51fe --port 12345 --resolution 400x600
     EnableDALDevices
     2020-11-26 10:11:58.503 ios_minicap[69682:1609233] Available devices:
     2020-11-26 10:11:58.503 ios_minicap[69682:1609233] b6016a4b183682760ab483d3589b0c7da92d51fe
     2020-11-26 10:11:58.503 ios_minicap[69682:1609233] 0x8020000005ac8514
     resolution: 400x600
     Allocating 731648 bytes for JPEG encoder
     == Banner ==
     version: 1
     size: 24
     pid: 69682
     real width: 400
     real height: 600
     desired width: 400
     desired height: 600
     orientation:
     quirks: 1
     banner: 1183210109010058200901005820001
     New client connection
    

    运行成功后不要关闭窗口

  3. 运行demo

    另开一个tab

     cd .../ios-minicapexample
    
     npm install
    
     node app.js
    

    运行成功后, 通过浏览器打开: http://localhost:9002即可看到实时画面


桌面获取技术: (非越狱环境)

  1. Airplay Mirror

    Airplay是苹果提供一种多媒体多屏互动技术,可以将音频、照片、视频以及屏幕从iOS设备或者Mac电脑上传输到同局域网的接收设备上。这里的airplay-mirror技术就是屏幕数据传输的技术,因为该技术属于苹果私有协议方案,数据传输进行了加密,目前只有少数商业产品逆向破解了协议栈。例如AirServer 、LonelyScreen 、Reflector,还有国内的各种盒子,天猫盒子,小米盒子等

  2. 基于AVFoundationCoreMediaIO类库

    自从苹果发布 OS X Yosemite(10.10.x)和 iOS 8 以来,在QuickTime-Player屏幕录像中选择连接mac电脑的iphone手机即可获取手机屏幕的画面. 这个方法实际上是使用AVFoundation和CoreMediaIO库函数实现的屏幕获取。

  3. idevicescreenshot

    idevicescreenshot属于开源工具集的libimobiledevice的子集,可以在pc上对usb连接的ios设备进行截图,并将图片保存在pc本地,这种方式使用最简单但是效率较低,实际测试200-300ms左右完成1次截图,也就是1s只能完成3-5帧的视频传输速度。