From e90a9d30d60c792da0f663252c6e649ecfe151fd Mon Sep 17 00:00:00 2001 From: Artur Mukhamadiev Date: Thu, 11 Sep 2025 14:41:54 +0300 Subject: [PATCH] testing pipelines --- ffmpeg-psnr-check.sh | 16 ++++++++++++++++ gstPlayback.sh | 17 +++++++++++++++++ gstreamer-record.sh | 38 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 ffmpeg-psnr-check.sh create mode 100755 gstPlayback.sh create mode 100755 gstreamer-record.sh diff --git a/ffmpeg-psnr-check.sh b/ffmpeg-psnr-check.sh new file mode 100644 index 0000000..1259353 --- /dev/null +++ b/ffmpeg-psnr-check.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +if [ "$#" -ne 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +if ! command -v ffmpeg &> /dev/null +then + echo "ffmpeg could not be found, please install it." + exit 1 +fi + +#this script checks the PSNR between two video streams using ffmpeg +# one video stream is the reference and the other is the test stream both are recorded files +ffmpeg -i "$1" -i "$2" -filter_complex "psnr" -f null /dev/null \ No newline at end of file diff --git a/gstPlayback.sh b/gstPlayback.sh new file mode 100755 index 0000000..35ae884 --- /dev/null +++ b/gstPlayback.sh @@ -0,0 +1,17 @@ +#!/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_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 ! \ + h264parse ! \ + avdec_h264 ! \ + videoconvert ! \ + autovideosink sync=false diff --git a/gstreamer-record.sh b/gstreamer-record.sh new file mode 100755 index 0000000..b2383bf --- /dev/null +++ b/gstreamer-record.sh @@ -0,0 +1,38 @@ +#!/bin/bash + +# This script record two video streams using gstreamer and saves them to files +# The first video stream is the reference and the second is the encoded stream to be tested +# First stream is coming from decklinkvideosrc +# Second stream is same decklinkvideosrc but encoded using x264enc +# Both streams are saved to files using mp4mux and filesink + +if [ "$#" -lt 2 ]; then + echo "Usage: $0 " + exit 1 +fi + +if ! command -v gst-launch-1.0 &> /dev/null +then + echo "gstreamer could not be found, please install it." + exit 1 +fi + +# Record both streams in one run +if [ "$3" == "DEBUG" ]; then + gst-launch-1.0 -e \ + videotestsrc pattern=smpte ! \ + capsfilter caps="video/x-raw,format=RGBA,width=1920,height=1080,framerate=30/1" ! \ + videoconvert ! queue ! tee name=t \ + t. ! queue ! filesink location="$1" \ + t. ! queue ! x264enc bitrate=5000 speed-preset=ultrafast tune=zerolatency ! h264parse ! mpegtsmux ! filesink location="$2" + exit 0 +fi + +gst-launch-1.0 -e \ + decklinkvideosrc \ + device-number=1 \ + connection=1 \ + mode=auto \ + drop-no-signal-frames=true ! videoconvert ! queue ! tee name=t \ + t. ! queue ! mpegtsmux ! filesink location="$1" \ + t. ! queue ! x264enc bitrate=5000 speed-preset=ultrafast tune=zerolatency ! mpegtsmux ! filesink location="$2" \ No newline at end of file