adb shell screenrecord命令行使用說明


一、查看幫助命令,參數 --help

D:\>adb shell 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. '4000000is 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 timein 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.
  1. 開始錄制命令:

adb shell screenrecord /sdcard/demo.mp4

說明:錄制手機屏幕,視頻格式為mp4,存放到手機sd卡里,默認錄制時間為180s。

        screenrecord是一個shell命令,支持Android4.4(API level 19)以上,支持視頻格式: mp4

   2.  指定視頻分辨率大小,參數 --size

adb shell screenrecord --size 1280*720 /sdcard/demo.mp4

  說明:錄制視頻,分辨率為1280*720,如果不指定默認使用手機的分辨率,為獲得最佳效果,請使用設備上的高級視頻編碼(AVC)支持的大小

   3.  指定視頻的比特率, 參數  --bit-rate

adb shell screenrecord --bit-rate 6000000 /sdcard/demo.mp4

說明:指定視頻的比特率為6Mbps,如果不指定,默認為4Mbps. 你可以增加比特率以提高視頻質量或為了讓文件更小而降低比特率

  4. 旋轉90度,參數: --rotate

adb shell screenrecord --rotate /sdcard/demo.mp4

說明:此功能為實驗性的,在nexus6設備上實驗,錄制的視頻播放時也是旋轉90度播放,體驗不太友好。

 5. 導出視頻:

adb pull /sdcard/demo.mp4 D:/

說明:導出視頻的位置在D盤根目錄下,名稱為demo.mp4

二、DDMS中使用錄制功能

1.命令行中使用DDMS,打開Android DDMS(monitor.bat)工具

2.打開android手機(Android4.4及以上機型)的調試模式,使用USB連接手機,DDMS界面Name中出現手機型號及online的狀態

3.Device-->Screen Record,彈出設置頁面,設置視頻的比特率,和視頻的分辨率以及存儲路徑,點擊OK

4.操作手機測試場景,完畢后,點擊Cannel按鈕,等待幾秒后,會彈出提示保存成功。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM