adb shell截屏錄屏命令

一、adb shell screencap 截屏指令

通過adb工具裏的help 指令查看screncap指令的用法:

C:\Users>adb shell screencap -help
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.

 將截屏保存到手機內存中再導入到電腦中:

adb shell screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png D:/1

二、adb shell screenrecord 錄屏指令

首先通過help指令查看screenrecord指令的用法

C:\Users\>adb shell 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 4Mbps.
--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.

錄屏--time-limit

adb shell screenrecord --time-limit 200 /sdcard/record.mp4

若不指定則默認錄屏時間爲180s

adb shell screenrecord /sdcard/record.mp4

screenrecord命令支持Android4.4(API level 19)以上,支持的視頻格式爲mp4

錄屏視頻分辨率大小:--size

adb shell screenrecord --size 1280*720 /sdcard/record.mp4

默認是設備的主顯示分辨率,否則爲1280x720。

指定視頻的比特率: --bit-rate

adb shell screenrecord --bit-rate 5000000 /sdcard/record.mp4

指定錄屏視頻比特率爲5Mpbs,如果不指定則默認爲4Mbps

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章