使用 webRTC 从 docker 容器捕获 xvfb 流

使用 webRTC 从 docker 容器捕获 xvfb 流

我有一个 Windows 游戏.exe文件,并使用 xvfb 版本的 X 服务器在 docker 容器(在 EC2 Linux VM 中)内运行该游戏。现在我想使用 webRTC 将 X 服务器流从 docker 容器捕获到我的本地系统。我应该怎么做?

这是我的Dockerfile:

FROM ubuntu:22.04

#Specify a workdir, to better organize your files inside the container.

WORKDIR /app

#Update package lists and install required packages

RUN apt-get update 
RUN apt-get install -y wget software-properties-common gnupg2 winbind xvfb 
RUN apt-get -qq update -y && apt-get -qq install -y --no-install-recommends \ 
build-essential cpp cpp-9 g++-9 gcc-9 gcc-10 g++-10 gcc-multilib gcc-mingw-w64
git-core
dkms
ffmpeg

#Add Wine repository and install

RUN dpkg --add-architecture i386 
RUN mkdir -pm755 /etc/apt/keyrings 
RUN wget -O /etc/apt/keyrings/winehq-archive.key https://dl.winehq.org/wine-builds/winehq.key 
RUN wget -NP /etc/apt/sources.list.d/ https://dl.winehq.org/wine-builds/ubuntu/dists/jammy/winehq-jammy.sources 
RUN apt-get update

RUN apt-get -qq update -y && apt-get -qq install -y --no-install-recommends libasound2-dev libdbus-1-dev libfontconfig-dev libfreetype-dev libgnutls28-dev libldap-common
libodbc1 libv4l-0 libjpeg-dev libldap2-dev libpng-dev libtiff-dev libgl-dev libunwind-dev libxml2-dev
libxslt1-dev
libfaudio-dev
libmpg123-dev
libosmesa6-dev
libsdl2-dev
libudev-dev
libvkd3d-dev \ 
libvulkan-dev

RUN apt-get -qq update -y && apt-get -qq install -y --no-install-recommends
ocl-icd-opencl-dev
bison
schroot
debootstrap
flex

RUN apt-get -qq update -y && apt-get -qq install -y --no-install-recommends
libmpg123-dev:i386
libosmesa6-dev:i386
libvulkan-dev:i386
ocl-icd-opencl-dev:i386
bison:i386
flex:i386

RUN apt-get install -y linux-firmware

#Install additional packages and configure Wine

RUN apt-get install --no-install-recommends -y winehq-stable winetricks cabextract

RUN winetricks msxml6

#Cleanup unnecessary files

RUN apt-get clean RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

ENV WINEDEBUG=-d3d

COPY app /root/catalyst COPY overcooked_drm-free_20_566540 /root/overcooked_drm-free_20_566540 COPY startup.sh /root/startup.sh RUN chmod 755 /root/startup.sh

EXPOSE 9000

CMD ["/root/startup.sh"]

Startup.sh

#!/usr/bin/env bash

sleep 1s Xvfb :1 -screen 0 1024x768x24 &

glxinfo -force-d3d9 ffmpeg -video_size 1024x768 -framerate 25 -f x11grab -i :1 -t 120 outputofscreen1.mp4 &

DISPLAY=:1 wine /root/overcooked_drm-free_20_566540/Overcooked.exe -force-d3d11

到目前为止,我正在xserver使用捕获流ffmpeg并将其存储在.mp4文件中。现在我想通过使用 webRTC 进行连接和流式传输在本地机器上玩游戏。

.exe我已经使用 wine 和服务器在 Linux 中运行xvfb,它捕获了流ffmpeg并将其存储在.mp4文件中。

相关内容