Raspberry Pi (all): streameye.sh: read RTSP port from streameye.conf

This commit is contained in:
Calin Crisan 2019-05-21 22:42:24 +03:00
parent 3bbad8b4be
commit c8f56b9f7d
3 changed files with 33 additions and 27 deletions

View File

@ -11,7 +11,7 @@ STREAMEYE_LOG=/var/log/streameye.log
test -r ${RASPIMJPEG_CONF} || exit 1 test -r ${RASPIMJPEG_CONF} || exit 1
test -r ${STREAMEYE_CONF} || exit 1 test -r ${STREAMEYE_CONF} || exit 1
watch() { function watch() {
source ${STREAMEYE_CONF} source ${STREAMEYE_CONF}
count=0 count=0
while true; do while true; do
@ -133,7 +133,7 @@ function configure_v4l2_cam() {
v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null
} }
invalid_opt () { function invalid_opt() {
local e match="$1" local e match="$1"
shift shift
for e; do [[ "${e}" == "${match}" ]] && return 1; done for e; do [[ "${e}" == "${match}" ]] && return 1; done
@ -153,8 +153,10 @@ function start() {
return return
fi fi
iptables -A INPUT -p tcp -s localhost --dport 554 -j ACCEPT RTSP_PORT=${RTSP_PORT:-554}
iptables -A INPUT -p tcp --dport 554 -j DROP
iptables -A INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
iptables -A INPUT -p tcp --dport ${RTSP_PORT} -j DROP
audio_opts="" audio_opts=""
if [ -n "${AUDIO_DEV}" ]; then if [ -n "${AUDIO_DEV}" ]; then
@ -197,14 +199,14 @@ function start() {
streameye_opts="${streameye_opts} -d" streameye_opts="${streameye_opts} -d"
fi fi
test-launch -p 554 -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} & test-launch -p ${RTSP_PORT} -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} &
sleep 10 sleep 10
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:554/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} & gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:${RTSP_PORT}/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} &
sleep 5 sleep 5
fi fi
iptables -D INPUT -p tcp --dport 554 -j DROP iptables -D INPUT -p tcp --dport ${RTSP_PORT} -j DROP
iptables -D INPUT -p tcp -s localhost --dport 554 -j ACCEPT iptables -D INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
else else
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1) pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)

View File

@ -11,7 +11,7 @@ STREAMEYE_LOG=/var/log/streameye.log
test -r ${RASPIMJPEG_CONF} || exit 1 test -r ${RASPIMJPEG_CONF} || exit 1
test -r ${STREAMEYE_CONF} || exit 1 test -r ${STREAMEYE_CONF} || exit 1
watch() { function watch() {
source ${STREAMEYE_CONF} source ${STREAMEYE_CONF}
count=0 count=0
while true; do while true; do
@ -133,7 +133,7 @@ function configure_v4l2_cam() {
v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null
} }
invalid_opt () { function invalid_opt() {
local e match="$1" local e match="$1"
shift shift
for e; do [[ "${e}" == "${match}" ]] && return 1; done for e; do [[ "${e}" == "${match}" ]] && return 1; done
@ -153,8 +153,10 @@ function start() {
return return
fi fi
iptables -A INPUT -p tcp -s localhost --dport 554 -j ACCEPT RTSP_PORT=${RTSP_PORT:-554}
iptables -A INPUT -p tcp --dport 554 -j DROP
iptables -A INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
iptables -A INPUT -p tcp --dport ${RTSP_PORT} -j DROP
audio_opts="" audio_opts=""
if [ -n "${AUDIO_DEV}" ]; then if [ -n "${AUDIO_DEV}" ]; then
@ -197,14 +199,14 @@ function start() {
streameye_opts="${streameye_opts} -d" streameye_opts="${streameye_opts} -d"
fi fi
test-launch -p 554 -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} & test-launch -p ${RTSP_PORT} -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} &
sleep 10 sleep 10
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:554/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} & gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:${RTSP_PORT}/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} &
sleep 5 sleep 5
fi fi
iptables -D INPUT -p tcp --dport 554 -j DROP iptables -D INPUT -p tcp --dport ${RTSP_PORT} -j DROP
iptables -D INPUT -p tcp -s localhost --dport 554 -j ACCEPT iptables -D INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
else else
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1) pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)

View File

@ -11,7 +11,7 @@ STREAMEYE_LOG=/var/log/streameye.log
test -r ${RASPIMJPEG_CONF} || exit 1 test -r ${RASPIMJPEG_CONF} || exit 1
test -r ${STREAMEYE_CONF} || exit 1 test -r ${STREAMEYE_CONF} || exit 1
watch() { function watch() {
source ${STREAMEYE_CONF} source ${STREAMEYE_CONF}
count=0 count=0
while true; do while true; do
@ -133,7 +133,7 @@ function configure_v4l2_cam() {
v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null v4l2-ctl ${video_arg} --set-ctrl=video_bitrate=${video_bitrate} &>/dev/null
} }
invalid_opt () { function invalid_opt() {
local e match="$1" local e match="$1"
shift shift
for e; do [[ "${e}" == "${match}" ]] && return 1; done for e; do [[ "${e}" == "${match}" ]] && return 1; done
@ -153,8 +153,10 @@ function start() {
return return
fi fi
iptables -A INPUT -p tcp -s localhost --dport 554 -j ACCEPT RTSP_PORT=${RTSP_PORT:-554}
iptables -A INPUT -p tcp --dport 554 -j DROP
iptables -A INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
iptables -A INPUT -p tcp --dport ${RTSP_PORT} -j DROP
audio_opts="" audio_opts=""
if [ -n "${AUDIO_DEV}" ]; then if [ -n "${AUDIO_DEV}" ]; then
@ -197,14 +199,14 @@ function start() {
streameye_opts="${streameye_opts} -d" streameye_opts="${streameye_opts} -d"
fi fi
test-launch -p 554 -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} & test-launch -p ${RTSP_PORT} -m h264 "\"( ${video_opts} ${audio_opts} )\"" &>${GSTREAMER_LOG} &
sleep 10 sleep 10
gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:554/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} & gst-launch-1.0 -v rtspsrc location=rtsp://127.0.0.1:${RTSP_PORT}/h264 latency=0 drop-on-latency=1 ! rtph264depay ! h264parse ! omxh264dec ! videorate ! video/x-raw,framerate=5/1 ! jpegenc ! filesink location=/dev/stdout | streameye ${streameye_opts} &>${STREAMEYE_LOG} &
sleep 5 sleep 5
fi fi
iptables -D INPUT -p tcp --dport 554 -j DROP iptables -D INPUT -p tcp --dport ${RTSP_PORT} -j DROP
iptables -D INPUT -p tcp -s localhost --dport 554 -j ACCEPT iptables -D INPUT -p tcp -s localhost --dport ${RTSP_PORT} -j ACCEPT
else else
pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1) pid=$(ps | grep raspimjpeg.py | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1)