android shell命令screenrecord和uptime,reboot

本文介绍了如何使用ADB命令快速关闭手机、查看开机时间和录制屏幕。详细解释了screenrecord命令的各种参数用法,包括设置视频分辨率、比特率、录制时长及旋转角度。

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

0.使用adb shell reboot -p可以秒关手机

1.使用uptime查看开机时间

130|shell@HWPLK:/ $ uptime
up time: 00:12:32, idle time: 01:28:59, sleep time: 00:00:00
2.使用screenrecord录制屏幕

$ 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.
 

screenrecord使用举例
(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
 

转载于:https://www.cnblogs.com/xiayexingkong/p/6138402.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值