【ADB命令行】adb shell screenrecord命令行使用说明

一、查看帮助命令,参数 --help

D:\>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.
  1. 开始录制命令:

adb shell screenrecord /sdcard/demo.mp4

说明:录制手机屏幕,视频格式为mp4,存放到手机sd卡里,默认录制时间为180s。

        screenrecord是一个shell命令,支持Android4.4(API level 19)以上,支持视频格式: mp4

   2.  指定视频分辨率大小,参数 --size

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

  说明:录制视频,分辨率为1280*720,如果不指定默认使用手机的分辨率,为获得最佳效果,请使用设备上的高级视频编码(AVC)支持的大小

   3.  指定视频的比特率, 参数  --bit-rate

adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4

说明:指定视频的比特率为6Mbps,如果不指定,默认为4Mbps. 你可以增加比特率以提高视频质量或为了让文件更小而降低比特率

  4. 旋转90度,参数: --rotate

adb shell screenrecord --rotate /sdcard/demo.mp4

说明:此功能为实验性的,在nexus6设备上实验,录制的视频播放时也是旋转90度播放,体验不太友好。

 5. 导出视频:

adb pull /sdcard/demo.mp4 D:/

说明:导出视频的位置在D盘根目录下,名称为demo.mp4

二、DDMS中使用录制功能

1.命令行中使用DDMS,打开Android DDMS(monitor.bat)工具

2.打开android手机(Android4.4及以上机型)的调试模式,使用USB连接手机,DDMS界面Name中出现手机型号及online的状态

3.Device-->Screen Record,弹出设置页面,设置视频的比特率,和视频的分辨率以及存储路径,点击OK

4.操作手机测试场景,完毕后,点击Cannel按钮,等待几秒后,会弹出提示保存成功。

猜你喜欢

转载自blog.csdn.net/QingLang0213/article/details/52274524