Files
AvianVisitors/scripts/livestream.sh
T
jaredb7 421902684f 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.
2023-04-09 22:26:04 +10:00

36 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# 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
# Explode the RSPT steam setting into an array so we can count the number we have
RSTP_STREAMS_EXPLODED_ARRAY=(${RTSP_STREAM//,/ })
# If for some reason the RTSP_STREAM_TO_LIVESTREAM is not set, then init it to 0 to use the first stream
if [[ -z ${RTSP_STREAM_TO_LIVESTREAM} ]];then
RTSP_STREAM_TO_LIVESTREAM=0
fi
# Get the RSTP stream at the specified array index
SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[RTSP_STREAM_TO_LIVESTREAM]}
# If for some reason the RTSP stream url is null
if [[ -z ${SELECTED_RSTP_STREAM} ]];then
# Try select the first stream
SELECTED_RSTP_STREAM=${RSTP_STREAMS_EXPLODED_ARRAY[0]}
fi
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 $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