This project uses obs-studio to switch input streams in the backend. Use obs-node as the node wrapper of obs-studio.
npm run build && npm start
- Create config.json
wget https://raw.githubusercontent.com/MengLi619/obs-headless-node/master/src/resource/config.json
- Edit config.json with real environment
- Run in docker
docker run \ --name obs-headless-node \ -d \ --rm \ -p 8080:8080 \ -v "$(pwd)/config.json":/node-app/dist/resource/config.json \ registry.cn-beijing.aliyuncs.com/mengli/obs-headless-node:latest
Note: We only test the GPU version in ubuntu 20.04 and cuda 11.1, and only one GPU in one machine. Other environment should also work with some small change, but we never test it.
- Install cuda driver
https://developer.nvidia.com/cuda-downloads - Install docker
https://docs.docker.com/engine/install/ubuntu - Install nvidia-docker2
distribution=$(. /etc/os-release;echo $ID$VERSION_ID) curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add - curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list sudo apt-get update sudo apt-get install -y nvidia-docker2 sudo systemctl restart docker
- Install xorg service, which will run the Xorg from host to support GPU accessibility.
wget https://raw.githubusercontent.com/MengLi619/obs-headless-node/master/install-xorg-service.sh bash install-xorg-service.sh
- Run docker with nvidia runtime
docker run -it \ --name obs-headless-node \ --privileged \ --runtime nvidia \ --rm \ -p 8080:8080 \ -e DISPLAY=:99 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -v "$(pwd)/config.json":/node-app/dist/resource/config.json \ registry.cn-beijing.aliyuncs.com/mengli/obs-headless-node:latest-gpu