天天看點

android 4.4kitkat手機視訊錄制【screenrecorder】并轉換為GIF格式

參考連結

目前隻有4.4以上版本的真機(不支援虛拟機)支援頻幕視訊錄制功能。

你需要更新adt版本(如果你目前adt版本不能更新platform tools到V19或以上),然後更新platform tools。

本以為會在ddms看到相應的UI按鈕幫助我錄屏,最後還是乖乖的開了shell。

控制台進入adt的安裝目錄,找到sdk/platform-tools/,使用shell指令:

$ adb shell screenrecord /sdcard/recording.mp4
           

後者為輸出的目錄和檔案名,可以自定義,另外有參數可供選擇:

  • --help : Displays a usage summary.幫助菜單。
  • --size : Sets the video size, for example: 1280x720. The default value is the device's main display resolution (if supported), 1280x720 if not. For best results, use a size supported by your device's Advanced Video Coding (AVC) encoder.設定視訊大小。
  • --bit-rate : Sets the video bit rate for the video, in megabits per second. The default value is 4Mbps. You can increase the bit rate to improve video quality or lower it for smaller movie files. The following example sets the recording bit rate to 6Mbps: screenrecord --bit-rate 6000000 /sdcard/demo.mp4.設定視訊比特率。
  • --time-limit : Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).設定錄制時間,機關是秒,最長180秒即3分鐘。
  • --rotate : Rotates the output 90 degrees. This feature is experimental.90度旋轉輸出結果。
  • --verbose : Displays log information on command line screen. If you do not set this option, the utility does not display any information while running.錄制時輸出一些資訊包括尺寸大小,比特率等。

如果錄制視訊是為了示範用,筆者建議在機器的開發者選項者打開“顯示觸摸操作”,這樣你的觸摸操作會在螢幕上有白點顯示,友善示範手勢等操作。

錄制視訊為mp4格式,如果你需要轉換為GIF格式,不要去百度那些個視訊轉換軟體,筆者在百度搜了一圈都是不能用的,可能我搜得有問題,這裡推薦一款國外的非常輕便好用的軟體Free Video to GIF Converter 錄制效果可以參考上一篇博文。

繼續閱讀