1

您好,我正在尝试通过 HDMI 连接和屏幕录制连接到 Android 设备的辅助显示器。我成功地能够截屏并记录 Android 手机主屏幕,但我有一个显示到第二个屏幕的设备。

我正在尝试做的事情:

  1. 屏幕记录显示在第二个显示屏而非主显示屏上的内容
  2. 应用程序的显示是通过 HDMI 从 Android 设备输出到投影

目前做了什么:

  1. 确定是否有显示器:

    adb shell c1q:/ $ dumpsys SurfaceFlinger --display-id Display 16409431620704260 (HWC display 1): port=4 pnpId=PRO displayName="projector" Display 19261213734341249 (HWC display 0): port=129 pnpId=QCM displayName="ss_dsi_panel_ "

  2. 尝试连接:

尝试屏幕录制第二个显示(HWC 显示 1)时,adb 似乎没有切换到特定列出的显示的选项,shell screenrecord --help 选项也没有

127|c1q:/ $ screenrecord --help
Usage: screenrecord [options] <filename>

Android screenrecord v1.2.  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 bits per second.  Value may be specified as
    bits or megabits, e.g. '4000000' is equivalent to '4M'.  Default 20Mbps.
--bugreport
    Add additional information, such as a timestamp overlay, that is helpful
    in videos captured to illustrate bugs.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.

我查看了下面列出的一些文档:

Android AOSP 此处: https ://source.android.com/devices/tech/display/multi_display/displays#static

源screenrecord.cpp: https ://android.googlesource.com/platform/frameworks/av/+/ae6965ae7664aaea489a8d58358035610075c9af/cmds/screenrecord/screenrecord.cpp

screenrecord 可以很好地捕捉手机显示,但外接显示器是 type-C HDMI 输出迷你投影仪,目标是捕捉和记录通过 HDMI 发送的其他应用程序,无论应用程序。第三方应用程序投射的内容与 Android 手机屏幕上显示的内容不同(例如 Android Watch),并希望从桌面无线记录。

adb tcpip 5555
adb connect [Device IP Address]:5555
adb shell screenrecord /sdcard/Downloads/test.mp4

这工作得很好,下一部分是记录第二个显示

Display 16409431620704260 (HWC display 1): port=4 pnpId=PRO displayName="projector"

我确实了解可以为您自己的 Android 应用程序创建一个实现来访问显示,但我想记录任何应用程序,切换到特定显示并在那里记录,SurfaceFlinger 看到它但没有看到连接到它并记录的选项

4

1 回答 1

0

screenrecord版本 1.3 (Android 11)提供了选择不同显示器的可能性。特别--display-id是,您必须使用该参数来提供 ID 或您的投影。

Android screenrecord v1.3.  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 bits per second.  Value may be specified as
    bits or megabits, e.g. '4000000' is equivalent to '4M'.  Default 20Mbps.
--bugreport
    Add additional information, such as a timestamp overlay, that is helpful
    in videos captured to illustrate bugs.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--display-id ID
    specify the physical display ID to record. Default is the primary display.
    see "dumpsys SurfaceFlinger --display-id" for valid display IDs.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.

您可以查看这里的screenrecord源代码。

于 2020-10-03T09:33:18.460 回答