scrcpyを使ってAndroidスマートフォンの動画をPCで視聴する

今日最終回でしたが,マンガUp!というアプリで他のsiteより12時間早く配信されているのに気づきました.でもモバイルアプリでないと視聴できません.手元ではスマートフォンしか無いので画面が小さい.

そういえば以前試したscrcpyだと画面キャプチャ禁止のアプリでも大丈夫だったのでこれでPCに画面転送してそちらで視聴すればいつもの画面で視聴できるのではと試してみました.

Note
音声についてはscrcpyのaudioブランチを自分でbuildして --forward-audio オプションを利用することで転送できそう 🏛️ ですが私は未確認で現在はBluetooth A2DP-source でPCに転送しています.3.5mm Audio cableなどでも良さそうです.

まずは以前試したページを参考にscrcpyを使えるようにします.

さくっと動いたのですが,スマートフォンとPCのアスペクト比が違うので黒枠が出来ていまいちです.

$ /bin/scrcpy
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 5.7 MB/s (34015 bytes in 0.006s)
[server] INFO: Device: motorola moto g31(w) (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.3.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 2400x1080

scrcpy bar

PCの解像度は 1366×720 でスマートフォンは 2480×1080 なのでスマートフォン画面を真ん中だけくり抜くと良さそうです. --crop オプションを使ってみます.

$ scrcpy --crop=1080:1920:0:$(( (2480-1920)/2 )) \ (1)
    --encoder OMX.google.h264.encoder \ (2)
    --max-size=1366 \ (3)
    --fullscreen (4)
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
/usr/share/scrcpy/scrcpy-server: 1 file pushed. 7.2 MB/s (34015 bytes in 0.005s)
[server] INFO: Device: motorola moto g31(w) (Android 11)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 20.3.5
INFO: Trilinear filtering enabled
INFO: Initial texture: 1360x768
  1. --crop で真ん中をくり抜き
  2. エンコーダにPCでハードウェア対応しているH.264を利用
  3. サイズをPCに合わせて制限
  4. フルスクリーン表示

うまくいきました :)

scrcpy crop

他のPCでは動かないけどスマートフォンでは動くものでも応用が効きそうです.

環境
$ dpkg-query -W scrcpy adb
adb     1:10.0.0+r36-7
scrcpy  1.17-1
$ lsb_release -dr
Description:    Debian GNU/Linux 11 (bullseye)
Release:        11
$ arch
x86_64

One thought to “scrcpyを使ってAndroidスマートフォンの動画をPCで視聴する”

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

To respond on your own website, enter the URL of your response which should contain a link to this post's permalink URL. Your response will then appear (possibly after moderation) on this page. Want to update or remove your response? Update or delete your post and re-enter your post's URL again. (Find out more about Webmentions.)