[gst] new scripts for stereo and mono video stream

This commit is contained in:
Artur 2025-10-31 16:56:23 +03:00
parent 5d90da81d6
commit e61bf9fccf
14 changed files with 230 additions and 40 deletions

16
compose-gstreamer-x264.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
gst-launch-1.0 \
compositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1920 sink_1::ypos=0 background=1 ! \
'video/x-raw,width=3840,height=1080,framerate=60/1,format=I420' ! \
x264enc bitrate=8000 speed-preset=ultrafast tune=zerolatency sliced-threads=true b-adapt=false rc-lookahead=0 ref=0 frame-packing=3 ! \
rtph264pay ! \
udpsink host=239.239.239.3 port=2055 auto-multicast=true sync=false async=false qos=false \
\
decklinkvideosrc device-number=0 connection=0 mode=1080p60 drop-no-signal-frames=false ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_0 \
\
decklinkvideosrc device-number=1 connection=0 mode=1080p60 drop-no-signal-frames=false ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_1

View File

@ -1,18 +1,18 @@
#!/bin/bash
gst-launch-1.0 \
compositor name=comp sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1920 sink_1::ypos=0 ! nvvideoconvert ! \
'video/x-raw(memory:NVMM),width=3840,height=1080,framerate=60/1,format=I420' ! \
nvv4l2h264enc bitrate=10000000 control-rate=1 idrinterval=1 tuning-info-id=3 preset-id=1 profile=0 ! \
h264parse config-interval=1 ! \
mpegtsmux ! \
rtpmp2tpay ! \
udpsink host=239.239.239.3 port=2055 auto-multicast=true sync=false async=false qos=false \
\
decklinkvideosrc device-number=0 connection=1 mode=1080p60 drop-no-signal-frames=true ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_0 \
\
decklinkvideosrc device-number=1 connection=1 mode=1080p60 drop-no-signal-frames=true ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_1
compositor name=comp background=1 sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1920 sink_1::ypos=0 ! \
capsfilter caps='video/x-raw,width=3840, height=1080,framerate=60/1' ! \
nvvideoconvert ! \
capsfilter caps='video/x-raw(memory:NVMM),width=3840,height=1080,framerate=60/1,format=NV12' ! \
nvv4l2h264enc bitrate=8000000 control-rate=1 idrinterval=256 tuning-info-id=3 preset-id=1 profile=0 ! \
rtph264pay ! \
udpsink host=239.239.239.3 port=2055 auto-multicast=true sync=false async=false qos=false \
\
decklinkvideosrc device-number=0 connection=0 mode=1080p60 drop-no-signal-frames=false ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_0 \
\
decklinkvideosrc device-number=1 connection=0 mode=1080p60 drop-no-signal-frames=false ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_1

25
compose-playback.sh Normal file → Executable file
View File

@ -1,16 +1,15 @@
#!/bin/bash
gst-launch-1.0 udpsrc address=239.239.239.3 port=2055 ! \
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP2T" ! \
rtpmp2tdepay ! \
tsdemux ! \
h264parse ! \
avdec_h264 ! \
videoconvert ! \
tee name=t \
\
t. ! queue ! videocrop left=0 right=1920 top=0 bottom=0 ! \
autovideosink sync=false \
\
t. ! queue ! videocrop left=1920 right=0 top=0 bottom=0 ! \
autovideosink sync=false
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! \
rtph264depay ! \
capsfilter caps='video/x-h264, width=3840,height=1080' ! \
avdec_h264 ! \
capsfilter caps='video/x-raw, width=3840,height=1080' ! \
tee name=t \
\
t. ! queue leaky=2 ! videocrop left=0 right=1920 top=0 bottom=0 ! \
autovideosink sync=false \
\
t. ! queue leaky=2 ! videocrop left=1920 right=0 top=0 bottom=0 ! \
autovideosink sync=false

14
compose-sink.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
gst-launch-1.0 \
compositor name=comp background=1 sink_0::xpos=0 sink_0::ypos=0 sink_1::xpos=1920 sink_1::ypos=0 ! \
'video/x-raw,width=3840,height=2160,framerate=60/1' ! \
autovideosink sync=false \
\
decklinkvideosrc device-number=0 connection=0 mode=1080p60 drop-no-signal-frames=true ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_0 \
\
decklinkvideosrc device-number=1 connection=0 mode=1080p60 drop-no-signal-frames=true ! \
'video/x-raw,format=(string)UYVY' ! \
comp.sink_1

21
gst-stereo.sh Executable file
View File

@ -0,0 +1,21 @@
#!/bin/bash
#
./gstreamer-record.sh &
left=$!
./gstreamer-record-r.sh &
right=$!
cleanup() {
kill -s SIGINT $left
kill -s SIGINT $right
exit 0
}
trap cleanup SIGINT
while true; do
sleep 1
done

16
gstNvinfer.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
gst-launch-1.0 filesrc location=$1 ! \
rawvideoparse format=2 height=540 width=960 framerate=60000/1001 ! \
clocksync sync-to-first=true ! \
nvvideoconvert ! \
capsfilter caps="video/x-raw(memory:NVMM),format=RGBA,height=1080,width=1920" ! \
m.sink_0 nvstreammux name=m batch-size=1 width=1920 height=1080 ! \
nvinfer config-file-path=config.txt ! \
nvvideoconvert ! \
nvsegvisual ! \
capsfilter caps="video/x-raw(memory:NVMM),format=RGBA" ! \
nvvideoconvert ! \
nvv4l2h264enc bitrate=6850000 profile=2 preset-id=3 control-rate=2 idrinterval=256 tuning-info-id=3 ! \
capsfilter caps="video/x-h264,profile=main" ! h264parse ! mpegtsmux ! \
filesink location="autotest-nvv4l2h264enc-main-test-base-daVinci.mp4"

View File

@ -3,15 +3,15 @@
# Set environment variables for GStreamer latency tracing.
# Note: We are using a different log file name to avoid overwriting the sender's log.
GST_DEBUG_COLOR_MODE=off \
GST_TRACERS="latency(flags=pipeline+element)" \
GST_DEBUG="GST_TRACER:7" \
GST_DEBUG_FILE=latency_traces_receiver.log \
gst-launch-1.0 -v \
udpsrc uri="udp://239.239.239.3:8889" ! \
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP2T" ! \
rtpmp2tdepay ! \
tsdemux latency=0 ! \
h264parse ! \
avdec_h264 qos=false ! \
videoconvert ! \
autovideosink sync=false
GST_TRACERS="latency(flags=pipeline+element)" \
GST_DEBUG="GST_TRACER:7" \
GST_DEBUG_FILE=latency_traces_receiver.log \
gst-launch-1.0 -v \
udpsrc uri="udp://239.239.239.3:8889" ! \
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP2T" ! \
rtpmp2tdepay ! \
tsdemux latency=0 ! \
h264parse ! \
avdec_h264 qos=false ! \
videoconvert ! \
autovideosink sync=false

11
gstPlaybackRTPH264.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# Set environment variables for GStreamer latency tracing.
# Note: We are using a different log file name to avoid overwriting the sender's log.
gst-launch-1.0 -v \
udpsrc uri="udp://239.239.239.3:8889" ! \
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! \
rtph264depay ! \
avdec_h264 qos=false ! \
videoconvert ! \
autovideosink sync=false

18
gstX264.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
export GST_DEBUG_COLOR_MODE=off
export GST_TRACERS="latency(flags=pipeline+element)"
export GST_DEBUG="GST_TRACER:7"
export GST_DEBUG_FILE=latency_traces.log
decklink="decklinkvideosrc drop-no-signal-frames=true mode=1080p60 device-number=1 connection=0"
gst-launch-1.0 $decklink ! \
videoconvert n-threads=4 ! \
capsfilter caps="video/x-raw,width=1920,height=1080" ! \
x264enc bitrate=20000 speed-preset=ultrafast tune=zerolatency sliced-threads=true b-adapt=false rc-lookahead=0 ref=0 key-int-max=10 ! \
capsfilter caps="video/x-h264,profile=baseline" ! \
h264parse config-interval=1 ! \
mpegtsmux ! \
rtpmp2tpay ! \
udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false

16
gstX264OnlyPay.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
export GST_DEBUG_COLOR_MODE=off
export GST_TRACERS="latency(flags=pipeline+element)"
export GST_DEBUG="GST_TRACER:7"
export GST_DEBUG_FILE=latency_traces.log
decklink="decklinkvideosrc drop-no-signal-frames=true mode=1080p60 device-number=1 connection=0"
gst-launch-1.0 $decklink ! \
videoconvert n-threads=4 ! \
capsfilter caps="video/x-raw,width=1920,height=1080" ! \
x264enc bitrate=4000 speed-preset=ultrafast tune=zerolatency sliced-threads=true b-adapt=false rc-lookahead=0 ref=0 ! \
capsfilter caps="video/x-h264,profile=baseline" ! \
rtph264pay ! \
udpsink host=239.239.239.3 port=8889 auto-multicast=true sync=false async=false qos=false

16
videosink/compose-playback.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
gst-launch-1.0 udpsrc address=239.239.239.3 port=2055 ! \
"application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)MP2T" ! \
rtpmp2tdepay ! \
tsdemux ! \
h264parse ! \
nvv4l2decoder ! \
nvvideoconvert ! \
tee name=t \
\
t. ! queue ! videocrop left=0 right=1920 top=0 bottom=0 ! \
autovideosink sync=false \
\
t. ! queue ! videocrop left=1920 right=0 top=0 bottom=0 ! \
autovideosink sync=false

30
videosink/gstNvH264.sh Executable file
View File

@ -0,0 +1,30 @@
#!/bin/bash
export GST_DEBUG_COLOR_MODE=off
export GST_TRACERS="latency(flags=pipeline+element)"
export GST_DEBUG="GST_TRACER:7"
export GST_DEBUG_FILE=latency_traces.log
decklink="decklinkvideosrc drop-no-signal-frames=true mode=1080p60 device-number=1 connection=0 buffer-size=1 "
gst-launch-1.0 $decklink ! \
capsfilter caps="video/x-raw, format=(string)UYVY" ! \
videoconvert n-threads=4 ! \
capsfilter caps="video/x-raw,width=1920,height=1080, format=NV12" ! \
nvh264enc rc-mode=2 bitrate=4000 preset=4 bframes=0 b-adapt=false rc-lookahead=0 zerolatency=true ! \
capsfilter caps="video/x-h264,profile=baseline" ! \
nvh264dec ! \
videoconvert n-threads=4 ! \
autovideosink
exit 0
gst-launch-1.0 $decklink ! \
glupload ! \
glcolorconvert ! \
capsfilter caps="video/x-raw(memory:GLMemory),width=1280,height=720" ! \
nvh264enc rc-mode=2 bitrate=10000 preset=3 gop-size=0 bframes=0 b-adapt=false zerolatency=true ! \
capsfilter caps="video/x-h264,profile=baseline" ! \
nvh264dec ! \
glcolorconvert ! \
glimagesink

17
videosink/gstNvv4l2h264.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#export GST_DEBUG_COLOR_MODE=off
#export GST_TRACERS="latency(flags=pipeline+element)"
#export GST_DEBUG="GST_TRACER:7"
#export GST_DEBUG_FILE=latency_traces.log
decklink="decklinkvideosrc drop-no-signal-frames=true mode=1080p60 device-number=0 connection=0 buffer-size=1"
gst-launch-1.0 $decklink ! \
capsfilter caps="video/x-raw,format=(string)UYVY" ! \
nvvideoconvert bl-output=true contiguous-buffers=true output-buffers=1 ! \
capsfilter caps="video/x-raw(memory:NVMM),format=NV12,width=1920,height=1080" ! \
nvv4l2h264enc bitrate=4000000 control-rate=2 idrinterval=1 tuning-info-id=3 preset-id=1 profile=0 ! \
capsfilter caps="video/x-h264, profile=baseline" ! \
avdec_h264 ! \
nveglglessink

16
videosink/gstX264.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
export GST_DEBUG_COLOR_MODE=off
export GST_TRACERS="latency(flags=pipeline+element)"
export GST_DEBUG="GST_TRACER:7"
export GST_DEBUG_FILE=latency_traces.log
decklink="decklinkvideosrc drop-no-signal-frames=true mode=1080p60 device-number=1 connection=0"
gst-launch-1.0 $decklink ! \
videoconvert n-threads=4 ! \
capsfilter caps="video/x-raw,width=1920,height=1080" ! \
x264enc bitrate=4000 speed-preset=ultrafast tune=zerolatency sliced-threads=true b-adapt=false rc-lookahead=0 ref=0 ! \
capsfilter caps="video/x-h264,profile=baseline" ! \
avdec_h264 ! \
autovideosink