From 421902684fc15d9f637ed077ea97c716fc532cd3 Mon Sep 17 00:00:00 2001 From: jaredb7 Date: Sun, 9 Apr 2023 22:26:04 +1000 Subject: [PATCH] Quieten System logs Attempt to quieten the amount of log noise being generated by some of the birdnet services visible in the syslog and daemon.log Recording service When using RTSP streams the recording service is generating massive amounts of noise in the logs as it's basically outputting all it's startup info and also outputting stream and export info. - Set the log level to only output errors Also the birdnet_recoding service script is outputting it;s contents, I assume was doing this because of the set -x option at the beginning, -Commenting this fixed that issue Analysis Service Small change to this it doesn't output a error when it can't find today's recording directory. It's a non issue if your recording via sound card but it pops up a bit when using RTSP streams as that directory is never created. Livestream Service Same treatment as the recording service, set log level to error. It was previously set to info and would occasionally output a massive chunk of output.. presumably abut the encoding processes. --- scripts/birdnet_analysis.sh | 2 +- scripts/birdnet_recording.sh | 9 ++++++--- scripts/livestream.sh | 7 +++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/scripts/birdnet_analysis.sh b/scripts/birdnet_analysis.sh index 474a757..aadf6f8 100755 --- a/scripts/birdnet_analysis.sh +++ b/scripts/birdnet_analysis.sh @@ -189,7 +189,7 @@ TODAY="$RECS_DIR/$(date "+%B-%Y/%d-%A")" if [ $(find ${YESTERDAY} -name '*wav' 2>/dev/null | wc -l) -gt 0 ];then find $YESTERDAY -name '*wav' -type f -size 0 -delete run_birdnet "${YESTERDAY}" -elif [ $(find ${TODAY} -name '*wav' | wc -l) -gt 0 ];then +elif [ $(find ${TODAY} -name '*wav' 2>/dev/null | wc -l) -gt 0 ];then find $TODAY -name '*wav' -type f -size 0 -delete run_birdnet "${TODAY}" fi diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.sh index dfdcefc..c8c8d78 100755 --- a/scripts/birdnet_recording.sh +++ b/scripts/birdnet_recording.sh @@ -1,8 +1,11 @@ #!/usr/bin/env bash -# Performs the recording from the specified RSTP stream or soundcard -set -x +# Performs the recording from the specified RTSP stream or soundcard +#set -x source /etc/birdnet/birdnet.conf +# S +LOGGING_LEVEL='error' + [ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15 if [ ! -z $RTSP_STREAM ];then @@ -33,7 +36,7 @@ if [ ! -z $RTSP_STREAM ];then # Make sure were passing something valid to ffmpeg, ffmpeg will run interactive and control our look by waiting ${RECORDING_LENGTH} between loops if [ -n "$FFMPEG_PARAMS" ];then - ffmpeg -nostdin $FFMPEG_PARAMS + ffmpeg -hide_banner -loglevel $LOGGING_LEVEL -nostdin $FFMPEG_PARAMS fi done diff --git a/scripts/livestream.sh b/scripts/livestream.sh index 6b0ba7e..cfde718 100755 --- a/scripts/livestream.sh +++ b/scripts/livestream.sh @@ -2,6 +2,9 @@ # Live Audio Stream Service Script source /etc/birdnet/birdnet.conf +# Set logging level +LOGGING_LEVEL='error' + if [ -z ${REC_CARD} ];then echo "Stream not supported" elif [[ ! -z ${RTSP_STREAM} ]];then @@ -22,11 +25,11 @@ elif [[ ! -z ${RTSP_STREAM} ]];then SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[0]} fi - ffmpeg -nostdin -loglevel 32 -ac ${CHANNELS} -i ${SELECTED_RSTP_STREAM} -acodec libmp3lame \ + ffmpeg -nostdin -loglevel $LOGGING_LEVEL -ac ${CHANNELS} -i ${SELECTED_RSTP_STREAM} -acodec libmp3lame \ -b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \ -f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re else - ffmpeg -nostdin -loglevel 32 -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \ + ffmpeg -nostdin -loglevel $LOGGING_LEVEL -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \ -b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \ -f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re fi