LoginSignup
9
9

More than 5 years have passed since last update.

screenrecordの"unofficial" optionsは夢がいっぱいだった

Last updated at Posted at 2016-01-13

はい、釣りタイトル。

Android 4.4から追加されたscreenrecordってコマンドのソースコード読んでたら、"unofficial" optionsを見つけたのでその話。

screenrecordがどんなものなのかを知りたいなら、ざっくり以下の記事がいいと思う。
(簡単に言ってadb shell経由で画面の録画ができる便利機能)

[Android4.4 KitKat] 新機能 screenrecordで画面を録画する方法 | アドカレ2013 : SP #19

"unofficial" options

さて、本題の"unofficial" options。コード的にはこんな感じに書いてあった。

881     static const struct option longOptions[] = {
882         { "help",               no_argument,        NULL, 'h' },
883         { "verbose",            no_argument,        NULL, 'v' },
884         { "size",               required_argument,  NULL, 's' },
885         { "bit-rate",           required_argument,  NULL, 'b' },
886         { "time-limit",         required_argument,  NULL, 't' },
887         { "bugreport",          no_argument,        NULL, 'u' },
888         // "unofficial" options
889         { "show-device-info",   no_argument,        NULL, 'i' },
890         { "show-frame-time",    no_argument,        NULL, 'f' },
891         { "rotate",             no_argument,        NULL, 'r' },
892         { "output-format",      required_argument,  NULL, 'o' },
893         { NULL,                 0,                  NULL, 0 }
894     };

"unofficial" optionsなものは以下っぽい。

show-device-info

  • つけてもgWantInfoScreentrueを設定するだけ
  • つまんねー

show-frame-time

  • つけて録画すると、録画にフレームの数値とタイムスタンプが追加される
  • 下のGifの左上のやつな
  • --bugreport Optionでええやん

rotate

  • まさかの反転録画機能!!胸熱
  • コード読む感じ90度動かしてる??
  • まだ実験的な機能らしい

954         case 'r':
955             // experimental feature
956             gRotate = true;
957             break;

output-format

  • 出力するFormatが選べる
  • 対応してるFormatは4つっぽい
  • [mp4 / h264 / frames / raw-frames]
  • 以下のような感じで--output-format Optionの後にFormatを指定する
  • adb shell screenrecord --output-format raw-frames /sdcard/test
  • まさか生のフレームも録画できる!?

show-frame-time Option付けて撮った

circleAnimationMuvie.gif

rotate Option付けて撮った

circleAnimationMuvie.gif

screenrecordのコード

基本的にメインのコードはこいつ

全体的に読みたければこっち

まとめ

コードを見た感じTODOっていっぱい書いてあって、まだ夢がいっぱい詰まっている感じの実装だった。
これからの機能追加に期待!

9
9
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9