fix: fixes blocky view after reboot
This should fix #33 By default a variable bitrate is set, this leads to a "blocky" view. blockyfix function sets constant bitrate and a moderate bitrate if not set by user. Signed-off-by: Stephan Wendel <me@stephanwe.de>
This commit is contained in:
@@ -65,6 +65,7 @@ done
|
||||
init_logging
|
||||
initial_check
|
||||
v4l2_control
|
||||
blockyfix
|
||||
construct_streamer
|
||||
brokenfocus
|
||||
|
||||
|
@@ -68,3 +68,8 @@ function detected_broken_dev_msg {
|
||||
function debug_focus_val_msg {
|
||||
log_msg "DEBUG: Value is now: ${1}"
|
||||
}
|
||||
|
||||
## blockyfix
|
||||
function blockyfix_msg_1 {
|
||||
log_msg "INFO: Blockyfix: Setting video_bitrate_mode to constant."
|
||||
}
|
||||
|
@@ -133,3 +133,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_raspicam)" ]; 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