I\'m using Windows 7 64 bit on my laptop and Android 5.0.1 on my Samsung Galaxy S4 device.
I\'m trying to stream my device\'s screen via adb using following code:
adb
In order to support the interactive adb shell
command the shell_service
uses pty. It helps to take care of all interactive user input like cursor key presses, etc. But the side effect of using pty
is that it mangles binary output of the process. This is why capturing the output of adb shell screenrecord
on the host side results in a corrupted file. Previously the only way to fix that was to post-process the file to remove those extra characters. But some time ago Google has added another version of the shell
command which does not have the interactive mode and therefore does not need to use the pty
. They called it exec-out
.
So in order to capture a file without corruption you should use
adb exec-out screenrecord --output-format=h264 -