mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 01:21:20 -04:00
hardcode 1296:972
This commit is contained in:
+10
-14
@@ -30,11 +30,9 @@ load_env_file() {
|
|||||||
|
|
||||||
local line key val
|
local line key val
|
||||||
while IFS= read -r line || [[ -n "$line" ]]; do
|
while IFS= read -r line || [[ -n "$line" ]]; do
|
||||||
# Skip blank lines and full-line comments.
|
|
||||||
[[ "$line" =~ ^[[:space:]]*$ ]] && continue
|
[[ "$line" =~ ^[[:space:]]*$ ]] && continue
|
||||||
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
[[ "$line" =~ ^[[:space:]]*# ]] && continue
|
||||||
|
|
||||||
# Support optional leading 'export '
|
|
||||||
if [[ "$line" =~ ^[[:space:]]*export[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)=(.*)$ ]]; then
|
if [[ "$line" =~ ^[[:space:]]*export[[:space:]]+([A-Za-z_][A-Za-z0-9_]*)=(.*)$ ]]; then
|
||||||
key="${BASH_REMATCH[1]}"
|
key="${BASH_REMATCH[1]}"
|
||||||
val="${BASH_REMATCH[2]}"
|
val="${BASH_REMATCH[2]}"
|
||||||
@@ -42,22 +40,18 @@ load_env_file() {
|
|||||||
key="${BASH_REMATCH[1]}"
|
key="${BASH_REMATCH[1]}"
|
||||||
val="${BASH_REMATCH[2]}"
|
val="${BASH_REMATCH[2]}"
|
||||||
else
|
else
|
||||||
# Ignore anything that isn't a simple assignment.
|
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Trim leading/trailing whitespace in value.
|
|
||||||
val="${val#${val%%[![:space:]]*}}"
|
val="${val#${val%%[![:space:]]*}}"
|
||||||
val="${val%${val##*[![:space:]]}}"
|
val="${val%${val##*[![:space:]]}}"
|
||||||
|
|
||||||
# If value is wrapped in matching single or double quotes, unwrap.
|
|
||||||
if [[ "$val" =~ ^\".*\"$ ]]; then
|
if [[ "$val" =~ ^\".*\"$ ]]; then
|
||||||
val="${val:1:${#val}-2}"
|
val="${val:1:${#val}-2}"
|
||||||
elif [[ "$val" =~ ^\'.*\'$ ]]; then
|
elif [[ "$val" =~ ^\'.*\'$ ]]; then
|
||||||
val="${val:1:${#val}-2}"
|
val="${val:1:${#val}-2}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Assign without evaluation.
|
|
||||||
printf -v "$key" '%s' "$val"
|
printf -v "$key" '%s' "$val"
|
||||||
export "$key"
|
export "$key"
|
||||||
done <<< "$content"
|
done <<< "$content"
|
||||||
@@ -66,20 +60,22 @@ load_env_file() {
|
|||||||
load_env_file
|
load_env_file
|
||||||
: "${PUBLISH_URL:?PUBLISH_URL not set in ${ENV_FILE}}"
|
: "${PUBLISH_URL:?PUBLISH_URL not set in ${ENV_FILE}}"
|
||||||
|
|
||||||
# Defaults tuned for OV5647: use 4:3 output and force the common 2x2 binned full-FOV mode.
|
# OV5647: 1296x972 is the common 2x2 binned mode, and it's 4:3.
|
||||||
VIDEO_WIDTH="640"
|
# Hard-coded output size & FPS (matching your "no env inputs for res/fps" approach).
|
||||||
VIDEO_HEIGHT="480"
|
VIDEO_WIDTH="1296"
|
||||||
|
VIDEO_HEIGHT="972"
|
||||||
VIDEO_FPS="30"
|
VIDEO_FPS="30"
|
||||||
|
|
||||||
|
# Keep bitrate configurable via env (or default).
|
||||||
VIDEO_BITRATE="${VIDEO_BITRATE:-3000000}"
|
VIDEO_BITRATE="${VIDEO_BITRATE:-3000000}"
|
||||||
VIDEO_SENSOR_MODE="${VIDEO_SENSOR_MODE:-1296:972}"
|
|
||||||
|
# Force the sensor mode to match the output (avoids libcamera picking a different/cropped mode).
|
||||||
|
VIDEO_SENSOR_MODE="1296:972"
|
||||||
|
|
||||||
# Flip the camera 180deg (supported by rpicam-vid/libcamera-vid)
|
# Flip the camera 180deg (supported by rpicam-vid/libcamera-vid)
|
||||||
FLIP_ARGS=(--rotation 180)
|
FLIP_ARGS=(--rotation 180)
|
||||||
|
|
||||||
MODE_ARGS=()
|
MODE_ARGS=(--mode "${VIDEO_SENSOR_MODE}")
|
||||||
if [[ -n "${VIDEO_SENSOR_MODE}" ]]; then
|
|
||||||
MODE_ARGS=(--mode "${VIDEO_SENSOR_MODE}")
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "${LIBCAMERA_BIN:-}" ]]; then
|
if [[ -n "${LIBCAMERA_BIN:-}" ]]; then
|
||||||
LIBCAMERA_BIN_PATH="$LIBCAMERA_BIN"
|
LIBCAMERA_BIN_PATH="$LIBCAMERA_BIN"
|
||||||
|
|||||||
Reference in New Issue
Block a user