If you want to take Screen Shot of your device, refer post “How to Capture Screenshot in android using adb ?”
If you have developed an new app, or want to send someone how one app is behaving on certain screen touches, you will need to record the screen to video. Android provides a commandline tool “screenrecord” which you can use to record the video of your screen.
“screenrecord” command records screen activity to an MPEG-4 file. You can use this file to create promotional or training videos or for debugging and testing.
When you want to record the screen for your application, you need to start below command just before you want to start recording and till the command is not stopped everything will get captured in video.
$ adb shell screenrecord /sdcard/screen_video.mp4
When above command is started, do whatever activity you want to do on the screen and when you are done stop the command using “Crtl+C” and it will stop the capturing. Now, you can download the video using below command,
$ adb pull /sdcard/screen_video.mp4
/sdcard/screen_video: 1 file pulled. 19.5 MB/s (39801324 bytes in 1.945s)
Once you downloaded your video, you can install “mplayer” and play using command line as mentioned in “How to play Audio / Video from Ubuntu Linux command line”
Other possible options which can be used to finetune recording as per requirement can be viewed with help command as,
$ screenrecord --help
Usage: screenrecord [options] <filename>
Android screenrecord v1.2. Records the device's display to a .mp4 file.
Options:
--size WIDTHxHEIGHT
Set the video size, e.g. "1280x720". Default is the device's main
display resolution (if supported), 1280x720 if not. For best results,
use a size supported by the AVC encoder.
--bit-rate RATE
Set the video bit rate, in bits per second. Value may be specified as
bits or megabits, e.g. '4000000' is equivalent to '4M'. Default 20Mbps.
--bugreport
Add additional information, such as a timestamp overlay, that is helpful
in videos captured to illustrate bugs.
--time-limit TIME
Set the maximum recording time, in seconds. Default / maximum is 180.
--verbose
Display interesting information on stdout.
--help
Show this message.
Recording continues until Ctrl-C is hit or the time limit is reached.
For more advanced options you can refer to Android Website.