* Modified install.sh * Added libs/ustreamer.sh * Added libs/v4l2rtspserver.sh * Modified uninstall.sh * Modified webcamd REFACTOR: Split run_rtsp to libs/v4l2rtspserver.sh * Modified webcamd accordingly REFACTOR: Split run_ustreamer to libs/ustreamer.sh * Updated webcamd accordingly Signed-off-by: Stephan Wendel <me@stephanwe.de>
46 lines
1.5 KiB
Bash
46 lines
1.5 KiB
Bash
#!/bin/bash
|
|
|
|
#### ustreamer library
|
|
|
|
#### webcamd - A webcam Service for multiple Cams and Stream Services.
|
|
####
|
|
#### written by Stephan Wendel aka KwadFan
|
|
#### Copyright 2021
|
|
#### https://github.com/mainsail-crew/crowsnest
|
|
####
|
|
#### This File is distributed under GPLv3
|
|
####
|
|
|
|
# Exit upon Errors
|
|
set -e
|
|
|
|
function run_rtsp {
|
|
local cam_section rtsp_bin device port resolution fps custom
|
|
local raspicam start_param
|
|
cam_section="${1}"
|
|
rtsp_bin="$(whereis v4l2rtspserver | awk '{print $2}')"
|
|
device="$(get_param "cam ${cam_section}" device)"
|
|
port=$(get_param "cam ${cam_section}" port)
|
|
resolution=$(get_param "cam ${cam_section}" resolution)
|
|
fps=$(get_param "cam ${cam_section}" max_fps)
|
|
custom="$(get_param "cam ${cam_section}" custom_flags 2> /dev/null)"
|
|
check_section "${cam_section}"
|
|
split_res="$(echo "${resolution}" | \
|
|
awk -F 'x' '{print "-W "$1 " -H "$2}')"
|
|
start_param=(
|
|
-I 0.0.0.0 -P "${port}" "${split_res}" -F "${fps}" \
|
|
"${device}"
|
|
)
|
|
# Custom Flag Handling
|
|
if [ -n "${custom}" ]; then
|
|
start_param=(${start_param[@]} "${custom}" )
|
|
fi
|
|
log_msg "Starting v4l2rtspserver with Device ${device} ..."
|
|
echo "Parameters: ${start_param[*]}" | \
|
|
log_output "v4l2rtspserver [cam ${cam_section}]"
|
|
|
|
"${rtsp_bin}" ${start_param[*]} 2>&1 | \
|
|
log_output "v4l2rtspserver [cam ${cam_section}]"
|
|
log_msg "ERROR: Start of v4l2rtspserver [cam ${cam_section}] failed!"
|
|
}
|