blueberries

This commit is contained in:
legop3
2025-12-20 00:20:11 -05:00
parent 45aef7339e
commit b965f7b561
2 changed files with 26 additions and 21 deletions
+24 -21
View File
@@ -32,32 +32,35 @@ else
fi fi
run_pipeline() { run_pipeline() {
"${FFMPEG_BIN_PATH}" \ arecord -D "${AUDIO_DEVICE}" -f S32_LE -c "${AUDIO_CHANNELS}" -r "${AUDIO_RATE}" -B 65536 -F 2048 -q -t raw \
-hide_banner \ | "${FFMPEG_BIN_PATH}" \
-loglevel warning \ -hide_banner \
-fflags nobuffer \ -loglevel warning \
-rtbufsize 0 \ -fflags nobuffer \
-thread_queue_size 4096 \ -rtbufsize 0 \
-f s32le \ -thread_queue_size 4096 \
-ar "${AUDIO_RATE}" \ -f s32le \
-ac "${AUDIO_CHANNELS}" \ -ar "${AUDIO_RATE}" \
-i <(arecord -D "${AUDIO_DEVICE}" -f S32_LE -c "${AUDIO_CHANNELS}" -r "${AUDIO_RATE}" -B 65536 -F 2048 -q -t raw) \ -ac "${AUDIO_CHANNELS}" \
-af "aresample=16000,pan=mono|c0=0.5*FL+0.5*FR,volume=25dB" \ -i pipe:0 \
-c:a libopus \ -af "aresample=16000,pan=mono|c0=0.5*FL+0.5*FR,volume=25dB" \
-b:a 24000 \ -c:a libopus \
-ar:a 16000 \ -b:a 24000 \
-ac:a 1 \ -ar:a 16000 \
-application lowdelay \ -ac:a 1 \
-frame_duration 20 \ -application lowdelay \
-compression_level 0 \ -frame_duration 20 \
-f mpegts \ -compression_level 0 \
"${AUDIO_PUBLISH_URL}" -f mpegts \
"${AUDIO_PUBLISH_URL}"
} }
trap 'kill 0 2>/dev/null' EXIT INT TERM
while true; do while true; do
if run_pipeline; then if run_pipeline; then
exit 0 exit 0
fi fi
echo "Audio-only publisher exited, restarting in 2s..." >&2 echo "Audio-only publisher exited arecord=${PIPESTATUS[0]} ffmpeg=${PIPESTATUS[1]}, restarting in 2s..." >&2
sleep 2 sleep 2
done done
+2
View File
@@ -9,6 +9,8 @@ User=roverd
Group=roverd Group=roverd
EnvironmentFile=/var/lib/roverd/video.env EnvironmentFile=/var/lib/roverd/video.env
ExecStart=/usr/local/bin/audio-only-publisher ExecStart=/usr/local/bin/audio-only-publisher
KillMode=control-group
TimeoutStopSec=5
Restart=on-failure Restart=on-failure
RestartSec=2 RestartSec=2