feat!: adds camera-streamer to crowsnest
This introduces camera-streamer as streamer option via `mode: multi` camera-streamer is a feature packed stream service. It is capable to deliver mjpg/snapshots/webrtc and rtsp Limited to raspberry pi sbc's for now. This should also resolv Feature request #51 Feature request #37 Fixes #83 Closes #85 Fixes #89 BREAKING CHANGES: Dropping support for Debian Buster based images and kernels older than 5.15y Dropping RTSP support due aler9/simple-rtsp-server Dropping usage of ffmpeg No support anymore for Raspicam V1 (EOL) Signed-off-by: Stephan Wendel <me@stephanwe.de> Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
@@ -23,7 +23,7 @@ function detect_avail_cams {
|
||||
count="$(echo "${avail}" | wc -l)"
|
||||
if [[ -d "/dev/v4l/by-id/" ]] &&
|
||||
[[ -n "${avail}" ]]; then
|
||||
log_msg "INFO: Found ${count} available camera(s)"
|
||||
log_msg "INFO: Found ${count} available v4l2 (UVC) camera(s)"
|
||||
echo "${avail}" | while read -r v4l; do
|
||||
realpath=$(readlink -e "${v4l}")
|
||||
log_msg "${v4l} -> ${realpath}"
|
||||
@@ -37,74 +37,69 @@ function detect_avail_cams {
|
||||
fi
|
||||
}
|
||||
|
||||
function detect_avail_csi {
|
||||
local avail count realpath
|
||||
avail="$(find /dev/v4l/by-path/ -iname "*csi*index0" 2> /dev/null)"
|
||||
count="$(echo "${avail}" | wc -l)"
|
||||
if [[ -d "/dev/v4l/by-path/" ]] &&
|
||||
[[ -n "${avail}" ]]; then
|
||||
log_msg "INFO: Found ${count} available csi device(s)"
|
||||
echo "${avail}" | while read -r csi; do
|
||||
realpath=$(readlink -e "${csi}")
|
||||
log_msg "${csi} -> ${realpath}"
|
||||
done
|
||||
else
|
||||
log_msg "INFO: No usable CSI Devices found."
|
||||
fi
|
||||
}
|
||||
|
||||
# Used for "verbose" and "debug" logging in logging.sh
|
||||
## Used for "verbose" and "debug" logging in logging.sh
|
||||
function list_cam_formats {
|
||||
local device formats
|
||||
local device prefix
|
||||
device="${1}"
|
||||
formats="$(v4l2-ctl -d "${device}" --list-formats-ext | sed '1,3d')"
|
||||
prefix="$(date +'[%D %T]') crowsnest:"
|
||||
log_msg "Supported Formats:"
|
||||
echo "${formats}" | while read -r i; do
|
||||
log_msg "\t\t${i}"
|
||||
done
|
||||
while read -r i; do
|
||||
printf "%s\t\t%s\n" "${prefix}" "${i}" >> "${CROWSNEST_LOG_PATH}"
|
||||
done < <(v4l2-ctl -d "${device}" --list-formats-ext | sed '1,3d')
|
||||
}
|
||||
|
||||
function list_cam_v4l2ctrls {
|
||||
local device ctrls
|
||||
local device prefix
|
||||
device="${1}"
|
||||
ctrls="$(v4l2-ctl -d "${device}" --list-ctrls-menus)"
|
||||
prefix="$(date +'[%D %T]') crowsnest:"
|
||||
log_msg "Supported Controls:"
|
||||
echo "${ctrls}" | while read -r i; do
|
||||
log_msg "\t\t${i}"
|
||||
done
|
||||
while read -r i; do
|
||||
printf "%s\t\t%s\n" "${prefix}" "${i}" >> "${CROWSNEST_LOG_PATH}"
|
||||
done < <(v4l2-ctl -d "${device}" --list-ctrls-menus)
|
||||
}
|
||||
|
||||
# Determine connected "raspicam" device
|
||||
function detect_raspicam {
|
||||
## Determine connected libcamera (CSI) device
|
||||
function detect_libcamera {
|
||||
local avail
|
||||
if [[ -f /proc/device-tree/model ]] &&
|
||||
grep -q "Raspberry" /proc/device-tree/model; then
|
||||
avail="$(vcgencmd get_camera | awk -F '=' '{ print $3 }' | cut -d',' -f1)"
|
||||
else
|
||||
avail="0"
|
||||
vcgencmd get_camera | grep -c "libcamera interfaces=1" || true
|
||||
fi
|
||||
echo "${avail}"
|
||||
}
|
||||
|
||||
function dev_is_raspicam {
|
||||
v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
|
||||
awk 'NR==2 {print $1}'
|
||||
## Spit /base/soc path for libcamera device
|
||||
function get_libcamera_path {
|
||||
if [[ -f /proc/device-tree/model ]] &&
|
||||
[[ -x "$(command -v libcamera-hello)" ]]; then
|
||||
libcamera-hello --list-cameras | sed '1,2d' \
|
||||
| grep "\(/base/*\)" | cut -d"(" -f2 | tr -d '$)'
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine if cam has H.264 Hardware encoder
|
||||
# call detect_h264 <nameornumber> ex.: detect_h264 foobar
|
||||
# returns 1 = true / 0 = false ( numbers are strings! not int!)
|
||||
## Determine if cam has H.264 Hardware encoder
|
||||
## call detect_h264 <nameornumber> ex.: detect_h264 foobar
|
||||
## returns 1 = true / 0 = false ( numbers are strings! not int!)
|
||||
function detect_h264 {
|
||||
local dev
|
||||
dev="$(get_param "cam ${1}" device)"
|
||||
v4l2-ctl -d "${dev}" --list-formats-ext | grep -c "[hH]264"
|
||||
}
|
||||
|
||||
# Determine if cam has MJPEG Hardware encoder
|
||||
# call detect_mjpeg <nameornumber> ex.: detect_mjpeg foobar
|
||||
# returns 1 = true / 0 = false ( numbers are strings! not int!)
|
||||
## Determine if cam has MJPEG Hardware encoder
|
||||
## call detect_mjpeg <nameornumber> ex.: detect_mjpeg foobar
|
||||
## returns 1 = true / 0 = false ( numbers are strings! not int!)
|
||||
function detect_mjpeg {
|
||||
local dev
|
||||
dev="$(get_param "cam ${1}" device)"
|
||||
v4l2-ctl -d "${dev}" --list-formats-ext | grep -c "Motion-JPEG, compressed"
|
||||
}
|
||||
|
||||
## Check if device is raspberry sbc
|
||||
is_raspberry_pi() {
|
||||
if [[ -f /proc/device-tree/model ]] &&
|
||||
grep -q "Raspberry" /proc/device-tree/model; then
|
||||
echo "1"
|
||||
else
|
||||
echo "0"
|
||||
fi
|
||||
}
|
||||
|
Reference in New Issue
Block a user