diff --git a/pi/bin/whip-publisher.sh b/pi/bin/whip-publisher.sh index 1a6ed9e3..70426b02 100644 --- a/pi/bin/whip-publisher.sh +++ b/pi/bin/whip-publisher.sh @@ -18,11 +18,21 @@ VIDEO_HEIGHT="${VIDEO_HEIGHT:-720}" VIDEO_FPS="${VIDEO_FPS:-30}" VIDEO_BITRATE="${VIDEO_BITRATE:-3000000}" -LIBCAMERA_BIN="${LIBCAMERA_BIN:-/usr/bin/libcamera-vid}" FFMPEG_BIN="${FFMPEG_BIN:-/usr/bin/ffmpeg}" -if [[ ! -x "$LIBCAMERA_BIN" ]]; then - echo "libcamera-vid not found at ${LIBCAMERA_BIN}" >&2 +if [[ -n "${LIBCAMERA_BIN:-}" ]]; then + LIBCAMERA_BIN_PATH="$LIBCAMERA_BIN" +elif command -v rpicam-vid >/dev/null 2>&1; then + LIBCAMERA_BIN_PATH="$(command -v rpicam-vid)" +elif command -v libcamera-vid >/dev/null 2>&1; then + LIBCAMERA_BIN_PATH="$(command -v libcamera-vid)" +else + echo "Neither rpicam-vid nor libcamera-vid found; install the libcamera apps." >&2 + exit 1 +fi + +if [[ ! -x "$LIBCAMERA_BIN_PATH" ]]; then + echo "Video capture binary not executable at ${LIBCAMERA_BIN_PATH}" >&2 exit 1 fi if [[ ! -x "$FFMPEG_BIN" ]]; then @@ -31,7 +41,7 @@ if [[ ! -x "$FFMPEG_BIN" ]]; then fi run_pipeline() { - "${LIBCAMERA_BIN}" \ + "${LIBCAMERA_BIN_PATH}" \ --inline \ --timeout 0 \ --width "${VIDEO_WIDTH}" \ diff --git a/pi/install_roverd.sh b/pi/install_roverd.sh index 8f4848e2..218bf929 100755 --- a/pi/install_roverd.sh +++ b/pi/install_roverd.sh @@ -80,8 +80,8 @@ log() { echo "[$(date -u +%Y-%m-%dT%H:%M:%SZ)] $*" } -if ! command -v libcamera-vid >/dev/null 2>&1; then - log "WARNING: libcamera-vid not found in PATH; install libcamera-utils for video publishing" +if ! command -v rpicam-vid >/dev/null 2>&1 && ! command -v libcamera-vid >/dev/null 2>&1; then + log "WARNING: neither rpicam-vid nor libcamera-vid found in PATH; install the Raspberry Pi libcamera apps (sudo apt install libcamera-apps)." fi if ! command -v ffmpeg >/dev/null 2>&1; then log "WARNING: ffmpeg not found in PATH; install ffmpeg for WHIP publishing"