Last active
May 14, 2024 05:13
-
-
Save themactep/76096e9b83ac68b9a06defe752863fdb to your computer and use it in GitHub Desktop.
IP camera video stream delay test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# GStreamer based video player for glass-on-glass tests. | |
# Use it together with https://thingino.com/timer | |
# | |
protocol="$1" | |
codec="$2" | |
show_help_and_exit() { | |
echo "Usage: $0 [rtmp|rtsp] [h264|h265] [rtsp://thingino:thingino@192.168.1.10:554/ch0]" | |
exit 1 | |
} | |
case "$protocol" in | |
"rtmp") | |
case "$codec" in | |
"h265") | |
gst-launch-1.0 -vvv udpsrc port=5600 \ | |
caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H265' \ | |
! rtpjitterbuffer ! rtph265depay ! avdec_h265 ! glimagesink sync=false | |
;; | |
"h264") | |
gst-launch-1.0 -vvv udpsrc port=5600 \ | |
caps='application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264' \ | |
! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! glimagesink sync=false | |
;; | |
*) | |
echo "Unknown codec" | |
exit 1 | |
esac | |
echo "Add these lines to /etc/majestic.yaml:" | |
echo "outgoing:" | |
echo " - udp://$(hostname -I | awk '{print $1}'):5600" | |
;; | |
"rtsp") | |
url="$3" | |
[ -z "$url" ] && show_help_and_exit | |
case "$codec" in | |
"h264") | |
gst-launch-1.0 -vvv rtspsrc location=${url} ! queue ! \ | |
rtph264depay ! h264parse ! avdec_h264 ! fpsdisplaysink sync=false name=v | |
;; | |
"h265") | |
gst-launch-1.0 -vvv rtspsrc location=${url} ! queue ! \ | |
rtph265depay ! h265parse ! avdec_h265 ! fpsdisplaysink sync=false name=v | |
;; | |
*) | |
echo "Unknown codec" | |
show_help_and_exit | |
;; | |
esac | |
;; | |
*) | |
echo "Unknown protocol" | |
show_help_and_exit | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you
Please fix typo on string from
majestic.yml
tomajestic.yaml