mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
Build gstreamer in nvidia image (#36)
* build gstreamer 1.20 for nvidia dockerfile. * add nvidia to build. * add nvidia to start. * add config for nvidia. * upgrade cuda ro 11.4.3. * add cudaconvert to comment. * fix paths. * add cuda to ld. * upgrade supervisord version. * add config to suprtvisord in rebuild. * update nvenc params. * update nvidia dockerfile. * h264 profile constrained-baseline. * h264 send SPS PPS with every IDR.
This commit is contained in:
15
dev/build
15
dev/build
@ -8,7 +8,16 @@ set -e
|
||||
GIT_COMMIT=`git rev-parse --short HEAD`
|
||||
GIT_BRANCH=`git rev-parse --symbolic-full-name --abbrev-ref HEAD`
|
||||
|
||||
docker build -t neko_server_build --target build --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" ..
|
||||
docker build -t neko_server_runtime --target runtime --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" ..
|
||||
# if first argument is nvidia, use nvidia dockerfile
|
||||
if [ "$1" = "nvidia" ]; then
|
||||
echo "Building nvidia docker image"
|
||||
DOCKERFILE="Dockerfile.nvidia"
|
||||
else
|
||||
echo "Building default docker image"
|
||||
DOCKERFILE="Dockerfile"
|
||||
fi
|
||||
|
||||
docker build -t neko_server_app --build-arg "BASE_IMAGE=neko_server_runtime" ./runtime
|
||||
docker build -t neko_server_build --target build --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE ..
|
||||
docker build -t neko_server_runtime --target runtime --build-arg "GIT_COMMIT=$GIT_COMMIT" --build-arg "GIT_BRANCH=$GIT_BRANCH" -f ../$DOCKERFILE ..
|
||||
|
||||
docker build -t neko_server_app --build-arg "BASE_IMAGE=neko_server_runtime" -f ./runtime/$DOCKERFILE ./runtime
|
||||
|
@ -29,4 +29,4 @@ fi
|
||||
|
||||
#
|
||||
# restart server
|
||||
docker exec neko_server_dev supervisorctl restart neko
|
||||
docker exec neko_server_dev supervisorctl -c /etc/neko/supervisord.conf restart neko
|
||||
|
20
dev/runtime/Dockerfile.nvidia
Normal file
20
dev/runtime/Dockerfile.nvidia
Normal file
@ -0,0 +1,20 @@
|
||||
ARG BASE_IMAGE=neko_server_runtime:latest
|
||||
FROM $BASE_IMAGE
|
||||
|
||||
#
|
||||
# install xfce
|
||||
RUN set -eux; apt-get update; \
|
||||
# nvidia docker does not have firefox only firefox-esr
|
||||
apt-get install -y --no-install-recommends xfce4 xfce4-terminal firefox sudo; \
|
||||
#
|
||||
# add user to sudoers
|
||||
usermod -aG sudo neko; \
|
||||
echo "neko:neko" | chpasswd; \
|
||||
echo "%sudo ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers; \
|
||||
# clean up
|
||||
apt-get clean -y; \
|
||||
rm -rf /var/lib/apt/lists/* /var/cache/apt/*
|
||||
|
||||
#
|
||||
# copy configuation files
|
||||
COPY supervisord.conf /etc/neko/supervisord/xfce.conf
|
101
dev/runtime/config.nvidia.yml
Normal file
101
dev/runtime/config.nvidia.yml
Normal file
@ -0,0 +1,101 @@
|
||||
capture:
|
||||
video:
|
||||
codec: h264
|
||||
ids:
|
||||
- nvh264enc
|
||||
- x264enc
|
||||
pipelines:
|
||||
nvh264enc:
|
||||
fps: 25
|
||||
bitrate: 2
|
||||
#gst_prefix: "! cudaupload ! cudaconvert ! video/x-raw(memory:CUDAMemory),format=NV12"
|
||||
gst_prefix: "! video/x-raw,format=NV12"
|
||||
gst_encoder: "nvh264enc"
|
||||
gst_params:
|
||||
bitrate: 3000
|
||||
rc-mode: 5 # Low-Delay CBR, High Quality
|
||||
preset: 5 # Low Latency, High Performance
|
||||
zerolatency: true
|
||||
gop-size: 25
|
||||
gst_suffix: "! h264parse config-interval=-1 ! video/x-h264,stream-format=byte-stream,profile=constrained-baseline"
|
||||
x264enc:
|
||||
fps: 25
|
||||
bitrate: 1
|
||||
gst_prefix: "! video/x-raw,format=I420"
|
||||
gst_encoder: "x264enc"
|
||||
gst_params:
|
||||
threads: 4
|
||||
bitrate: 4096
|
||||
key-int-max: 25
|
||||
byte-stream: true
|
||||
tune: zerolatency
|
||||
speed-preset: veryfast
|
||||
gst_suffix: "! video/x-h264,stream-format=byte-stream,profile=constrained-baseline"
|
||||
|
||||
server:
|
||||
pprof: true
|
||||
|
||||
desktop:
|
||||
screen: "1920x1080@60"
|
||||
|
||||
member:
|
||||
provider: "object"
|
||||
object:
|
||||
users:
|
||||
- username: "admin"
|
||||
password: "admin"
|
||||
profile:
|
||||
name: "Administrator"
|
||||
is_admin: true
|
||||
can_login: true
|
||||
can_connect: true
|
||||
can_watch: true
|
||||
can_host: true
|
||||
can_share_media: true
|
||||
can_access_clipboard: true
|
||||
sends_inactive_cursor: true
|
||||
can_see_inactive_cursors: true
|
||||
- username: "user"
|
||||
password: "neko"
|
||||
profile:
|
||||
name: "User"
|
||||
is_admin: false
|
||||
can_login: true
|
||||
can_connect: true
|
||||
can_watch: true
|
||||
can_host: true
|
||||
can_share_media: true
|
||||
can_access_clipboard: true
|
||||
sends_inactive_cursor: true
|
||||
can_see_inactive_cursors: false
|
||||
# provider: "file"
|
||||
# file:
|
||||
# path: "/home/neko/members.json"
|
||||
# provider: "multiuser"
|
||||
# multiuser:
|
||||
# admin_password: "admin"
|
||||
# user_password: "neko"
|
||||
# provider: "noauth"
|
||||
|
||||
session:
|
||||
# Allows reconnecting the websocket even if the previous
|
||||
# connection was not closed. Can lead to session hijacking.
|
||||
merciful_reconnect: true
|
||||
# Show inactive cursors on the screen. Can lead to multiple
|
||||
# data sent via WebSockets and additonal rendering cost on
|
||||
# the clients.
|
||||
inactive_cursors: true
|
||||
api_token: "neko123"
|
||||
cookie:
|
||||
# Disabling cookies will result to use Bearer Authentication.
|
||||
# This is less secure, because access token will be sent to
|
||||
# client in playload and accessible via JS app.
|
||||
enabled: false
|
||||
secure: false
|
||||
|
||||
webrtc:
|
||||
icelite: true
|
||||
iceservers:
|
||||
- urls: [ stun:stun.l.google.com:19302 ]
|
||||
# username: foo
|
||||
# credential: bar
|
15
dev/start
15
dev/start
@ -27,6 +27,17 @@ if [ -z $NEKO_NAT1TO1 ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# if first argument is nvidia, start with nvidia runtime
|
||||
if [ "$1" = "nvidia" ]; then
|
||||
echo "Starting nvidia docker image"
|
||||
EXTRAOPTS="--gpus all"
|
||||
CONFIG="config.nvidia.yml"
|
||||
else
|
||||
echo "Starting default docker image"
|
||||
EXTRAOPTS=""
|
||||
CONFIG="config.yml"
|
||||
fi
|
||||
|
||||
echo "Using app port: ${NEKO_PORT}"
|
||||
echo "Using mux port: ${NEKO_MUX}"
|
||||
echo "Using IP address: ${NEKO_NAT1TO1}"
|
||||
@ -41,6 +52,8 @@ docker run --rm -it \
|
||||
-e "NEKO_WEBRTC_TCPMUX=${NEKO_MUX}" \
|
||||
-e "NEKO_WEBRTC_NAT1TO1=${NEKO_NAT1TO1}" \
|
||||
-e "NEKO_SESSION_FILE=/home/neko/sessions.txt" \
|
||||
-v "${PWD}/runtime/config.yml:/etc/neko/neko.yml" \
|
||||
-v "${PWD}/runtime/$CONFIG:/etc/neko/neko.yml" \
|
||||
-e "NEKO_DEBUG=1" \
|
||||
--shm-size=2G \
|
||||
$EXTRAOPTS \
|
||||
neko_server_app:latest;
|
||||
|
Reference in New Issue
Block a user