From docs :
Taking a device screenshot
The screencap command is a shell utility for taking a screenshot of a device display. While in a shell, the syntax is:
screencap <filename>
To use the screencap from the command line, type the following:
$ adb shell screencap /sdcard/screen.png
Here's an example screenshot session, using the adb shell to capture the screenshot and the pull command to download the file from the device:
$ adb shell
shell@ $ screencap /sdcard/screen.png
shell@ $ exit
$ adb pull /sdcard/screen.png
Recording a device screen
The screenrecord command is a shell utility for recording the display of devices running Android 4.4 (API level 19) and higher. The utility records screen activity to an MPEG-4 file.
Note: Audio is not recorded with the video file.
A developer can use this file to create promotional or training videos. While in a shell, the syntax is:
screenrecord [options] <filename>
To use screenrecord from the command line, type the following:
$ adb shell screenrecord /sdcard/demo.mp4
Stop the screen recording by pressing Ctrl-C, otherwise the recording stops automatically at three minutes or the time limit set by --time-limit.
To begin recording your device screen, run the screenrecord command to record the video. Then, run the pull command to download the video from the device to the host computer. Here's an example recording session:
$ adb shell
shell@ $ screenrecord --verbose /sdcard/demo.mp4
(press Ctrl-C to stop)
shell@ $ exit
$ adb pull /sdcard/demo.mp4
The screenrecord utility can record at any supported resolution and bit rate you request, while retaining the aspect ratio of the device display. The utility records at the native display resolution and orientation by default, with a maximum length of three minutes.
There are some known limitations of the screenrecord utility that you should be aware of when using it:
Some devices may not be able to record at their native display resolution. If you encounter problems with screen recording, try using a lower screen resolution.
Rotation of the screen during recording is not supported. If the screen does rotate during recording, some of the screen is cut off in the recording.