Mac+android+scrcpy+adb 实现手机操作实时录屏
一、Mac电脑安装scrcpy,执行以下命令
brew install scrcpy
二、Mac电脑如果没有adb还需要安装adb来连接手机,命令如下:
brew cask install android-platform-tools
三、手机连接电脑执行以下命令可以开始实时录屏,以下两个命令选一个就OK
scrcpy --record xxx.mp4
scrcpy -r xxx.mp4
效果如下:
四、python脚本
import os from unpack import get_time from delfiles import del_file def screenrecords(): t = get_time() path = '/Users/lixuemei/Documents/python/pack/screen' video_path = '{}/video_{}.mp4'.format(path,t) del_file(path) command = 'scrcpy -r {}'.format(video_path) try: print('录屏开始!') os.system(command) except: print('录屏失败!') print('录屏结束!') if __name__ == '__main__': screenrecords()