Android拓展系列(9)--Android视频录制screenrecord命令
在Android4.4 Kitkat上集成了一个比较好用的视频录制功能。
参考:http://forums.androidcentral.com/android-4-4-kitkat/329674-how-use-screen-recording-android-4-4-kitkat.html
1、名称
screenrecord
2、使用说明
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | $ 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. |
3、举例
(1). 基本使用
1 2 | // 录制默认分辨率,默认4Mbps,默认180s的视频,保存到sdcard上名为FILENAME.mp4 $adb shell screenrecord /sdcard/FILENAME.mp4 |
(2). 指定分辨率(参数:--size)
1 2 | // 分辨率为112x112,建议不要指定分辨率,使用默认分辨率效果最佳 $adb shell screenrecord --size 112x112 /sdcard/FILENAME.mp4 |
注意,分辨率不是完全可以随意定制的,比如在我手机上录制100x100的会提示错误:
1 2 3 4 | // 100x100不支持,建议设为112x112 $adb shell screenrecord --size 100x100 /sdcard/FILENAME.mp4 The max width/height supported by codec is 1920x1088 100x100 is not supported by codec, suggest to set it as 112x112 |
(3). 指定比特率(参数:--bit-rate)
1 2 | // 设置比特率为8Mbps,比特率越大,文件越大,画面越清晰 $adb shell screenrecord --bit-rate 8000000 /sdcard/FILENAME.mp4 |
(4). 旋转(参数:--rotate)
1 2 | // 旋转90度 $adb shell screenrecord --rotate /sdcard/FILENAME.mp4 |
4、小结
(1). 生成的MP4文件很小,几百K到几百M,很方便。(本人工作中测试录制的视频动辄几十M或者几百M)。
(2). 不支持声音,如有需要,另外独立录制。
分类:
Android拓展系列
标签:
Android
, Android拓展系列
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构