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、使用說明

$ 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). 基本使用

// 錄制默認分辨率,默認4Mbps,默認180s的視頻,保存到sdcard上名為FILENAME.mp4
$adb shell screenrecord /sdcard/FILENAME.mp4

(2). 指定分辨率(參數:--size)

// 分辨率為112x112,建議不要指定分辨率,使用默認分辨率效果最佳
$adb shell screenrecord --size 112x112 /sdcard/FILENAME.mp4

注意,分辨率不是完全可以隨意定制的,比如在我手機上錄制100x100的會提示錯誤:

// 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)

// 設置比特率為8Mbps,比特率越大,文件越大,畫面越清晰
$adb shell screenrecord --bit-rate 8000000 /sdcard/FILENAME.mp4

(4). 旋轉(參數:--rotate)

// 旋轉90度
$adb shell screenrecord --rotate /sdcard/FILENAME.mp4

4、小結
(1). 生成的MP4文件很小,幾百K到幾百M,很方便。(本人工作中測試錄制的視頻動輒幾十M或者幾百M)。
(2). 不支持聲音,如有需要,另外獨立錄制。


免責聲明!

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



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