在Android4.4 Kitkat上集成了一个比较好用的视频录制功能。
参考:http://forums.androidcentral.com/android-4-4-kitkat/329674-how-use-screen-recording-android-4-4-kitkat.html

1、名称
screenrecord

2、使用说明

$ adb shell screenrecord --helpUsage: screenrecord [options] <filename>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 megabits per second.  Default 4Mbps.--time-limit TIME    Set the maximum recording time, in seconds.  Default / maximum is 180.--rotate    Rotate the output 90 degrees.--verbose    Display interesting information on stdout.--help    Show this message.Recording continues until Ctrl-C is hit or the time limit is reached.

3、举例
(1). 基本使用

// 录制默认分辨率,默认4Mbps,默认180s的视频,保存到sdcard上名为FILENAME.mp4$adb shell screenrecord /sdcard/FILENAME.mp4

(2). 指定分辨率(参数:--size)

// 分辨率为112x112,建议不要指定分辨率,使用默认分辨率效果最佳$adb shell screenrecord --size 112x112 /sdcard/FILENAME.mp4

注意,分辨率不是完全可以随意定制的,比如在我手机上录制100x100的会提示错误:

// 100x100不支持,建议设为112x112$adb shell screenrecord --size 100x100 /sdcard/FILENAME.mp4The max width/height supported by codec is 1920x1088100x100 is not supported by codec, suggest to set it as 112x112

(3). 指定比特率(参数:--bit-rate)

// 设置比特率为8Mbps,比特率越大,文件越大,画面越清晰$adb shell screenrecord --bit-rate 8000000 /sdcard/FILENAME.mp4

(4). 旋转(参数:--rotate)

// 旋转90度$adb shell screenrecord --rotate /sdcard/FILENAME.mp4

4、小结
(1). 生成的MP4文件很小,几百K到几百M,很方便。(本人工作中测试录制的视频动辄几十M或者几百M)。
(2). 不支持声音,如有需要,另外独立录制。

更多相关文章

  1. 【Android】获取屏幕分辨率和顶栏高度全屏和横屏
  2. Android获取屏幕分辨率和大小与设置壁纸、动态壁纸
  3. Appium的DesiredCapabilities参数设置
  4. Android:指定分辨率和清晰度的图片压缩方法源码
  5. Android Activity或者Fragment 向Adapter实时传递参数
  6. 使用CSS3 Media Query技术适配Android平板屏幕分辨率和屏幕密度

随机推荐

  1. 小师妹聊如何部署IDPS
  2. 在苹果Mac上如何隐藏桌面图标?
  3. Python如何进行内存管理?
  4. WordPress主题供应商Pipdig使用客户网站
  5. Nginx 1.18.0配置SSL问题
  6. Flask VS Django,选择哪个框架好?
  7. Python教程分享之Python基础知识点梳理
  8. jdbc 读写 blob 类型的数据
  9. Pandas Series对象有哪些属性?六大类!
  10. Jenkins 之 多分支流水线的使用