Merge develop branch (#163)
* Fix makefile flags on low memory devices (#124) * Fix `makefile` flags on low memory devices On devices with less than 512MB existing devices will use `-j2` due to wrong condition. * docs: Update index with correct heading and link to backends (#131) This is a follow-up to #108 and fixes heading and hyperlink to the list of backends * Typo in `core.sh` (#138) * Fix makefile flags on low memory devices (#124) (#125) * Fix `makefile` flags on low memory devices On devices with less than 512MB existing devices will use `-j2` due to wrong condition. Co-authored-by: Kamil Trzciński <ayufan@ayufan.eu> * Typo in `core.sh` 'Dependencys' --> dependencies --------- Co-authored-by: Stephan Wendel <43513802+KwadFan@users.noreply.github.com> Co-authored-by: Kamil Trzciński <ayufan@ayufan.eu> * Fix makefile flags on low memory devices (#124) (#125) (#144) * Fix `makefile` flags on low memory devices On devices with less than 512MB existing devices will use `-j2` due to wrong condition. Co-authored-by: Kamil Trzciński <ayufan@ayufan.eu> * docs(messages.sh): fix typos, improve spelling (#145) * feat: add legacy cam support (#146) * feat: add legacy cam support Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * feat: add blockyfix Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: add ustreamer legacy cam workaround Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * Fix makefile flags on low memory devices (#124) (#125) (#147) * Fix `makefile` flags on low memory devices On devices with less than 512MB existing devices will use `-j2` due to wrong condition. Co-authored-by: Kamil Trzciński <ayufan@ayufan.eu> * fix: fix make config empty path (#148) Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: fix default_path_msg function name (#149) * fix: fix default_path_msg function name Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: fix message Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: fix libcamera-apps-lite not getting updated (#160) libcamera-apps-lite is needed for libcamera-hello. Crowsnest uses libcamera-hello to detected raspicams Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: fix Shellcheck test error (#153) * fix: fix Shellcheck test error Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * style: remove empty condition Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> * fix: fix CustomPiOS docker build error (#158) This should skip any check of `SUDO_USER` Tested with Win & Linux host with Docker Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> --------- Signed-off-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com> Co-authored-by: Kamil Trzciński <ayufan@ayufan.eu> Co-authored-by: DeviousFusion <dj3tusk@gmail.com> Co-authored-by: Sergei <67871383+slepiavka@users.noreply.github.com> Co-authored-by: Patrick Gehrsitz <58853838+mryel00@users.noreply.github.com>
This commit is contained in:
@@ -108,7 +108,7 @@ function check_apps {
|
||||
# print_cfg, see libs/logging.sh L#75
|
||||
# pint_cams, see libs/logging.sh L#84
|
||||
function initial_check {
|
||||
log_msg "INFO: Checking Dependencys"
|
||||
log_msg "INFO: Checking Dependencies"
|
||||
check_dep "crudini"
|
||||
check_dep "find"
|
||||
check_dep "xargs"
|
||||
|
@@ -84,6 +84,23 @@ get_libcamera_path() {
|
||||
fi
|
||||
}
|
||||
|
||||
# Determine connected "legacy" device
|
||||
function detect_legacy {
|
||||
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"
|
||||
fi
|
||||
echo "${avail}"
|
||||
}
|
||||
|
||||
function dev_is_legacy {
|
||||
v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
|
||||
awk 'NR==2 {print $1}'
|
||||
}
|
||||
|
||||
## 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!)
|
||||
|
@@ -90,7 +90,7 @@ function print_cfg {
|
||||
function print_cams {
|
||||
local total v4l
|
||||
v4l="$(find /dev/v4l/by-id/ -iname "*index0" 2> /dev/null | wc -l)"
|
||||
total="$((v4l+($(detect_libcamera))))"
|
||||
total="$((v4l+($(detect_libcamera))+($(detect_legacy))))"
|
||||
if [ "${total}" -eq 0 ]; then
|
||||
log_msg "ERROR: No usable Devices Found. Stopping $(basename "${0}")."
|
||||
exit 1
|
||||
@@ -100,6 +100,15 @@ function print_cams {
|
||||
if [[ "$(detect_libcamera)" -ne 0 ]]; then
|
||||
log_msg "Detected 'libcamera' device -> $(get_libcamera_path)"
|
||||
fi
|
||||
if [[ "$(detect_legacy)" -ne 0 ]]; then
|
||||
raspicam="$(v4l2-ctl --list-devices | grep -A1 -e 'mmal' | \
|
||||
awk 'NR==2 {print $1}')"
|
||||
log_msg "Detected 'Raspicam' Device -> ${raspicam}"
|
||||
if [[ ! "${CROWSNEST_LOG_LEVEL}" = "quiet" ]]; then
|
||||
list_cam_formats "${raspicam}"
|
||||
list_cam_v4l2ctrls "${raspicam}"
|
||||
fi
|
||||
fi
|
||||
if [[ -d "/dev/v4l/by-id/" ]]; then
|
||||
detect_avail_cams
|
||||
fi
|
||||
|
@@ -23,6 +23,7 @@ run_mjpg() {
|
||||
for instance in ${cams} ; do
|
||||
run_ustreamer "${instance}" &
|
||||
done
|
||||
blockyfix
|
||||
brokenfocus
|
||||
return
|
||||
}
|
||||
@@ -45,12 +46,17 @@ run_ustreamer() {
|
||||
start_param=( --host 127.0.0.1 -p "${pt}" )
|
||||
fi
|
||||
|
||||
# Add device
|
||||
start_param+=( -d "${dev}" --device-timeout=2 )
|
||||
#Raspicam Workaround
|
||||
if [[ "${dev}" = "$(dev_is_legacy)" ]]; then
|
||||
start_param+=( -m MJPEG --device-timeout=5 --buffers=3 )
|
||||
else
|
||||
# Add device
|
||||
start_param+=( -d "${dev}" --device-timeout=2 )
|
||||
|
||||
# Use MJPEG Hardware encoder if possible
|
||||
if [ "$(detect_mjpeg "${cam_sec}")" = "1" ]; then
|
||||
start_param+=( -m MJPEG --encoder=HW )
|
||||
# Use MJPEG Hardware encoder if possible
|
||||
if [ "$(detect_mjpeg "${cam_sec}")" = "1" ]; then
|
||||
start_param+=( -m MJPEG --encoder=HW )
|
||||
fi
|
||||
fi
|
||||
|
||||
# set max framerate
|
||||
|
@@ -136,3 +136,30 @@ function brokenfocus {
|
||||
main
|
||||
|
||||
}
|
||||
|
||||
# This function is to set bitrate on raspicams.
|
||||
# If raspicams set to variable bitrate, they tend to show
|
||||
# a "block-like" view after reboots
|
||||
# To prevent that blockyfix should apply constant bitrate befor start of ustreamer
|
||||
# See https://github.com/mainsail-crew/crowsnest/issues/33
|
||||
function blockyfix {
|
||||
local dev v4l2ctl
|
||||
|
||||
# call set_bitrate <device>
|
||||
function set_bitrate {
|
||||
v4l2-ctl -d "${1}" -c video_bitrate_mode=1 2> /dev/null
|
||||
v4l2-ctl -d "${1}" -c video_bitrate=15000000 2> /dev/null
|
||||
}
|
||||
|
||||
for cam in $(configured_cams); do
|
||||
dev="$(get_param "cam ${cam}" device)"
|
||||
v4l2ctl="$(get_param "cam ${cam}" v4l2ctl)"
|
||||
if [ "${dev}" = "$(dev_is_legacy)" ]; then
|
||||
if [ -z "${v4l2ctl}" ] ||
|
||||
[ "$(grep -c "video_bitrate" <<< "${v4l2ctl}")" == "0" ]; then
|
||||
set_bitrate "${dev}"
|
||||
blockyfix_msg_1
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
Reference in New Issue
Block a user