python+scrcpy实现将安卓设备录屏并保存到pc本地

一)scrcpy下载及安装

参考链接:https://zhuanlan.zhihu.com/p/80264357

二)python+scrcpy实现将安卓设备录屏并保存到pc本地

示例代码:

import os,datetime

def screenrecords():
    now_time = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
    path = r'F:\screen\video_{}.mp4'.format(now_time)
    command = 'scrcpy -r {}'.format(path)
    try:
        print('录屏开始!')
        os.system(command)
    except:
        print('录屏失败!')
    print('录屏结束!')

if __name__ == '__main__':
    screenrecords()

友情链接:https://www.cnblogs.com/lxmtx/p/16202967.html

posted @ 2022-09-16 11:42  沐小木  Views(1319)  Comments(0Edit  收藏  举报