1、adb连接Android设备使用screenrecord命令录屏
PS C:\Users\user> adb shell
root@rk322x_box:/ # screenrecord --help //查看screenrecord命令帮助
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 4Mbps.
--bugreport
Add additional information, such as a timestamp overlay, that is helpful
in videos captured to illustrate bugs.
--time-limit TIME //时间;默认最大180秒
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.
root@rk322x_box:/ # screenrecord --size 1920x1080 --bit-rate 8000000 --time-limit 10 /mnt/media_rw/3622-C659/test203.mp4 //录制视频
root@rk322x_box:/ # exit //退出Android shell
PS C:\Users\user\Desktop>
PS C:\Users\user\Desktop> adb pull /mnt/media_rw/3622-C659/test203.mp4 //把视频文件拉取到电脑桌面
/mnt/media_rw/3622-C659/test203.mp4: 1 file pulled, 0 skipped. 1.9 MB/s (436351 bytes in 0.219s)
2、adb连接Android设备使用screencap命令截屏
root@rk322x_box:/ # screencap -h //查看命令帮助
usage: screencap [-hp] [-d display-id] [FILENAME]
-h: this message
-p: save the file as a png.
-d: specify the display id to capture, default 0.
If FILENAME ends with .png it will be saved as a png.
If FILENAME is not given, the results will be printed to stdout.
root@rk322x_box:/ # exit
PS C:\Users\user\Desktop>
PS C:\Users\user\Desktop> adb shell screencap -p /mnt/media_rw/3622-C659/test101.png //截屏命令
PS C:\Users\user\Desktop> adb pull /mnt/media_rw/3622-C659/test101.png //把截图文件拉取到电脑桌面
/mnt/media_rw/3622-C659/test101.png: 1 file pulled, 0 skipped. 2.1 MB/s (671530 bytes in 0.298s)
PS C:\Users\user\Desktop> ls | findstr test //查看文件是否拉取成功
-a---- 2021/3/17 16:46 671530 test101.png
-a---- 2021/3/17 16:49 436351 test203.mp4