Use-case
Mirror Android Screen to PC using USB
Potential (Native) Implementation Approaches
- Using Android Open-Source, modify screenrecord for your needs and re-install on your Android device using ADB
- Use well known native API such as OpenGL/OpenMAX to capture screen
Discussion
Approach #1 will certainly work ( under the shell account ), however, each time the Android OS is updated, the custom code will need to get updated to keep up with OS changes, with approach #2 the API stay fixed and there is no need to worry about OS changes, the question is whether it is possible to implement Mirroring solely using OpenGL/OpenMAX ?
Questions
Having the above said, what would be the best approach to mirror the android screen via USB ?
The
screenrecord
that ships with Android 5.0 "Lollipop" can send raw H.264 over ADB. The command line looks like:A few details are on the bigflake page. I've used it to mirror the screen onto a Linux workstation, but unfortunately I didn't save the VLC/mplayer command lines. Some player suggestions are here.
You can try to do uncompressed frames (
--output-format=raw-frames
), but at decent frame rates that easily overwhelms the ADB connection, even if the screen is tiny.Source code is here.