From 40a0409f7eec41ce19fda320472090ca8d763150 Mon Sep 17 00:00:00 2001 From: legop3 Date: Sat, 29 Nov 2025 03:16:54 -0500 Subject: [PATCH] git --- pi/asound.conf | 11 +++++++++++ pi/bin/video-publisher.sh | 7 +++---- pi/install_roverd.sh | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/pi/asound.conf b/pi/asound.conf index 9aac9f00..5017ecb9 100644 --- a/pi/asound.conf +++ b/pi/asound.conf @@ -12,3 +12,14 @@ ctl.!default { type hw card 0 } + +# Stable capture device for ffmpeg/roverd: exposes the HAT at fixed format/rate. +pcm.rovermic { + type plug + slave { + pcm "hw:0,0" + format S32_LE + rate 48000 + channels 2 + } +} diff --git a/pi/bin/video-publisher.sh b/pi/bin/video-publisher.sh index 22394e2e..890913b0 100644 --- a/pi/bin/video-publisher.sh +++ b/pi/bin/video-publisher.sh @@ -112,20 +112,19 @@ run_pipeline() { | "${FFMPEG_BIN_PATH}" \ -hide_banner \ -loglevel warning \ - -fflags nobuffer \ + -fflags nobuffer+genpts \ -flags low_delay \ -max_interleave_delta 0 \ - -fflags +genpts \ -use_wallclock_as_timestamps 1 \ -rtbufsize 0 \ -thread_queue_size 512 \ -f h264 \ -i pipe:0 \ -thread_queue_size 2048 \ - -f s32le \ + -f alsa \ -ar "${AUDIO_RATE}" \ -ac "${AUDIO_CHANNELS}" \ - -i <(arecord -D "${AUDIO_DEVICE}" -f "${AUDIO_FORMAT}" -c "${AUDIO_CHANNELS}" -r "${AUDIO_RATE}" -q -t raw) \ + -i "${AUDIO_DEVICE}" \ -map 0:v:0 -map 1:a:0 \ -c:v copy \ -c:a "${AUDIO_CODEC}" \ diff --git a/pi/install_roverd.sh b/pi/install_roverd.sh index 3f89a34b..6ba8f904 100755 --- a/pi/install_roverd.sh +++ b/pi/install_roverd.sh @@ -236,6 +236,9 @@ else chown roverd:audio "$FIFO_PATH" chmod 0660 "$FIFO_PATH" fi +# Ensure ALSA config is in place for rovermic device +install -m 0644 pi/asound.conf /etc/asound.conf +log "Installed ALSA config (/etc/asound.conf)" install_audio_support