UE4 像素流 WebRTC在Ubuntu Docker上运行


1、宿主机环境


ubuntu18


安装


docker


ue4-docker2


nvidia-container-toolkit


Vulkan SDK


Nvidia Drivers


2、用ue4-docker 构建ue4.23.1-pixelstreaming 基础镜像


ue4-docker build \  custom:4.23.1-pixelstreaming \                        # Tag the image as adamrehn/ue4-full:4.23.1-pixelstreaming  -repo=https://github.com/comin2013/UnrealEngine.git \  # 使用自己修改过的包含多线程加速下载依赖文件的UE仓库,也可以使用本地下载好了的包含加速的仓库


  -branch=4.23.1-pixelstreaming


3、创建UE4.23.1-pixelstreaming 工程 P1,流程如下


Linux下 git clone https://github.com/comin2013/UnrealEngine.git


工程目录下依次执行:


./Setup.sh


./GenerateProjectFiles.sh


make


然后运行Engine/Binaries/Linux/UE4Editor


启用PixelStreaming 插件


创建工程P1


4、制作包含P1的镜像Image1, Dockerfile 如下:


# Perform the build in an Unreal Engine container image that includes the Engine Tools and Linux support for Pixel Streaming


FROM adamrehn/ue4-full:4.23.1-pixelstreaming AS builder


# Clone or copy the source code for your Unreal project here, e.g.:


COPY --chown=ue4:ue4 ./P1 /tmp/project


# Build and package our Unreal project


RUN ue4 package Development #发行版请删除Development


# Copy the packaged files into a container image that doesn't include any Unreal Engine components


# (Note that the relevant Pixel Streaming files will be copied too, since they're automatically staged with the packaged files)


FROM adamrehn/ue4-runtime:latest


COPY --from=builder --chown=ue4:ue4 /tmp/project/dist/LinuxNoEditor /home/ue4/project


# Enable the NVIDIA driver capabilities required by the NVENC API


ENV NVIDIA_DRIVER_CAPABILITIES ${NVIDIA_DRIVER_CAPABILITIES},video


# Create a symbolic link to the path where libnvidia-encode.so.1 will be mounted, since UE4 seems to ignore LD_LIBRARY_PATH


# (Replace "ProjectName" with the name of your actual Unreal project)


RUN ln -s /usr/lib/x86_64-linux-gnu/libnvidia-encode.so.1 /home/ue4/project/P1/Binaries/Linux/libnvidia-encode.so.1


5、启动Image1


须附带 -gpus=all 参数,否则运行UE4程序会报错:error: XDG_RUNTIME_DIR not set in the environment


6、容器内,


a、启动P1


/project$ ./P1.sh


不需要带 RenderOffScreen参数,否则会报错并退出


b、启动proxy


~/project/Engine/Source/Programs/PixelStreaming/WebRTCProxy/bin$ ./WebRTCProxy -Cirrus=192.168.110.161:8888 //Cirrus指向信令服IP和端口


7、容器宿主机上启动谷歌浏览器,输入信令服务器地址,即可看到容器内运行的PI UE4项目的画面


注:必须在宿主机上访问,是因为容器IP地址未做转换,需要TURN and STUN(coturn) ,由于4.23.1PixelStreaming只支持OpenGL,还不支持Vulkan,所以这里暂时不做深入研究。


关注:Pixel Streaming in Linux containers - Adam Rehn 了解最新情况


2020/11/13 情况如下:


  1. Engine 4.23: branch 4.23.1-pixelstreaming (supports OpenGL only, not Vulkan)

  2. Engine 4.24: coming soon (Epic made a number of significant architectural changes in the way Pixel Streaming is implemented in 4.24, so our implementation of Linux support for 4.23 cannot be simply ported over without major alterations.)

  3. Engine 4.25: coming soon (this will be the first version of Pixel Streaming for Linux that supports Vulkan.)

你可能感兴趣的:(其他,unreal,webrtc,docker)