Skip to main content

ADB Screenshots as fast as scrcpy, but 100% native!

Tested against Windows / Python 3.11 / Anaconda

pip install adbnativeblitz

AdbFastScreenshots offers a powerful and efficient way to capture Android device screens, making it a valuable tool for a wide range of applications and use cases. As fast as https://github.com/hansalemaos/adbblitz , but 100% native!

Advantages:

High Frame Rate:

AdbFastScreenshots is designed to capture the Android device's screen with an improved frame rate, which can be especially useful for applications that require real-time or high-speed screen recording, such as gaming or performance analysis.

Efficiency:

By avoiding the overhead of creating a new subprocess for each screen capture session, it is more efficient and less resource-intensive than traditional methods, making it suitable for continuous screen capture.

Ease of Use:

It provides a Pythonic interface for screen capturing, making it easier for developers to integrate Android screen recording into their applications.

Control and Flexibility:

It allows users to control the screen recording process, including starting and stopping capture, making it suitable for custom applications that require precise control.

Context Manager:

Designed to be used as a context manager, it ensures proper resource cleanup and termination, which is important in long-running applications.

Example with Bluestacks:

YT https://www.youtube.com/watch?v=Sw-F1sobIlY

Capture Android device screen using ADB's screenrecord with high frame rate.

This class allows capturing the screen of an Android device using ADB's screenrecord
command with an improved frame rate. It continuously captures frames from the device
and provides them as NumPy arrays to the caller.

Args:
	adb_path (str): The path to the ADB executable.
	device_serial (str): The serial number of the target Android device.
	time_interval (int): The maximum duration, in seconds, for each screen recording session (up to a maximum of 180 seconds). After reaching this time limit, a new recording session automatically starts without causing interruptions to the user experience.
	width (int): The width of the captured screen.
	height (int): The height of the captured screen.
	bitrate (str): The bitrate for screen recording (e.g., "20M" for 20Mbps).
	use_busybox (bool): Whether to use BusyBox for base64 encoding.
	connect_to_device (bool): Whether to connect to the device using ADB.
	screenshotbuffer (int): The size of the frame buffer to store the last captured frames.
	go_idle (float): The idle time (in seconds) when no new frames are available. # higher value -> less fps, but also less CPU usage.

Attributes:
	stop_recording (bool): Control attribute to stop the screen capture.

Methods:
	stop_capture(): Stops the screen capture.

Usage:
	import cv2
	from adbnativeblitz import AdbFastScreenshots

	with AdbFastScreenshots(
		adb_path=r"C:\Android\android-sdk\platform-tools\adb.exe",
		device_serial="127.0.0.1:5555",
		time_interval=179,
		width=1600,
		height=900,
		bitrate="20M",
		use_busybox=False,
		connect_to_device=True,
		screenshotbuffer=10,
		go_idle=0,
	) as adbscreen:
		for image in adbscreen:
			cv2.imshow("CV2 WINDOW", image)
			if cv2.waitKey(1) & 0xFF == ord("q"):
				break
	cv2.destroyAllWindows()


Note:
- The `AdbFastScreenshots` class should be used in a context manager (`with` statement).
- The `stop_capture()` method can be called to stop the screen capture.
- The frames are continuously captured and provided in the form of NumPy arrays.
- The class aims to achieve a higher frame rate by avoiding slow subprocess creation
  for each screen capture session.

Metadata

Release files for adbnativeblitz 0.11

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for adbnativeblitz 0.11
File Size Uploaded Provenance Actions
adbnativeblitz-0.11.tar.gz 8.6 kB Without provenance Details for adbnativeblitz-0.11.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for adbnativeblitz 0.11
File Interpreter ABI Platform Actions
adbnativeblitz-0.11-py3-none-any.whl Python 3 none any Details for adbnativeblitz-0.11-py3-none-any.whl

Total release size: 19.6 kB

Release files / adbnativeblitz-0.11.tar.gz

Download URL adbnativeblitz-0.11.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ec2e9039abac1a7135e06551e3624241abf9870d2e4f9bd9d934a01f646dd979
BLAKE2b-256 checksum
How to use checksums
6320ac84712a9b9bc53abe5be63993e6442c8cc4c406421e50f4937062c69cee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / adbnativeblitz-0.11-py3-none-any.whl

Download URL adbnativeblitz-0.11-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f73a8f3dc839c6979e9db00bace4a4f61e66cecc79f4055938353c1787f47701
BLAKE2b-256 checksum
How to use checksums
f36ae04ef314d799faa9d2c24155a42ba48b1a2c45e09a851e13398b18f2b416
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for adbnativeblitz 0.11

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page