Skip to content

Instantly share code, notes, and snippets.

@gb-swatanabe
Created November 16, 2015 07:23
Show Gist options
  • Save gb-swatanabe/1544cc57a522b48634fe to your computer and use it in GitHub Desktop.
Save gb-swatanabe/1544cc57a522b48634fe to your computer and use it in GitHub Desktop.
MacにAndroid SDKいれてAndroid端末の実行画面をキャプチャしたかった

JDK7u80インストール

Android sdkインストール

Android Studio実行

  • Configure -> SDK Manager
  • Android 4.4.2にチェック(接続するAndroid端末のOS) -> Apply
  • Ok
  • 終了

端末の設定でUSBデバッグ有効化

  • USBで端末接続
  • 「このパソコンからのUSBを常に許可する」にチェック
  • OK
$ cd ~/Library/Android/sdk/platform-tools/
$ ./adb shell df
Filesystem               Size     Used     Free   Blksize
/dev                   847.7M   128.0K   847.6M   4096
/sys/fs/cgroup         847.7M    12.0K   847.7M   4096
/mnt/asec              847.7M     0.0K   847.7M   4096
/mnt/obb               847.7M     0.0K   847.7M   4096
/dtvtmp/dtv: Permission denied
/tmp                   847.7M     0.0K   847.7M   4096
/system                  2.2G     1.8G   461.2M   4096
/data                   25.8G     4.2G    21.6G   4096
/cache                 196.7M     4.0M   192.7M   4096
/mnt/idd                 7.5M     1.6M     5.9M   1024
/storage/remote       1024.0K     0.0K  1024.0K   4096
/sys/kernel/security: Permission denied
/mnt/shell/emulated     25.8G     4.2G    21.6G   4096
/mnt/media_rw/sdcard1: Permission denied
/storage/sdcard1         1.9G   733.9M     1.2G   32768
$ ./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.
$ ./adb shell screenrecord --verbose --bit-rate 20000000 /storage/sdcard1/out.mp4
Main display is 1080x1920 @60.00fps (orientation=0)
Configuring recorder for 1080x1920 video at 20.00Mbps
Content area is 1080x1920 at offset x=0 y=0
^C
$ ./adb pull /storage/sdcard1/out.mp4 ~/Desktop/
6520 KB/s (360725404 bytes in 54.024s)

bit rateに依らず27fps辺り(Xperia Z1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment