Skip to content

Grab screen and control android device over adb using python3.12

License

Notifications You must be signed in to change notification settings

yixinNB/pyscrcpy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Python Scrcpy Client

Introduction

scrcpy-badge

A Python Library for scrcpy
pyscrcpy is an innovative Python library designed to simplify and streamline the integration of scrcpy into your Python projects. Scrcpy, a versatile screen mirroring tool for Android devices, gains a new level of accessibility through the seamless capabilities provided by pyscrcpy.

Key Features

  1. Easy Integration: With pyscrcpy, incorporating scrcpy functionality into your Python scripts becomes a straightforward process. The library abstracts away the complexities, allowing you to focus on leveraging scrcpy's powerful features without the need for intricate setup.
  2. Enhanced Control: pyscrcpy empowers developers to exert precise control over Android devices from within their Python applications. Whether it's automating UI interactions, conducting tests, or creating custom applications, pyscrcpy provides a convenient interface for managing scrcpy commands.
  3. Customization Options: Tailor scrcpy behavior to suit your project's requirements using the customizable options provided by pyscrcpy. Fine-tune parameters such as display size, bit rate, and more, all while maintaining the simplicity of Python scripting.

Demo & Tutorial

import cv2 as cv
from pyscrcpy import Client # import scrcpy client


def on_frame(client, frame):
    client.control.touch(300,500)# emulate touch on(300,500)
    cv.imshow('Video', frame)
    cv.waitKey(1)


def demo1():
    client = Client(max_fps=1, max_size=900)
    client.on_frame(on_frame)
    client.start()

def demo2():
    client = Client(max_fps=20)
    client.start(threaded=True)  # create a new thread for scrcpy
    while 1:
        if client.last_frame is None:
            continue
        on_frame(client, client.last_frame)

Reference & Appreciation

About

Grab screen and control android device over adb using python3.12

Topics

Resources

License

Stars

Watchers

Forks

Languages