diff --git a/README.rst b/README.rst index a6cd71b..9320c8a 100644 --- a/README.rst +++ b/README.rst @@ -8,168 +8,69 @@ Overview This repository provides coherent software, drivers and utilities to setup streaming and video encoding services in the cloud to enable -end-users with remote access to Android cloud instances. +end-users with remote access to Android and Windows cloud instances. Included here are software, scripts and Docker configurations that provide: -* **Streaming software** +* For Windows: - * `OWT`_ based streaming service - * Docker configuration for the easy setup + * **Indirect Display Driver (IDD)** to enable virtual display devices over + headless display adapters -* **Video Encoding software** + * **Screen capture software** to capture, encode and stream Windows + desktop output - * `FFmpeg `_ based video encoding service to - assist streaming counterpart - * Docker configuration for the easy setup +* For Android (below software runs on Linux): + + * **Streaming software** - `OWT`_ based streaming service + + * **Video Encoding software** - `FFmpeg `_ based + video encoding service to assist streaming counterpart + + * Docker configurations for the easy setup * **Helper and test scripts and docker configurations** - * Helper `OWT`_ build docker container + * Helper `OWT`_ build docker containers for Windows and Linux * P2P service docker configuration - * Chrome browser test client docker configuration + * Chrome browser test client docker configuration (for Android) + +Streaming and Video Encoding services for Android are parts of Intel Cloud +Streaming for Android OS reference stack and require setup for Android in +Container. For details see `Celadon documentation `_. .. _OWT: https://github.com/open-webrtc-toolkit/owt-client-native.git Prerequisites ------------- -* Video encoding service requires `Intel® Data Center GPU Flex Series - `_ - -* Docker configurations require at least 100GB free disk space available for docker - -* Streaming and Video Encoding services are assumed to be running under same bare metal or virtual host - -* Android in Container is assumed to be properly installed and running under the same bare metal - or virtual host as Streaming and Video Encoding services - -Installation ------------- - -We provide dockerfiles to setup streaming and encoding services. These dockerfiles need to be -built into docker containers. Dockerfiles can also be used as a reference instruction -to install ingredients on bare metal. - -To build any of the configurations, first clone Cloud Streaming repository:: - - git clone https://github.com/projectceladon/cloud-streaming.git && cd cloud-streaming - -To setup running environment Android in Container (AIC) instance(s) should be started first. -For the instruction below we will assume that: - -* At least 1 AIC is running and ``AIC_INSTANCE`` environment variable is exported to - point out to AIC workdir:: - - export AIC_INSTANCE=/path/to/aic/workdir - -* AIC environment has configured Docker network labelled ``android`` - -* AIC environment has configured P2P server and its IP address under ``android`` network - was exposed via ``P2P_IP`` environment variable:: - - P2P_IP=$(docker inspect -f '{{.NetworkSettings.Networks.android.IPAddress}}' p2p) - -Setup Docker -~~~~~~~~~~~~ +.. |intel-flex| replace:: Intel® Data Center GPU Flex Series +.. _intel-flex: https://ark.intel.com/content/www/us/en/ark/products/series/230021/intel-data-center-gpu-flex-series.html -Docker is required to build and to run Cloud Streaming containers. If you run Ubuntu 22.04 -or later you can install it as follows:: +* For Android: - apt-get install docker.io + * Video encoding service requires |intel-flex|_ -You might need to further configure docker as follows: + * Streaming and Video Encoding services are assumed to be running under same + bare metal or virtual host -* If you run behind a proxy, configure proxies for for docker daemon. Refer to - https://docs.docker.com/config/daemon/systemd/. + * Android in Container is assumed to be properly installed and running under + the same bare metal or virtual host as Streaming and Video Encoding services -* Make sure that docker has at least 100GB of hard disk space to use. To check available - space run (in the example below 390GB are available):: +* For Windows: - $ df -h $(docker info -f '{{ .DockerRootDir}}') - Filesystem Size Used Avail Use% Mounted on - /dev/sda1 740G 320G 390G 46% / + * IDD driver requires Windows 10, version 1903 or newer. I.e. IDD driver cen + be used with Windows Server 2022, but not with Windows Server 2019. - If disk space is not enough (for example, default ``/var/lib/docker`` is mounted to - a small size partition which might be a case for ``/var``), consider reconfiguring - docker storage location as follows:: + * Screen capture and video encoding should work for any Intel GPU, but project + was validated for |intel-flex|_. - # Below assumes unaltered default docker installation when - # /etc/docker/daemon.json does not exist - echo "{\"data-root\": \"/mnt/newlocation\"}" | sudo tee /etc/docker/daemon.json - sudo systemctl daemon-reload - sudo systemctl restart docker - -Setup Video Encoding Service -~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Build Video Encoding Service as follows:: - - docker build \ - $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/--build-arg /') \ - --file docker/encoder/ubuntu22.04/selfbuild-prodkmd/Dockerfile \ - --tag cloud-encoder \ - . - -Start the service configuring docker container. You can modify video encoding settings -to fine tune the encoding quality, select H.264 or HEVC encoders:: - - DEVICE=${DEVICE:-/dev/dri/renderD128} - DEVICE_GRP=$(stat --format %g $DEVICE) - - # Encode AIC video with H.264 encoder - ICR_CMDLINE="icr_encoder 0 -streaming \ - -res 1920x1080 -url irrv:264 -plugin qsv -lowpower -tcae 1 \ - -fr 30 -quality 4 -ratectrl VBR -b 3.3M -maxrate 6.6M \ - -hwc_sock /opt/workdir/ipc/hwc-sock" - - docker create \ - -e DEVICE=$DEVICE --device $DEVICE --group-add $DEVICE_GRP \ - -e render_server_port=23432 \ - --network android \ - -v $AIC_INSTANCE/workdir:/opt/workdir \ - --name icr0 \ - cloud-encoder $ICR_CMDLINE - - docker start video0 - -Setup Streaming Service -~~~~~~~~~~~~~~~~~~~~~~~ - -Build Streaming Service as follows:: - - docker build \ - $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/--build-arg /') \ - --file docker/streamer/ubuntu22.04/Dockerfile \ - --tag cloud-streamer \ - . - -Start the service configuring docker container:: - - DEVICE=${DEVICE:-/dev/dri/renderD128} - DEVICE_GRP=$(stat --format %g $DEVICE) - - ICR0_IP=$(docker inspect -f '{{.NetworkSettings.Networks.android.IPAddress}}' icr0) - - STREAMER_CMDLINE="ga-server-periodic -n 0 -s ${P2P_IP} \ - --server-peer-id s0 --client-peer-id c0 \ - --icr-ip ${ICR0_IP} \ - --loglevel debug /opt/etc/ga/server.desktop.webrtc.conf" - - docker create \ - -e DEVICE=$DEVICE --device $DEVICE --group-add $DEVICE_GRP \ - --network android \ - -v $AIC_INSTANCE/workdir:/opt/workdir \ - --name streamer0 \ - $IMAGE $STREAMER_CMDLINE - - docker start streamer0 - -Running the Software --------------------- +* Docker configurations require at least 100GB free disk space available for docker -Upon successful setup connections to the streaming service should be possible having -appropriate client. +Setup Instructions +------------------ +* `Windows Setup Guide <./doc/windows_setup.rst>`_ +* `Android Setup Guide <./doc/android_setup.rst>`_ diff --git a/doc/android_setup.rst b/doc/android_setup.rst new file mode 100644 index 0000000..5a2acb0 --- /dev/null +++ b/doc/android_setup.rst @@ -0,0 +1,162 @@ +Android Setup Guide +=================== + +.. contents:: + +Overview +-------- + +This project provides the following ingredients of Intel Cloud Streaming for +Android OS reference stack: + +* `OWT`_ based Streaming Service +* Video Encoding Service + +These ingredients require Android in Container to be installed and configured. +Refer to `Celadon documentation `_ +for full setup instructions. + +In this document we will provide instructions for Streaming and Encoding +Services assuming that the rest of Intel Cloud Streaming for Android OS +components are properly configured. + +.. _OWT: https://github.com/open-webrtc-toolkit/owt-client-native.git + +Prerequisites +------------- + +.. |intel-flex| replace:: Intel® Data Center GPU Flex Series +.. _intel-flex: https://ark.intel.com/content/www/us/en/ark/products/series/230021/intel-data-center-gpu-flex-series.html + +* Video encoding service requires |intel-flex|_ + +* Docker configurations require at least 100GB free disk space available for docker + +* Streaming and Video Encoding services are assumed to be running under same bare metal or virtual host + +Installation +------------ + +We provide dockerfiles to setup streaming and encoding services. These dockerfiles need to be +built into docker containers. Dockerfiles can also be used as a reference instruction +to install ingredients on bare metal. + +To build any of the configurations, first clone Cloud Streaming repository:: + + git clone https://github.com/projectceladon/cloud-streaming.git && cd cloud-streaming + +To setup running environment Android in Container (AIC) instance(s) should be started first. +For the instruction below we will assume that: + +* At least 1 AIC is running and ``AIC_INSTANCE`` environment variable is exported to + point out to AIC workdir:: + + export AIC_INSTANCE=/path/to/aic/workdir + +* AIC environment has configured Docker network labelled ``android`` + +* AIC environment has configured P2P server and its IP address under ``android`` network + was exposed via ``P2P_IP`` environment variable:: + + P2P_IP=$(docker inspect -f '{{.NetworkSettings.Networks.android.IPAddress}}' p2p) + +Setup Docker +~~~~~~~~~~~~ + +Docker is required to build and to run Cloud Streaming containers. If you run Ubuntu 22.04 +or later you can install it as follows:: + + apt-get install docker.io + +You might need to further configure docker as follows: + +* If you run behind a proxy, configure proxies for for docker daemon. Refer to + https://docs.docker.com/config/daemon/systemd/. + +* Make sure that docker has at least 100GB of hard disk space to use. To check available + space run (in the example below 390GB are available):: + + $ df -h $(docker info -f '{{ .DockerRootDir}}') + Filesystem Size Used Avail Use% Mounted on + /dev/sda1 740G 320G 390G 46% / + + If disk space is not enough (for example, default ``/var/lib/docker`` is mounted to + a small size partition which might be a case for ``/var``), consider reconfiguring + docker storage location as follows:: + + # Below assumes unaltered default docker installation when + # /etc/docker/daemon.json does not exist + echo "{\"data-root\": \"/mnt/newlocation\"}" | sudo tee /etc/docker/daemon.json + sudo systemctl daemon-reload + sudo systemctl restart docker + +Setup Video Encoding Service +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Build Video Encoding Service as follows:: + + docker build \ + $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/--build-arg /') \ + --file docker/encoder/ubuntu22.04/selfbuild-prodkmd/Dockerfile \ + --tag cloud-encoder \ + . + +Start the service configuring docker container. You can modify video encoding settings +to fine tune the encoding quality, select H.264 or HEVC or AV1 encoders:: + + DEVICE=${DEVICE:-/dev/dri/renderD128} + DEVICE_GRP=$(stat --format %g $DEVICE) + + # Encode AIC video with H.264 encoder + ICR_CMDLINE="icr_encoder 0 -streaming \ + -res 1920x1080 -url irrv:264 -plugin qsv -lowpower -tcae 1 \ + -fr 30 -quality 4 -ratectrl VBR -b 3.3M -maxrate 6.6M \ + -hwc_sock /opt/workdir/ipc/hwc-sock" + + docker create \ + -e DEVICE=$DEVICE --device $DEVICE --group-add $DEVICE_GRP \ + -e render_server_port=23432 \ + --network android \ + -v $AIC_INSTANCE/workdir:/opt/workdir \ + --name icr0 \ + cloud-encoder $ICR_CMDLINE + + docker start video0 + +Setup Streaming Service +~~~~~~~~~~~~~~~~~~~~~~~ + +Build Streaming Service as follows:: + + docker build \ + $(env | grep -E '(_proxy=|_PROXY)' | sed 's/^/--build-arg /') \ + --file docker/streamer/ubuntu22.04/Dockerfile \ + --tag cloud-streamer \ + . + +Start the service configuring docker container:: + + DEVICE=${DEVICE:-/dev/dri/renderD128} + DEVICE_GRP=$(stat --format %g $DEVICE) + + ICR0_IP=$(docker inspect -f '{{.NetworkSettings.Networks.android.IPAddress}}' icr0) + + STREAMER_CMDLINE="ga-server-periodic -n 0 -s ${P2P_IP} \ + --server-peer-id s0 --client-peer-id c0 \ + --icr-ip ${ICR0_IP} \ + --loglevel debug /opt/etc/ga/server.desktop.webrtc.conf" + + docker create \ + -e DEVICE=$DEVICE --device $DEVICE --group-add $DEVICE_GRP \ + --network android \ + -v $AIC_INSTANCE/workdir:/opt/workdir \ + --name streamer0 \ + $IMAGE $STREAMER_CMDLINE + + docker start streamer0 + +Running the Software +-------------------- + +Upon successful setup connections to the streaming service should be possible having +appropriate client. diff --git a/doc/windows_setup.rst b/doc/windows_setup.rst new file mode 100644 index 0000000..b2bcf4b --- /dev/null +++ b/doc/windows_setup.rst @@ -0,0 +1,279 @@ +Windows Setup Guide +=================== + +.. contents:: + +.. _Git: https://git-scm.com +.. _Meson: https://mesonbuild.com +.. _MSYS2: https://www.msys2.org +.. _Windows SDK: https://developer.microsoft.com/en-us/windows/downloads/windows-sdk/ +.. _Windows WDK: https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk + +.. _FFmpeg: https://www.ffmpeg.org/ +.. _OpenSSL: https://www.openssl.org/ +.. _OWT: https://github.com/open-webrtc-toolkit/owt-client-native.git + +.. |intel-flex| replace:: Intel® Data Center GPU Flex Series +.. _intel-flex: https://ark.intel.com/content/www/us/en/ark/products/series/230021/intel-data-center-gpu-flex-series.html + +Overview +-------- + +This project provides the following ingredients of Intel Cloud Gaming Reference +Stack for Windows OS: + +* **Indirect Display Driver (IDD)** to enable virtual display devices over + headless display adapters + +* **IDD setup tool** to install, uninstall and tune virtual display devices and + drivers. + +* **Screen capture and video encoding sample** application to capture and encode + Windows desktop output and dump bitstream to file + +* `OWT`_ based screen capture streaming server and client + server + +* Tool to enumerate available adapters and displays on the system + +Prerequisites +------------- + +To build the project configure system wide proxies if you work behind a proxy +server and install the following software: + +* `Git`_ +* `Meson`_ +* Visual Studio 2022 or later +* v143 toolchain +* `Windows SDK`_ +* `Windows WDK`_ + +To run the project: + +* IDD driver requires Windows 10, version 1903 or newer + + * **Note:** considering this requirement, IDD driver can be used with Windows + Server 2022, but not with Windows Server 2019 + +* Screen capture and video encoding should work for any Intel GPU + + * **Note:** project was validated for |intel-flex|_ + +Build dependencies +------------------ + +Some components of this project has build dependencies from 3rd party software +libraries. These build dependencies are optional in a sense that missing them +will skip configuration of the components which depend on them. The following +table lists dependencies of each component to help you understand what you +will need to build desired project configuration. + +.. _enum-adapters: ../sources/apps/enum-adapters/readme.rst +.. _IDD driver: ../sources/drivers/idd/readme.rst +.. _idd-setup-tool: ../sources/apps/idd-setup-tool/readme.rst +.. _screen-grab: ../sources/apps/screen-grab/readme.rst +.. _screen-capture: ../sources/streamer/server/screen-capture/readme.rst +.. _webrtc-client: ../sources/apps/webrtc-client/readme.rst + ++-------------------+-----------------------------------------------------+ +| Component | Dependencies | ++===================+=====================================================+ +| `enum-adapters`_ | n/a | ++-------------------+-----------------------------------------------------+ +| `IDD driver`_ | `Windows WDK`_ | ++-------------------+-----------------------------------------------------+ +| `idd-setup-tool`_ | n/a | ++-------------------+-----------------------------------------------------+ +| `screen-grab`_ | * FFmpeg n6.1 or later with enabled QSV encoders | +| | * libvpl | ++-------------------+-----------------------------------------------------+ +| `screen-capture`_ | * FFmpeg n6.1 or later with enabled QSV encoders | +| | * libvpl | +| | * OWT built with ``--cg_server`` flag | +| | * nlohmann_json | +| | * sdl2 | +| | * sioclient | ++-------------------+-----------------------------------------------------+ +| `webrtc-client`_ | * FFmpeg n6.1 or later with enabled dx11va decoders | +| | * OpenSSL | +| | * OWT built with ``--cg_client`` flag | +| | * imgui | +| | * implot | +| | * rapidjson | +| | * sioclient | ++-------------------+-----------------------------------------------------+ + +Project uses meson subprojects to manage dependencies whenever possible. +However, some dependencies must be built manually and correctly placed on the +filesystem. These are: + +* `FFmpeg`_ +* `OpenSSL`_ +* `OWT`_ + +To help with build process we provide a set of `docker configurations <../docker/readme.rst>`_. +You can either use them directly or refer to them for build instructions. + +**Tips:** + +* IDD driver, IDD setup tool and enum adapters tool depend only on Windows SDK + and WDK. If you need only these components you can avoid building other + dependencies. + +* `screen-grab`_ sample should be sufficient to review capture and encoding + part of the project. To build it you need only FFmpeg and libvpl, i.e. + you can avoid building OpenSSL and heavy-weight OWT. + +Build IDD driver +---------------- + +Build of IDD driver is separate from other components. It can be built from +`sources/drivers/idd/IddSampleDriver.sln <../sources/drivers/idd/IddSampleDriver.sln>`_ +solution with Microsoft Visual Studio 2022 or later. For details see +`IDD driver readme <../sources/drivers/idd/readme.rst>`_. + +Build project with ninja backend +-------------------------------- + +Other components use `Meson`_ build system. Default meson backend is ninja. +Perform the following steps to build the project: + +1. Clone Cloud Streaming repository:: + + git clone https://github.com/projectceladon/cloud-streaming.git && cd cloud-streaming + +#. Open x64 Native Tool Command Prompt for your version of Microsoft Visual + Studio (2022 or later) + +#. If behind proxy, configure proxy settings as follows:: + + set http_proxy=http://some-proxy.com:911 + set https_proxy=http://some-proxy.com:911 + +#. Configure the project with meson as follows (use full path instead of + ``%PREFIX%`` to set installation path):: + + # go to the top level git project folder + cd cloud-gaming + + # configure the project + meson setup --wrap-mode=forcefallback ^ + --prefix=%PREFIX% ^ + -Dprebuilt-path=C:\path\to\prebuilt\dependencies ^ + _build + +#. Build and install the project:: + + meson compile -C _build + meson install -C _build + +#. If IDD driver is needed, consider to copy it (``.inf``, ``.cat``, ``.dll``) + to ``_build/bin/idd`` folder which is ``idd-setup-tool`` default search + location. + +You can customize your build configuration according to your needs. Refer to +https://mesonbuild.com/Builtin-options.html for details on the ``meson setup`` +options. Below table provides excerpt from meson documentation on the most +useful options: + ++--------------------------------------------------+--------------------------------------------------------------------+ +| Option | Comments | ++==================================================+====================================================================+ +| ``--buildtype={debug, debugoptimized, release}`` | Build type to use. Default is **debug**. | ++--------------------------------------------------+--------------------------------------------------------------------+ +| ``--backend={ninja, vs}`` | Backend to use. Default is **ninja**. ``vs`` will generate VS | +| | solutions. | ++--------------------------------------------------+--------------------------------------------------------------------+ +| ``--vsenv`` | Activate VS environment (64-bit). Useful if you don't want | +| | to start VS command prompt. For example, if you build under MSYS2. | ++--------------------------------------------------+--------------------------------------------------------------------+ +| ``-Db_ndebug={true, false, if-release}`` | Enable or disable asserts. Default is **if-release** (for our | +| | project). | ++--------------------------------------------------+--------------------------------------------------------------------+ +| ``-Dcpp_args="arg1,arg2,..."`` | Additional C++ args to pass to compiler. Use ``c_args`` for C. | ++--------------------------------------------------+--------------------------------------------------------------------+ +| ``-Dcpp_link_args="arg1,arg2,..."`` | Additional C++ args to pass to linker. Use ``c_link_args`` for C. | ++--------------------------------------------------+--------------------------------------------------------------------+ + +Note that if you build under MSYS2 it is strongly recommended to use +``--wrap-mode=forcefallback`` setup option otherwise meson might pick +dependencies from MSYS2 and project might fail to build. + +Generate Visual Studio Solution +------------------------------- + +Microsoft Visual Studio solution is generated by meson if Visual Studio +backend is used - add ``--backend=vs`` to meson setup command line:: + + meson setup --wrap-mode=forcefallback ^ + --backend=vs + --prefix=%PREFIX% ^ + _build + +Solution will be available under ``_build`` folder. You can open it with +Visual Studio and build the project. Note that you can still use meson +build and install commands if needed (meson will call MSBuild instead +of ninja):: + + meson compile -C _build + meson install -C _build + +Using MSYS2 +----------- + +`MSYS2`_ provides environment to build, install and run native Windows +software. At the moment this build environment is not fully supported. You +can't use MSYS2 toolchain to build the project. Some libraries available +under MSYS2 (like sdl2) might cause build failure. + +However, you can use MSYS2 installation of meson to build the project +following below tips. Note that you still need to install Microsoft +Visual Studio and Windows SDK. + +1. Install the following software under meson:: + + # Assuming you run MSYS2 MINGW64 environment shell + pacman -S \ + git \ + mingw-w64-x86_64-ca-certificates \ + mingw-w64-x86_64-meson \ + mingw-w64-x86_64-python3 + +#. Build and place project dependencies somewhere on the filesystem. + **Important:** it is strongly recommended to build **all** project + dependencies if you build under MSYS2. Otherwise meson might find + dependencies from MSYS2 and build might fail. + +#. Configure the project with meson as follows (use full path instead of + ``$PREFIX`` to set installation path):: + + # go to the top level git project folder + cd cloud-gaming + + # configure the project + meson setup --wrap-mode=forcefallback ^ + --prefix=$PREFIX ^ + -Dprebuilt-path=/c/path/to/prebuilt/dependencies ^ + _build + +#. Build and install the project:: + + meson compile -C _build + meson install -C _build + +Note ``--wrap-mode=forcefallback`` setup option - it forces meson to fetch +dependencies defined under subfolders instead of using them from MSYS2 +installation which might cause build failure. + +Run software +------------ + +Refer to each component readme for details on how to use it: + +* `Indirect Display Driver <../sources/drivers/idd/readme.rst>`_ +* `IDD Setup Tool <../sources/apps/idd-setup-tool/readme.rst>`_ +* `Video Adapters Enumeration Tool <../sources/apps/enum-adapters/readme.rst>`_ +* `Screen Grab Tool <../sources/apps/screen-grab/readme.rst>`_ +* `Screen Capture Streaming Tool <../sources/streamer/server/screen-capture/readme.rst>`_ +* `WebRTC (OWT) Client <../sources/apps/webrtc-client/readme.rst>`_ diff --git a/sources/apps/screen-grab/readme.rst b/sources/apps/screen-grab/readme.rst index eebc2ff..6449f3b 100644 --- a/sources/apps/screen-grab/readme.rst +++ b/sources/apps/screen-grab/readme.rst @@ -45,7 +45,7 @@ Options: * For HEVC: ``main``, ``main10``, ``mainsp``, ``rext``, ``scc`` * For AV1: ``main`` ---bitrate +--bitrate Encoding bitrate (default: ``3000000``). --fps diff --git a/sources/streamer/server/screen-capture/readme.rst b/sources/streamer/server/screen-capture/readme.rst new file mode 100644 index 0000000..5075465 --- /dev/null +++ b/sources/streamer/server/screen-capture/readme.rst @@ -0,0 +1,101 @@ +Screen Capture Streaming Tool +============================= + +.. contents:: + +.. _FFmpeg: https://www.ffmpeg.org/ +.. _OWT: https://github.com/open-webrtc-toolkit/owt-client-native + +Screen Capture is a tool to capture, encode and stream Windows desktop using +WebRTC (OWT). It differs from `Screen Grab Tool <../../../apps/screen-grab/readme.rst>`_ +by having streaming capability while ``screen-grab`` can only dump encoded +bitstream to a file. Use `WebRTC (OWT) Client <../../../apps/screen-grab/readme.rst>`_ +application to receive captured stream and interact with remote server. + +Screen Capture tool supports encoding with AVC, HEVC and AV1. + +Usage +----- + +:: + + screen-capture.exe [] config_file + +Options: + +-h, --help + Print help + +--logfile file + File to use for logging. ``PID`` in the file name will be substituted + with process ID. + +--loglevel + Loglevel (default: ``info``) + +--video-codec + Video codec to use for encoding (default: ``avc``) + +--video-bitrate bitrate + Encoding bitrate. + +--pix_fmt + Use ``yuv420p`` or ``yuv444p`` output format for hevc stream + (default: ``yuv420p``) + +--server-peer-id id + Server (session) ID (default: ``ga``) + +--client-peer-id id + Client ID (default: ``client``) + +--display display + Display output to capture. If this option is not specified tool captures + output of the main display (the first display connected to the first + adapter in DXGI order). + +Config file can be used to set other options. For example, use +``signaling-server-host`` and ``signaling-server-host`` to specify P2P server +location (``localhost`` and ``8095`` by default). + +`enum-adapters <../../../apps/enum-adapters/readme.rst>`_ tool can be used to +check available displays. + +Examples +-------- + +* Capture main display output as AVC stream:: + + ./bin/screen-capture.exe ./config/server.desktop.webRTC.conf + +* Capture main display output as HEVC 444 8-bit stream (444 8-bit is currently supported only for HEVC):: + + ./bin/screen-capture.exe --pix_fmt "yuv444p" ./config/server.desktop.webRTC.hevc.conf + +* Capture ``\\.\DISPLAY1`` output as AVC stream:: + + ./bin/screen-capture.exe --display "\\.\DISPLAY1" ./config/server.desktop.webRTC.conf + +* Capture ``\\.\DISPLAY1`` and ``\\.\DISPLAY2`` outputs as AVC streams. Use two + separate command prompts to run below commands in parallel. Mind that you + must specify different server credentials for the 2nd stream. Use 2 separate + clients to connect to each stream with appropriate credentials:: + + ./bin/screen-capture.exe --display "\\.\DISPLAY1" ^ + ./config/server.desktop.webRTC.conf + + ./bin/screen-capture.exe --display "\\.\DISPLAY2" ^ + --server-peer-id "ga1" --client-peer-id "client1" ^ + ./config/server.desktop.webRTC.conf + +Build prerequisites +------------------- + +Screen Capture Streaming tool has the following build prerequisites: + +* `FFmpeg`_ with enabled QSV encoders +* `OWT`_ built with ``--cg_server`` flag + +You can refer to the dockerfiles provided with this repository to see how these +dependencies should be built - see `dockers <../../../../docker>`_ readme for +details.