Android 自带录屏命令 screenrecord 的使用
發現 Android 系統自帶錄屏命令 screenrecord,其可執行文件位于:/system/bin/ ,源碼位于:frameworks/av/cmds/screenrecord 。
- screenrecord是一個shell命令
- 支持Android4.4(API level 19)以上
- 支持視頻格式: mp4
通過 screenrecod --help 幫助命令查看提示選項:
D:\log>adb shell screenrecord --help Usage: screenrecord [options] <filename>Android screenrecord v1.2. Records the device's display to a .mp4 file.Options: --size WIDTHxHEIGHTSet the video size, e.g. "1280x720". Default is the device's maindisplay resolution (if supported), 1280x720 if not. For best results,use a size supported by the AVC encoder. --bit-rate RATESet the video bit rate, in bits per second. Value may be specified asbits or megabits, e.g. '4000000' is equivalent to '4M'. Default 20Mbps. --bugreportAdd additional information, such as a timestamp overlay, that is helpfulin videos captured to illustrate bugs. --time-limit TIMESet the maximum recording time, in seconds. Default / maximum is 180. --verboseDisplay interesting information on stdout. --helpShow this message.Recording continues until Ctrl-C is hit or the time limit is reached.使用說明:
1. 錄制屏幕
adb?shell?screenrecord?/sdcard/screenrecord.mp4
說明:錄制手機屏幕,mp4 封裝格式,并保存到sdcard,默認錄制時間為180s,錄制期間可以通過 Ctrl+C 結束錄屏。
2. 指定錄制時間,參數 --time-limit
adb shell screenrecord --time-limit 20 /sdcard/screenrecord.mp4
說明:--time-limit 設置最大錄制時間長度,默認 180 秒,錄制期間可以通過 Ctrl+C 結束錄屏。
3. 指定視頻分辨率大小,參數 --size
adb?shell?screenrecord?--size?1280*720?/sdcard/screenrecord.mp4
?說明:錄制視頻,設定分辨率為1280*720,如果不指定,默認使用手機的分辨率。
4. 指定視頻的比特率, 參數 ?--bit-rate
adb?shell?screenrecord?--bit-rate?6000000?/sdcard/screenrecord.mp4
說明:指定視頻的比特率為6Mbps,如果不指定,默認為4Mbps。你可以增加比特率以提高視頻質量或為了讓文件更小而降低比特率。
5.?旋轉90度,參數: --rotate
adb?shell?screenrecord?--rotate?/sdcard/screenrecord.mp4
6. 打印Log:
adb shell screenrecord --time-limit 10 --verbose /sdcard/screenrecord.mp4
7.?查看錄屏進程pid:
adb shell "ps -A | grep screenrecord"
USER PID PPID VSZ RSS WCHAN ADDR S NAME root 6430 1 2182300 15068 futex_wait_queue_me 72a5c743b0 S screenrecord8.?導出視頻:
adb?pull?/sdcard/screenrecord.mp4?D:/
一些限制:
- 某些設備可能無法直接錄制,原因是分辨率太高,如果遇到此類問題,請試著指定較低的分辨率
- 不支持錄制過程中屏幕旋轉,如果錄制過程中旋轉,有可能畫面被切斷
- 錄制視頻的時候聲音不會被錄下來
?
推薦閱讀:
改進安卓自帶screenrecord錄屏程序,支持錄屏/橫豎屏識別/實時推送raw h264.
https://blog.csdn.net/huang_165/article/details/102228886
總結
以上是生活随笔為你收集整理的Android 自带录屏命令 screenrecord 的使用的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux压缩和解压缩
- 下一篇: 8口交换机方案-RTL8309N(含原理