Currently, TV audiences can only interact with the shows they are watching through social media or hybrid broadcast broadband TV. Additionally, content creators in film, TV or live productions face technical challenges that result in less engaging content. The EU-funded AdMiRe project aims to tackle both these problems by developing, validating and demonstrating innovative solutions based on mixed reality technology. These solutions will enable audiences at home to be incorporated into the live TV programme they are watching and to interact with people in the TV studio. They will also provide content creators with tools that radically improve talent immersion and interaction with computer-generated elements.
This repository contains the result of EPFL's contribution to the project, i.e the Background Extraction and Super Resolution modules, with input and output as NDI streams.
Operating System: Windows 10 64-bit
Graphics card: NVIDIA® GeForce RTX® 20XX and 30XX Series, Quadro RTX™ 3000, TITAN RTX™, or higher (any NVIDIA GPUs with Tensor Cores)
Download Visual Studio 2017 here (it might ask you to connect with your Microsoft account).
Desktop development with C++ is the only required checkbox [x]
Install the requirements:
Download the NVIDIA Maxine Video Effects SDK here
Follow the instructions on NVIDIA Maxine Video Effects' documentation
Don't forget to:
- Rename the folder
MAXINE-VFX-SDK-master-OSS
and move it toC:/Users/[username]/
- Install the SDK installer (this was specified in their github repository)
- [CMake] click "Configure", check the "Install SDK" box, click "Generate" and select:
- Visual Studio 2017
- x64
- [Visual Studio 2017] Make sure that you are building the Release version (and not the Debug one)
- [Visual Studio 2017 - if needed] Wait for the error containing the link and add the h264 dll file to the
Release
folder, alongside the executables
[WARNING] You cannot build anything until you have finished the installation of OpenCV (see below). So leave this window open and continue the installation process. We explain everything in the last section, 7. Final Steps.
- Install Miniconda
- Run
conda init
in the terminal, close the terminal and reopen it to take the changes into account - Run
conda install pytorch==1.11.0 torchvision==0.12.0 torchaudio==0.11.0 cudatoolkit=11.3 -c pytorch
to install a compatible version of pytorch - Run
pip install -r requirements.txt
to install the required dependencies
- Download and run both the runtime and the development installers, and select complete installation for both
- Add the bin and the lib folders (inside the GStreamer folder) to the PATH
- Add an enviroment variable called
GSTREAMER_DIR
with the path to GStreamer (usuallyC:/gstreamer
orD:/gstreamer
)
Run the following command to make sure that GStreamer works properly:
gst-launch-1.0 -v videotestsrc ! autovideosink
- Clone gst-plugin-ndi inside
C:/Users/[username]
for example - Download and install Rust from here
- If not already installed, install the regular (not advanced) NDI sdk
- Copy .dll and .lib files from Bin and Lib folder of the NDI sdk installation path to gst-plugin-ndi folder
- Run
cargo build --release
from the git repository folder (C:/Users/[username]/gst-plugin-ndi/
for example) - Move the NDI SDK .dll and .lib files from
C:/Program Files/NDI/NDI 5 SDK/Bin
andC:/Program Files/NDI/NDI 5 SDK/Lib
to.../gst-plugin-ndi/target/release
- Add the release folder to the PATH
- Add the release folder as an environment variable called
GST_PLUGIN_PATH
- Run
gst-inspect-1.0.exe ndisrc
,gst-inspect-1.0.exe ndisink
andgst-inspect-1.0.exe ndi
to make sure the plugin was correctly installed. These commands should output details about the GStreamer elements.
- Download the source code for OpenCV 3.4.6, unzip it, and put it inside
C:/Users/[username]
for example - Run CMake, specify the path to the OpenCV folder as the source, the build folder as the output, and click Configure
- Check that GStreamer is found (there should be a list of paths appearing next to GStreamer elements), and that the WITH_GSTREAMER box is ticked
- Tick the OPENCV_PYTHON3_VERSION box
- Tick the BUILD_opencv_world box
- Click Generate
- Open the solution file located in the build folder
- Make sure that Release is selected on top (not Debug)
- Rebuild (and wait, this can take from several minutes to 1 hour depending on your computer)
-
Run
git clone https://github.com/mmspg/AdMiRe_EPFL.git
in the folder of your choice -
Open the Visual Studio 2017 solution file from the NVIDIA MAxine Video Effects SDK Release folder
-
Remove the
AigsEffectApp.cpp
from theAigsEffectApp/Source Files
folder in Visual Studio 2017 (right menu) -
Remove the
VideoEffectsApp.cpp
from theVideoEffectsApp/Source Files
folder in Visual Studio 2017 (right menu) -
Copy the
AigsEffectApp.cpp
andVideoEffectsApp.cpp
files located in the NVIDIA_Maxine_modules folder of this repository to theAigsEffectApp/Source Files
andVideoEffectsApp/Source Files
directories respectively, in Visual Studio 2017 (right menu). This will link the .cpp files of this repo to the Visual Studio 2017 solution project. -
Right-click on AigsEffectApp and Rebuild
-
Right-click on VideoEffectsApp and Rebuild
-
Install NDI Tools here
- [CMake] Make sure to delete the cache and/or delete the build folder before configurating if needed.
Once you have installed everything, you should be able to run our pipelines.
First, make sure that you have an NDI stream to provide as input. If you need to create one, you can simply use the Screen Capture application shipped with NDI Tools. To do so, open the application, right-click on its icon in the taskbar and select Webcam Video Source
> [YOUR VIDEO INPUT]
.
You can check that your computer indeed receives the NDI stream of interest with the Studio Monitor application shipped with NDI Tools.
Once you made sure that you are receiving an NDI stream, open the Webcam Input application shipped with NDI Tools, right-click on its icon in the taskbar and select [YOUR COMPUTER NAME]
> [YOUR NDI STREAM]
. Also, right-click on its icon in the taskbar and select Video
> 720p30
. This will turn the stream into a 720p/30fps virtual webcam. This step is required in order for our pipeline to handle dynamic changes in resolution or aspect-ratio.
The PowerShell pipelines are located in src/powershell_pipelines
. Here is the list of pipelines and their goal:
BE = Background Extraction
SR = Super-Resolution
pipeline_MODNet_nvidiaMaxineSR.ps1
- webcam -> MODNet BE -> UDP link -> NVIDIA Maxine SR -> NDI streampipeline_byteDanceRvmBE_nvidiaMaxineSR.ps1
- webcam -> RVM BE -> UDP link -> NVIDIA Maxine SR -> NDI streampipeline_nvidiaMaxineBE.ps1
- webcam -> NVIDIA Maxine BE -> NDI streampipeline_nvidiaMaxineBE_SR.ps1
- webcam -> NVIDIA Maxine BE -> UDP link -> NVIDIA Maxine SR -> NDI streampipeline_nvidiaMaxineBE_SR_linkNDI.ps1
- webcam -> MODNet BE -> NDI link -> NVIDIA Maxine SR -> NDI streampipeline_nvidiaMaxineSR.ps1
- webcam -> NVIDIA Maxine SR -> NDI stream
Parameters:
- index_val: The webcam index to use as input (default: 0)
- comp_mode: The compositing mode (default: 2 (green screen)). See
module_config_doc.md
insrc/helper
for more information. - fps: The desired framerate (default: 25)
- output: The output stream type,
ndi
orudp
(default:ndi
)
Usage:
- Default parameters:
- right-click on the selected pipeline -
Run with PowerShell
- right-click on the selected pipeline -
- Non-default parameters:
- Open a Windows PowerShell window
- Navigate to the
powershell_pipelines
folder - Run the PowerShell script with the desired parameters (see above).
- Example:
.\pipeline_nvidiaMaxineBE.ps1 -index_val=1 -comp_mode=7
After a few seconds, you should see something similar to the screenshot below.
Make sure that your new NDI stream was created, by using the Studio Monitor application.
A more user-friendly way to run the modules was implemented using an HTTP client/server communication.
1/ Run the HTTP server by typing on the command line python run_server.py
2/ Change src/helper/default_module_config.json
to match the desired module choices and parameters for background extraction and/or super-resolution. A detailed explanation of this file is available at src/helper/module_config_doc.md
.
3/ Run the HTTP client by typing on the command line python run_client.py
4/ Choose whether to START, STOP, or CHECK the modules using the client terminal output
The GPL v3 License applies to the original source code from this project. The same License applies to files from the third party Robust Video Matting. The Apache-2.0 license applies to the third party code from MODNet.
The authors will like to acknowledge contributions from the H2020 Innovation Action "Advanced Mixed Realities (AdMiRe)" under grant agreement 952027. Valuable interactions and feedback received from project partners during integration, testing and validation of the modules reported in this paper are also acknowledged.