38 lines
1.4 KiB
Bash
Executable File
38 lines
1.4 KiB
Bash
Executable File
#!/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 <reference_video_file> <test_video_file> <optional: DEBUG>"
|
|
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=UYVY,width=1920,height=1080,framerate=30/1" ! \
|
|
videoconvert ! queue ! tee name=t \
|
|
t. ! queue ! filesink location="$1" \
|
|
t. ! queue ! x264enc bitrate=20000 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=20000 speed-preset=ultrafast tune=zerolatency ! mpegtsmux ! filesink location="$2" |