Compare commits
2 Commits
4f138b0282
...
cb6f7f03e5
| Author | SHA1 | Date | |
|---|---|---|---|
| cb6f7f03e5 | |||
| 09267f8f37 |
2
.gitignore
vendored
2
.gitignore
vendored
@ -0,0 +1,2 @@
|
|||||||
|
*.log
|
||||||
|
container/Drivers/*
|
||||||
41
README.md
Normal file
41
README.md
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
# What is it?
|
||||||
|
|
||||||
|
In this repository collected different pipelines with workarounds for zero latency streaming.
|
||||||
|
Main idea for now is using of docker container with running Ubuntu 22.04 distro inside, mostly for testing purposes.
|
||||||
|
We must passthrough in this case GPU and Decklink devices for this purpose it is necessary to have similar driver versions on host and container system, otherwise it just will not work.
|
||||||
|
Component diagram showing what we want to achieve
|
||||||
|
```plantuml
|
||||||
|
``@startuml
|
||||||
|
node "Host" {
|
||||||
|
package "Docker" {
|
||||||
|
interface "UDP socket" as USock
|
||||||
|
package "Container" {
|
||||||
|
USock - [Gst Pipeline]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
USock ..> NetworkBridge
|
||||||
|
[Kernel] -left- GPU
|
||||||
|
DeckLink -up- [Kernel]
|
||||||
|
NetworkBridge - [Docker]
|
||||||
|
NetworkAdapter -left- [Kernel]
|
||||||
|
|
||||||
|
[Gst Pipeline] ..> GPU
|
||||||
|
[Gst Pipeline] ..> DeckLink
|
||||||
|
NetworkBridge ..> NetworkAdapter
|
||||||
|
}
|
||||||
|
node "Router" {
|
||||||
|
port PhysicalPort1
|
||||||
|
port PhysicalPort2
|
||||||
|
NetworkAdapter --> PhysicalPort2
|
||||||
|
}
|
||||||
|
node "Oculus" {
|
||||||
|
interface WiFi
|
||||||
|
component MedicineApp
|
||||||
|
MedicineApp <-- WiFi
|
||||||
|
WiFi --> PhysicalPort1
|
||||||
|
}
|
||||||
|
@enduml
|
||||||
|
```sh
|
||||||
|
sudo docker run --runtime=nvidia --gpus all -v ~/git/gstreamer-pipelines/:/app deepstream-gst:12.6
|
||||||
|
```
|
||||||
@ -19,14 +19,21 @@ RUN apt-get update && \
|
|||||||
# Set environment variables for OpenGL
|
# Set environment variables for OpenGL
|
||||||
ENV NVIDIA_DRIVER_CAPABILITIES $NVIDIA_DRIVER_CAPABILITIES,video
|
ENV NVIDIA_DRIVER_CAPABILITIES $NVIDIA_DRIVER_CAPABILITIES,video
|
||||||
ENV DISPLAY :0
|
ENV DISPLAY :0
|
||||||
ENV FILENAME=nvdummy.sh
|
ENV FILENAME=nvfull.sh
|
||||||
|
ENV BMD=bmd_install.sh
|
||||||
# Copy your pipeline script
|
# Copy your pipeline script
|
||||||
COPY $FILENAME /app/
|
COPY $FILENAME /app/
|
||||||
RUN chmod +x /app/$FILENAME
|
RUN chmod +x /app/$FILENAME
|
||||||
|
|
||||||
|
COPY ./Drivers/ /drivers/
|
||||||
|
COPY $BMD /scripts/
|
||||||
|
RUN chmod +x /scripts/$BMD && \
|
||||||
|
cd /scripts && \
|
||||||
|
./$BMD
|
||||||
|
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Default command to run your pipeline
|
# Default command to run your pipeline
|
||||||
CMD ["./nvdummy.sh"]
|
CMD ["sh", "-c", "tail -f /dev/null"]
|
||||||
#CMD ["nvidia-smi"]
|
#CMD ["nvidia-smi"]
|
||||||
53
container/bmd_install.sh
Normal file
53
container/bmd_install.sh
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
driversPath='/drivers'
|
||||||
|
|
||||||
|
ls -lah $driversPath
|
||||||
|
|
||||||
|
fetch_sdk() {
|
||||||
|
echo "Trying to fetch from remote"
|
||||||
|
let pwd=$PWD
|
||||||
|
cd $driversPath
|
||||||
|
wget -r --accept-regex '.*Desktop.*tar' https://vptyp.tech/file/bmd/ || echo "Unable to fetch Driver"
|
||||||
|
wget -r --accept-regex '.*SDK.*zip' https://vptyp.tech/file/bmd/ || echo "Unable to fetch SDK"
|
||||||
|
cd $pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -e /drivers ]]; then
|
||||||
|
echo 'Drivers folder existed!'
|
||||||
|
sdk_name=$(find $driversPath -name "*SDK*zip" -exec basename {} \;)
|
||||||
|
driver_name=$(find $driversPath -name "*Desktop*tar*" -exec basename {} \;)
|
||||||
|
if [[ -n $sdk_name && -n $driver_name ]]; then
|
||||||
|
printf "Found both files names: \n-%s\n-%s\n" $sdk_name $driver_name
|
||||||
|
else
|
||||||
|
printf "Wasn't able to found something: \nSDK name - %s\nDriver name - %s\n" $sdk_name $driver_name
|
||||||
|
fetch_sdk
|
||||||
|
sdk_name=$(find $driversPath -name "*SDK*zip" -exec basename {} \;)
|
||||||
|
driver_name=$(find $driversPath -name "*Desktop*tar*" -exec basename {} \;)
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v unzip >/dev/null 2>&1; then
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! command -v tar >/dev/null 2>&1; then
|
||||||
|
apt-get install -y tar
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$sdk_name" || -z "$driver_name" ]]; then
|
||||||
|
echo 'Failed to find drivers'
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd /drivers
|
||||||
|
unzip ./$sdk_name -d sdk
|
||||||
|
mkdir driver
|
||||||
|
tar -xvzf ./$driver_name -C driver
|
||||||
|
|
||||||
|
cd ./driver/*/deb/x86_64/
|
||||||
|
|
||||||
|
apt-get install -y libjpeg62 libgl1-mesa-glx libxml2
|
||||||
|
|
||||||
|
apt-get install -y ./desktopvideo_*.deb
|
||||||
4
container/build.sh
Executable file
4
container/build.sh
Executable file
@ -0,0 +1,4 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
DOCKER_BUILDKIT=1 sudo docker build --build-arg KERNEL_VERSION=$(uname -r) \
|
||||||
|
-t deepstream-gst:12.6 .
|
||||||
8
container/decklinkTest.sh
Executable file
8
container/decklinkTest.sh
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
gst-launch-1.0 \
|
||||||
|
decklinkvideosrc \
|
||||||
|
device-number=1 \
|
||||||
|
connection=1 \
|
||||||
|
mode=auto \
|
||||||
|
drop-no-signal-frames=true \
|
||||||
|
! videoconvert \
|
||||||
|
! autovideosink sync=false
|
||||||
14
container/nvdummy.sh
Executable file
14
container/nvdummy.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 videotestsrc pattern=smpte ! \
|
||||||
|
capsfilter caps="video/x-raw, width=1920, height=1080, framerate=30/1" ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM)" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
video/x-h264, profile=main ! \
|
||||||
|
nvv4l2decoder ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
fakesink
|
||||||
19
container/nvfull.sh
Executable file
19
container/nvfull.sh
Executable file
@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 decklinkvideosrc \
|
||||||
|
device-number=1 \
|
||||||
|
connection=1 \
|
||||||
|
mode=1080p60 \
|
||||||
|
drop-no-signal-frames=true \
|
||||||
|
videoconvert ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM)" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
video/x-h264, profile=main ! \
|
||||||
|
h264parse config-interval=1 ! \
|
||||||
|
mpegtsmux ! \
|
||||||
|
rtpmp2tpay ! \
|
||||||
|
udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false
|
||||||
14
container/run.sh
Executable file
14
container/run.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
sudo docker run \
|
||||||
|
--runtime=nvidia \
|
||||||
|
--gpus all \
|
||||||
|
--device /dev/blackmagic/io0:/dev/blackmagic/io0 \
|
||||||
|
--device /dev/blackmagic/io1:/dev/blackmagic/io1 \
|
||||||
|
-v ~/git/gstreamer-pipelines/:/app \
|
||||||
|
-v /tmp/.X11-unix:/tmp/.X11-unix \
|
||||||
|
-e DISPLAY=$DISPLAY \
|
||||||
|
--network=host \
|
||||||
|
-v ~/git/gstreamer-pipelines/container/Drivers/:/drivers \
|
||||||
|
--name deepstream-gst \
|
||||||
|
deepstream-gst:12.6
|
||||||
@ -1,8 +1,10 @@
|
|||||||
gst-launch-1.0 \
|
GST_DEBUG=2 \
|
||||||
decklinkvideosrc \
|
gst-launch-1.0 \
|
||||||
|
decklinkvideosrc \
|
||||||
device-number=1 \
|
device-number=1 \
|
||||||
connection=1 \
|
connection=1 \
|
||||||
mode=auto \
|
mode=auto \
|
||||||
drop-no-signal-frames=true \
|
drop-no-signal-frames=true \
|
||||||
! videoconvert \
|
! videoconvert \
|
||||||
! autovideosink sync=false
|
! autovideosink sync=false
|
||||||
|
|
||||||
|
|||||||
11
decklinkTestVideoConvert.sh
Executable file
11
decklinkTestVideoConvert.sh
Executable file
@ -0,0 +1,11 @@
|
|||||||
|
GST_DEBUG=2 \
|
||||||
|
gst-launch-1.0 \
|
||||||
|
decklinkvideosrc \
|
||||||
|
device-number=1 \
|
||||||
|
connection=1 \
|
||||||
|
mode=auto \
|
||||||
|
drop-no-signal-frames=true \
|
||||||
|
! nvvideoconvert \
|
||||||
|
! video/x-raw,format=I420,width=1920,height=1080,framerate=60/1 \
|
||||||
|
! rtpvrawpay \
|
||||||
|
! udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false
|
||||||
6
gst-dummy-sink.sh
Executable file
6
gst-dummy-sink.sh
Executable file
@ -0,0 +1,6 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
gst-launch-1.0 decklinkvideosrc drop-no-signal-frames=true mode=auto device-number=1 connection=1 ! \
|
||||||
|
capsfilter caps="video/x-raw,format=(string)UYVY" ! \
|
||||||
|
videoconvert ! \
|
||||||
|
x264enc ! \
|
||||||
|
fakesink
|
||||||
14
l_nvfull.sh
Executable file
14
l_nvfull.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 decklinkvideosrc device-number=1 connection=1 mode=1080p60 drop-no-signal-frames=true ! \
|
||||||
|
capsfilter caps="video/x-raw,format=(string)UYVY" ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM),format=I420,width=1920,height=1080" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
h264parse config-interval=1 ! \
|
||||||
|
mpegtsmux ! \
|
||||||
|
rtpmp2tpay ! \
|
||||||
|
udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false
|
||||||
14
nvdummy.sh
Executable file
14
nvdummy.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 videotestsrc pattern=smpte ! \
|
||||||
|
capsfilter caps="video/x-raw, width=1920, height=1080, framerate=30/1" ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM)" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
video/x-h264, profile=main ! \
|
||||||
|
nvv4l2decoder ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
fakesink
|
||||||
14
nvfull.sh
Executable file
14
nvfull.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 decklinkvideosrc device-number=1 connection=1 mode=1080p60 drop-no-signal-frames=true ! \
|
||||||
|
capsfilter caps="video/x-raw,format=(string)UYVY" ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM),format=Y444,width=1920,height=1080" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
h264parse config-interval=1 ! \
|
||||||
|
mpegtsmux ! \
|
||||||
|
rtpmp2tpay ! \
|
||||||
|
udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false
|
||||||
14
r_nvfull.sh
Executable file
14
r_nvfull.sh
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
GST_DEBUG_COLOR_MODE=off \
|
||||||
|
GST_TRACERS="latency(flags=pipeline+element)" \
|
||||||
|
GST_DEBUG="GST_TRACER:7" \
|
||||||
|
GST_DEBUG_FILE=latency_traces.log \
|
||||||
|
gst-launch-1.0 decklinkvideosrc device-number=0 connection=1 mode=1080p60 drop-no-signal-frames=true ! \
|
||||||
|
capsfilter caps="video/x-raw,format=(string)UYVY" ! \
|
||||||
|
nvvideoconvert ! \
|
||||||
|
capsfilter caps="video/x-raw(memory:NVMM),format=I420,width=1920,height=1080" ! \
|
||||||
|
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=3 profile=2 ! \
|
||||||
|
h264parse config-interval=1 ! \
|
||||||
|
mpegtsmux ! \
|
||||||
|
rtpmp2tpay ! \
|
||||||
|
udpsink host=239.239.239.3 port=8890 auto-multicast=true sync=false async=false qos=false
|
||||||
Loading…
x
Reference in New Issue
Block a user