adb screenrecord code example
Example: adb recorder
$ adb shell screenrecord /sdcard/video.mp4
#if you just get a black screen from recording - the resolution could be too high
#set a custom record resolution with --size parameter
$ adb shell screenrecord --size 1280x720 /sdcard/video.mp4