Android 视频录制 动态图

本文介绍了Android 4.4系统中集成的视频录制功能,包括基本用法、视频旋转、指定分辨率、比特率设置、时间限制等,并提供了操作示例和效果展示。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在Android 4.4(Kitkat - API level 19)上集成了一个比较好用的视频(.mp4格式)录制功能 – screenrecord

使用方法

1. 基本用法

$adb shell screenrecord /sdcard/myscreenrecord.mp4

  • /sdcard/myscreenrecord.mp4 为视频录制文件路径
  • 录制默认分辨率,默认4Mbps,默认180s的视频,保存到sdcard上名为myscreenrecord.mp4
2. 旋转(参数:–rotate)

$adb shell screenrecord --rotate /sdcard/myscreenrecord.mp4

  • 旋转90度
3. 指定分辨率(参数:–size)

$adb shell screenrecord --size 112x112 /sdcard/myscreenrecord.mp4

  • 分辨率为112x112,建议不要指定分辨率,使用默认分辨率效果最佳;
  • 注意,分辨率不是完全可以随意定制的,比如在我手机上录制100x100的会提示错误:
    The max width/height supported by codec is 1920x1088
    100x100 is not supported by codec, suggest to set it as 112x112
4. 指定比特率(参数:–bit-rate)

$adb shell screenrecord --bit-rate 8000000``/sdcard/myscreenrecord.mp4

  • 设置比特率为8Mbps,比特率越大,文件越大,画面越清晰;
5. 限制录制时间 (参数: –time-limit)

$adb shell screenrecord --time-limit 10 /sdcard/myscreenrecord.mp4

  • 限制视频录制时间为10s,如果不限制,默认180s
6. 导出视频

$adb pull /sdcard/myscreenrecord.mp4

7. 注意
  • 请关注视频文件生成大小,根据自身情况而定;
  • 暂不支持声音;
  • 咱时不支持模拟器录制(模拟器录制看这里),出现如下提示:Unable to get output buffers (err=-38)
    Encoder failed (err=-38),可认为是此原因;
8. 命令查看
$ adb shell screenrecord --help
Usage: 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.
9. 效果展示(浏览器中可直接观看)

效果展示: http://yunpan.cn/cmKk9mZQLKQRL
访问密码: df0b

===========================================

关于作者

作者:steve Li
博客http://blog.youkuaiyun.com/lyltiger
文章链接http://blog.youkuaiyun.com/lyltiger/article/details/48007795

===========================================

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值