Naive Android Screen Stream Reader, this project decodes Android screenrecord stream to OpenCV via ADB. Written in Python.
- Python >= 3.6
pip3 install adb-shell av opencv-python
Install adb-shell[usb]
if you want to connect via USB.
pip3 install adb-shell[usb]
- A system that is strong enough to decode H264 stream.
- Android >= 4.4
- Check your config file.
# This is the json file for MuMu 12 Simulator
{
"adb_ip": "127.0.0.1",
"adb_port": 7555, # usually this should be 5555 on other devices / simulators
"adb_key": "mykey", # required by the real phone, optional for simulator. Use `keygen.py` to gen your key.
"adb_timeout": 10.0,
"size": [960, 540], # optional
"bitrate": "4M" # optional
}
- Launch the code using a config file:
python3 main.py mumu12.json
Wait several seconds for the decoder to receive enough data, then a opencv window will pop up.
You may need to allow the connection on your phone when connecting for the first time.
- Press Enter or ESC to quit.
- On windows, when connecting to a phone, an error raised as
usb1.USBErrorAccess: LIBUSB_ERROR_ACCESS [-3]
. According to this issue, kill all adb procs will solve the problem.
taskkill /F /IM adb.exe
This project is built on adb-shell and PyAV. I would like to thank all the authors for their wonderful works. Meanwhile, I learned a lot from this post.