# 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://i.ytimg.com/vi/Sw-F1sobIlY/maxresdefault.jpg)](https://www.youtube.com/watch?v=Sw-F1sobIlY)
[https://www.youtube.com/watch?v=Sw-F1sobIlY]()
```python
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.
```
Raw data
{
"_id": null,
"home_page": "https://github.com/hansalemaos/adbnativeblitz",
"name": "adbnativeblitz",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "adb,screenshots,scrcpy",
"author": "Johannes Fischer",
"author_email": "aulasparticularesdealemaosp@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/63/20/ac84712a9b9bc53abe5be63993e6442c8cc4c406421e50f4937062c69cee/adbnativeblitz-0.11.tar.gz",
"platform": null,
"description": "\r\n# ADB Screenshots as fast as scrcpy, but 100% native!\r\n\r\n## Tested against Windows / Python 3.11 / Anaconda\r\n\r\n## pip install adbnativeblitz \r\n\r\nAdbFastScreenshots offers a powerful and efficient way to capture \r\nAndroid device screens, making it a valuable tool \r\nfor a wide range of applications and use cases.\r\nAs fast as https://github.com/hansalemaos/adbblitz , but 100% native! \r\n\r\n\r\n## Advantages:\r\n\r\n### High Frame Rate: \r\n\r\nAdbFastScreenshots is designed to capture the Android device's screen \r\nwith an improved frame rate, which can be especially useful for applications \r\nthat require real-time or high-speed screen recording, \r\nsuch as gaming or performance analysis.\r\n\r\n### Efficiency: \r\n\r\nBy avoiding the overhead of creating a new subprocess for each screen \r\ncapture session, it is more efficient and less \r\nresource-intensive than traditional methods, \r\nmaking it suitable for continuous screen capture.\r\n\r\n### Ease of Use: \r\n\r\nIt provides a Pythonic interface for screen capturing, \r\nmaking it easier for developers to integrate Android \r\nscreen recording into their applications.\r\n\r\n### Control and Flexibility: \r\n\r\nIt allows users to control the screen recording process, \r\nincluding starting and stopping capture, \r\nmaking it suitable for custom applications that \r\nrequire precise control.\r\n\r\n### Context Manager: \r\nDesigned to be used as a context manager, \r\nit ensures proper resource cleanup and termination, \r\nwhich is important in long-running applications.\r\n\r\n### Example with Bluestacks: \r\n\r\n[![YT](https://i.ytimg.com/vi/Sw-F1sobIlY/maxresdefault.jpg)](https://www.youtube.com/watch?v=Sw-F1sobIlY)\r\n[https://www.youtube.com/watch?v=Sw-F1sobIlY]()\r\n\r\n```python\r\nCapture Android device screen using ADB's screenrecord with high frame rate.\r\n\r\nThis class allows capturing the screen of an Android device using ADB's screenrecord\r\ncommand with an improved frame rate. It continuously captures frames from the device\r\nand provides them as NumPy arrays to the caller.\r\n\r\nArgs:\r\n\tadb_path (str): The path to the ADB executable.\r\n\tdevice_serial (str): The serial number of the target Android device.\r\n\ttime_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.\r\n\twidth (int): The width of the captured screen.\r\n\theight (int): The height of the captured screen.\r\n\tbitrate (str): The bitrate for screen recording (e.g., \"20M\" for 20Mbps).\r\n\tuse_busybox (bool): Whether to use BusyBox for base64 encoding.\r\n\tconnect_to_device (bool): Whether to connect to the device using ADB.\r\n\tscreenshotbuffer (int): The size of the frame buffer to store the last captured frames.\r\n\tgo_idle (float): The idle time (in seconds) when no new frames are available. # higher value -> less fps, but also less CPU usage.\r\n\r\nAttributes:\r\n\tstop_recording (bool): Control attribute to stop the screen capture.\r\n\r\nMethods:\r\n\tstop_capture(): Stops the screen capture.\r\n\r\nUsage:\r\n\timport cv2\r\n\tfrom adbnativeblitz import AdbFastScreenshots\r\n\r\n\twith AdbFastScreenshots(\r\n\t\tadb_path=r\"C:\\Android\\android-sdk\\platform-tools\\adb.exe\",\r\n\t\tdevice_serial=\"127.0.0.1:5555\",\r\n\t\ttime_interval=179,\r\n\t\twidth=1600,\r\n\t\theight=900,\r\n\t\tbitrate=\"20M\",\r\n\t\tuse_busybox=False,\r\n\t\tconnect_to_device=True,\r\n\t\tscreenshotbuffer=10,\r\n\t\tgo_idle=0,\r\n\t) as adbscreen:\r\n\t\tfor image in adbscreen:\r\n\t\t\tcv2.imshow(\"CV2 WINDOW\", image)\r\n\t\t\tif cv2.waitKey(1) & 0xFF == ord(\"q\"):\r\n\t\t\t\tbreak\r\n\tcv2.destroyAllWindows()\r\n\r\n\r\nNote:\r\n- The `AdbFastScreenshots` class should be used in a context manager (`with` statement).\r\n- The `stop_capture()` method can be called to stop the screen capture.\r\n- The frames are continuously captured and provided in the form of NumPy arrays.\r\n- The class aims to achieve a higher frame rate by avoiding slow subprocess creation\r\n for each screen capture session.\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "ADB Screenshots as fast as scrcpy, but 100% native!",
"version": "0.11",
"project_urls": {
"Homepage": "https://github.com/hansalemaos/adbnativeblitz"
},
"split_keywords": [
"adb",
"screenshots",
"scrcpy"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f36ae04ef314d799faa9d2c24155a42ba48b1a2c45e09a851e13398b18f2b416",
"md5": "53a892d5d557c709c061f4fc51916087",
"sha256": "f73a8f3dc839c6979e9db00bace4a4f61e66cecc79f4055938353c1787f47701"
},
"downloads": -1,
"filename": "adbnativeblitz-0.11-py3-none-any.whl",
"has_sig": false,
"md5_digest": "53a892d5d557c709c061f4fc51916087",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10987,
"upload_time": "2023-10-29T03:31:51",
"upload_time_iso_8601": "2023-10-29T03:31:51.329810Z",
"url": "https://files.pythonhosted.org/packages/f3/6a/e04ef314d799faa9d2c24155a42ba48b1a2c45e09a851e13398b18f2b416/adbnativeblitz-0.11-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6320ac84712a9b9bc53abe5be63993e6442c8cc4c406421e50f4937062c69cee",
"md5": "44d2a7192cf5deba5686a1eae01d9522",
"sha256": "ec2e9039abac1a7135e06551e3624241abf9870d2e4f9bd9d934a01f646dd979"
},
"downloads": -1,
"filename": "adbnativeblitz-0.11.tar.gz",
"has_sig": false,
"md5_digest": "44d2a7192cf5deba5686a1eae01d9522",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 8573,
"upload_time": "2023-10-29T03:31:53",
"upload_time_iso_8601": "2023-10-29T03:31:53.030245Z",
"url": "https://files.pythonhosted.org/packages/63/20/ac84712a9b9bc53abe5be63993e6442c8cc4c406421e50f4937062c69cee/adbnativeblitz-0.11.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-29 03:31:53",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hansalemaos",
"github_project": "adbnativeblitz",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "av",
"specs": []
}
],
"lcname": "adbnativeblitz"
}