Android视频录制命令screenrecord
不管是教学,还是为了演示,如果能将Android手机(或平板)的屏幕录制成视频文件,那是一件非常酷的事(iOS8已经提供了这一功能,能通过OS X直接在Mac上录制iPad、iPhone的屏幕,windows没试过,不知可不可以)。不过以前的方法都是通过截屏录制的,效果极差。幸好 Android4.4以上版本提供了这一功能。但无法在手机上直接启动,需要通过adb使用命令行启动。
大家可以进入shell。或干脆直接用adb shell执行命令。该命令是screenrecord,可以输入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.
你要知道:
screenrecord是一个shell命令
支持Android4.4(API level 19)以上
支持视频格式: mp4
一些限制:
某些设备可能无法直接录制,原因是分辨率太高,如果遇到此类问题,请试着指定较低的分辨率
不支持录制过程中屏幕旋转,如果录制过程中旋转,有可能画面被切断
录制视频的时候声音不会被录下来
开始录制命令:
adb shell screenrecord /sdcard/demo.mp4
说明:录制手机屏幕,视频格式为mp4,存放到手机sd卡里,默认录制时间为180s
限制录制时间:
参数: --time-limit
adb shell screenrecord --time-limit 10 /sdcard/demo.mp4
说明:限制视频录制时间为10s,如果不限制,默认180s
指定视频分辨率大小:
参数: --size
adb shell screenrecord --size 1280*720 /sdcard/demo.mp4
说明:录制视频,分辨率为1280*720,如果不指定默认使用手机的分辨率,为获得最佳效果,请使用设备上的高级视频编码(AVC)支持的大小
指定视频的比特率:
参数: --bit-rate
adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4
说明:指定视频的比特率为6Mbps,如果不指定,默认为4Mbps. 你可以增加比特率以提高视频质量或为了让文件更小而降低比特率
在命令行显示log:
参数: --verbose
bixiaopeng@bixiaopeng wirelessqa$ adb shell screenrecord --time-limit 10 --verbose /sdcard/demo.mp4 Main display is 1080x1920 @60.00fps (orientation=0) Configuring recorder for 1080x1920 video at 4.00Mbps Content area is 1080x1920 at offset x=0 y=0 Time limit reached Encoder stopping; recorded 96 frames in 10 seconds Stopping encoder and muxer Executing: /system/bin/am broadcast -a android.intent.action.MEDIA_SCANNER_SCAN_FILE -d file:///sdcard/demo.mp4 Broadcasting: Intent { act=android.intent.action.MEDIA_SCANNER_SCAN_FILE dat=file:///sdcard/demo.mp4 } Broadcast completed: result=0
旋转90度:
参数: --rotate
说明:此功能为实验性的,好不好用不知道
查看帮助命令:
参数: --help
bixiaopeng@bixiaopeng ~$ 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.
导出视频:
adb pull /sdcard/demo.mp4
说明:导出视频到当前目录
参考链接:http://blog.csdn.net/wirelessqa/article/details/22725581
Android视频录制命令screenrecord的更多相关文章
- Android截图命令screencap与视频录制命令screenrecord
Android截图命令screencap 查看帮助命令 bixiaopeng@bixiaopeng ~$ adb shell screencap -v screencap: invalid optio ...
- 利用FFmpeg玩转Android视频录制与压缩(二)<转>
转载出处:http://blog.csdn.net/mabeijianxi/article/details/72983362 预热 时光荏苒,光阴如梭,离上一次吹牛逼已经过去了两三个月,身边很多人的女 ...
- android视频录制、另一部手机实时观看方案
最近调研android视频录制.另一部手机实时观看,大致有以下几种思路. 1. android手机充当服务器,使用NanoHTTPD充当服务器,另一部手机或者pc通过输入http://手机的ip:80 ...
- Android视频录制从不入门到入门系列教程(一)————简介
一.WHY Android SDK提供了MediaRecorder帮助开发者进行视频的录制,不过这个类很鸡肋,实际项目中应该很少用到它,最大的原因我觉得莫过于其输出的视频分辨率太有限了,满足不了项目的 ...
- Android视频录制从不入门到入门系列教程(三)————视频方向
运行Android视频录制从不入门到入门系列教程(二)————显示视频图像中的Demo后,我们应该能发现视频的方向是错误的. 由于Android中,Camera给我们的视频图片的原始方向是下图这个样子 ...
- Android拓展系列(9)--Android视频录制screenrecord命令
在Android4.4 Kitkat上集成了一个比较好用的视频录制功能.参考:http://forums.androidcentral.com/android-4-4-kitkat/329674-ho ...
- android 视频录制 混淆打包 之native层 异常的解决
原文地址:http://www.cnblogs.com/linguanh/ (滑至文章末,直接看解决方法) 问题起因: 前5天,因为项目里面有个类似 仿微信 视频录制的功能, 先是上网找了个 开 ...
- Android视频录制从不入门到入门系列教程(四)————Camera Parameter
Camera提供了一个叫做setParameters的方法帮助开发者设置相机的相关参数. 通过Camera的getParameters方法可以获取到当前为相机设置的相关参数. 下面简单介绍下,视频录制 ...
- 我的Android进阶之旅------>Android视频录制小例子
============================首先看看官网上关于视频捕捉的介绍================================ Capturing videos Video ...
随机推荐
- nodejs 下载远程图片
var express = require('express'); var request = require('request');var http = require('http');var ur ...
- 解决浏览器跨域限制方案之JSONP
一.什么是JSONP JSONP即:JSON with Padding,是一种解决因浏览器跨域限制不允许访问跨域资源的方法. JSONP是一个非官方的协议,它允许在服务器端返回javascript标签 ...
- kudu系列: Java API使用和效率测试
Kudu+Impala很适合数据分析, 但直接使用Insert values语句往Kudu表插入数据, 效率实在不好, 测试下来insert的速度仅为80笔/秒. 原因也是显然的, Kudu本身写入效 ...
- Win下安装nvm
nvm 是 windows 下切换 node 版本的管理工具,mac 下可以使用 TJ 写的 n . 1.https://github.com/coreybutler/nvm-windows/rele ...
- Groovy 类名称赋值为变量使用(newInstance & new)
类创建实例一般方式 http://groovy-lang.org/objectorientation.html#_class class Person { String name Integer ag ...
- IDAPython学习(二)
1.常用函数 ScreenEA() 获取IDA调试窗口中,光标指向代码的地址.通过这个函数,我们就能够从一个已知的点运行我们的脚本. GetInputFileMD5() 返回IDA加载的二进制文件的M ...
- localStorage用法
引用:https://www.cnblogs.com/st-leslie/p/5617130.html const STORAGE_KEY = 'todos-vuejs'; export defaul ...
- 使用Python批量修改文件名
使用os.rename(fold,newfilename)对文件重命名 # coding:utf-8 import os filename_list = os.listdir('./') for fi ...
- 第25月第6天 apachecn视频(机器学习实战)
1.apachecn视频(机器学习实战) https://github.com/apachecn/AiLearning https://space.bilibili.com/97678687/#/ch ...
- 在github上创建自己的项目
使用过很多次github 但一直是把别人的项目clone下来,并没有自己创建过项目.所以记录一下~ 首先,创建一个仓库 填写工程名之后就创建好啦 然后clone代码到本地 就和正常的使用完全一样啦 ~ ...