Yes, I can get the png stream from the shell
adb exec-out screencap -p
python code like this
start_time = time()
pipe = subprocess.Popen("adb exec-out screencap -p", stdout=subprocess.PIPE, shell=True)
img_bytes = pipe.stdout.read()
read_time = time()
img = cv2.imdecode(np.frombuffer(img_bytes, np.uint8), cv2.IMREAD_COLOR)
end_time = time()
print('stream size', len(img_bytes))
print('read cost', read_time - start_time)
print('decode cost', end_time - read_time)
print('screencap cost', end_time - start_time)
Yet it is still too slow
size 2452217
read cost 2.630615234375
decode cost 0.0625
screencap cost 2.693115234375
Can I compress the screencap before output ?