rtsp adjustments

This commit is contained in:
Patrick McGuire
2022-04-25 08:33:32 -04:00
committed by GitHub
parent a352b25941
commit f1ebae6458
+9 -10
View File
@@ -2,24 +2,23 @@
set -x set -x
source /etc/birdnet/birdnet.conf source /etc/birdnet/birdnet.conf
if [ "${TIMESTAMP_FORMAT}" == "12" ];then STAMP="%H:%M:%S"
STAMP="%I:%M:%S%P"
else
STAMP="%H:%M:%S"
fi
[ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15 [ -z $RECORDING_LENGTH ] && RECORDING_LENGTH=15
if ! pulseaudio --check;then pulseaudio --start;fi if [ ! -z $RTSP_STREAM ];then
while true;do
if pgrep arecord &> /dev/null ;then ffmpeg -i $RTSP_STREAM -t 15 -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/$(date "+%F")-birdnet-$STAMP.wav
echo "Recording" done
else else
if ! pulseaudio --check;then pulseaudio --start;fi
if pgrep arecord &> /dev/null ;then
echo "Recording"
else
until grep 5050 <(netstat -tulpn 2>&1);do until grep 5050 <(netstat -tulpn 2>&1);do
sleep 1 sleep 1
done done
if [ -z ${REC_CARD} ];then if [ -z ${REC_CARD} ];then
arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\ arecord -f S16_LE -c${CHANNELS} -r48000 -t wav --max-file-time ${RECORDING_LENGTH}\
--use-strftime ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav --use-strftime ${RECS_DIR}/%B-%Y/%d-%A/%F-birdnet-${STAMP}.wav
else else