scrcpy v3.0で仮想ディスプレイを使う

scrcpyの導入

例によってメインデスクトップ環境のDebian sid amd64に導入します.
Linux環境への手順は doc/linux.md に書かれています.GitHubではこちら.

ここではgit経由のsourceから導入します.

$ sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
                 gcc git pkg-config meson ninja-build libsdl2-dev \
                 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                 libswresample-dev libusb-1.0-0 libusb-1.0-0-dev (1)
$ git clone https://github.com/Genymobile/scrcpy (2)
$ cd scrcpy
$ ./install_release.sh (3)
$ which scrcpy (4)
/usr/local/bin/scrcpy
$ scrcpy --version (5)
scrcpy 3.0 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.30.9 / 2.30.9
 - libavcodec: 61.19.100 / 61.19.100
 - libavformat: 61.7.100 / 61.7.100
 - libavutil: 59.39.100 / 59.39.100
 - libavdevice: 61.3.100 / 61.3.100
 - libusb: - / 1.0.27
  1. 必要なパッケージの導入

  2. sourceのclone

  3. インストールスクリプトの実行

  4. scrcpyの場所を確認

  5. バージョンの確認

仮想ディスプレイを試す

scrcpy v3.0が入ったので早速仮想ディスプレイを試してみます. --new-display オプションに好みで解像度を指定できます.

$ scrcpy --new-display=720x1608
scrcpy 3.0 <https://github.com/Genymobile/scrcpy>
INFO: ADB device found:
INFO:     -->   (usb)  ZT322L25CF                      device  moto_g24
/usr/local/share/scrcpy/scrcpy-server: 1 file pushed, 0 skipped. 147.9 MB/s (90224 bytes in 0.001s)
[server] INFO: Device: [motorola] motorola moto g24 (Android 14)
INFO: Renderer: opengl
INFO: OpenGL version: 4.6 (Compatibility Profile) Mesa 24.2.7-1
INFO: Trilinear filtering enabled
INFO: Texture: 720x1608
[server] INFO: New display: 720x1608/237 (id=3)

一部のアプリケーションが配置されています.寂しいですね.

scrcpy v3.0 vd 01

scrcpyに --start-app= オプションを指定することで好みのアプリケーションが起動できます.その前に list-apps オプションで起動したいアプリケーションを確認します.ここではニコニコ動画を起動しています.

$ scrcpy list-apps | grep nico
 - ニコニコ動画                         jp.nicovideo.android
 - ニコニコ生放送                        jp.co.dwango.nicocas
$ scrcpy --new-display=1608x720 --start-app=jp.nicovideo.android

scrcpy v3.0 vd 02

普通に視聴できました.
このときAndroid本体はディプレイは消えたままです.ロックを解除して別のアプリを使うこともできます.
仮想ディスプレイで実行中のアプリを起動するとアプリは本体側に移り,仮想ディスプレイにはデスクトップが表示されました.
仮想ディスプレイでニコニコ動画を再生しつつ本体でYouTube動画を再生してみると,両方の音声がPC側から出ました.

これまでも本体画面を消灯して使うといったことはできましたが,通知が来て別のアプリをちょっと確認したいみたいなときなどアプリを切り替える必要があり面倒でした.この仮想ディスプレイは別のディスプレイ扱いでそういうときにも2つの画面が同時に使えて便利です.
それに画面ロックを解除する必要がないのも便利です.(これは選べると嬉しいけど)

scrcpyと組み合わせて使うのにAndroidベースのTV StickやTV Boxのようなものが欲しくなります.

環境

PC環境
$ scrcpy -v
scrcpy 3.0 <https://github.com/Genymobile/scrcpy>

Dependencies (compiled / linked):
 - SDL: 2.30.9 / 2.30.9
 - libavcodec: 61.19.100 / 61.19.100
 - libavformat: 61.7.100 / 61.7.100
 - libavutil: 59.39.100 / 59.39.100
 - libavdevice: 61.3.100 / 61.3.100
 - libusb: - / 1.0.27
 $ dpkg-query -W ffmpeg libsdl2-2.0-0 adb wget \
                 gcc git pkg-config meson ninja-build libsdl2-dev \
                 libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
                 libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
adb     1:34.0.5-3
ffmpeg  7:7.1-3
gcc     4:14.2.0-1
git     1:2.45.2-1.2
libavcodec-dev:amd64    7:7.1-3
libavdevice-dev:amd64   7:7.1-3
libavformat-dev:amd64   7:7.1-3
libavutil-dev:amd64     7:7.1-3
libsdl2-2.0-0:amd64     2.30.9+dfsg-1
libsdl2-dev:amd64       2.30.9+dfsg-1
libswresample-dev:amd64 7:7.1-3
libusb-1.0-0:amd64      2:1.0.27-1+b1
libusb-1.0-0-dev:amd64  2:1.0.27-1+b1
meson   1.6.0-1
ninja-build     1.12.1-1
pkg-config:amd64        1.8.1-4
wget    1.24.5-2+b1
$ lsb_release -dr
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
$ arch
x86_64
Android環境
$ adb shell dumpsys package com.nextcloud.client | grep versionName=
    versionName=3.29.2
$ adb shell getprop ro.build.version.release
14
$ adb shell getprop ro.build.version.sdk
34
$ adb shell getprop ro.build.id
UTA34.82-90
$ adb shell getprop ro.product.model
moto g24

コメントを残す

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

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