From af7d85b6cbdcfe9e51d2476da34c48c6110eb52d Mon Sep 17 00:00:00 2001 From: cgomesu Date: Wed, 11 Jan 2023 13:19:11 -0300 Subject: [PATCH] ffmpeg: disable stdin interaction ffmpeg enables interaction on stdin by default, which may have undesirable consequences when running ffmpeg in the background. adding `-nostdin` disables interaction via the stdin stream. --- scripts/birdnet_recording.sh | 2 +- scripts/livestream.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.sh index 5b4a1ae..8e60dbc 100755 --- a/scripts/birdnet_recording.sh +++ b/scripts/birdnet_recording.sh @@ -8,7 +8,7 @@ if [ ! -z $RTSP_STREAM ];then [ -d $RECS_DIR/StreamData ] || mkdir -p $RECS_DIR/StreamData while true;do for i in ${RTSP_STREAM//,/ };do - ffmpeg -i ${i} -t ${RECORDING_LENGTH} -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/$(date "+%F")-birdnet-$(date "+%H:%M:%S").wav + ffmpeg -nostdin -i ${i} -t ${RECORDING_LENGTH} -vn -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/$(date "+%F")-birdnet-$(date "+%H:%M:%S").wav done done else diff --git a/scripts/livestream.sh b/scripts/livestream.sh index 077f479..3896ea5 100755 --- a/scripts/livestream.sh +++ b/scripts/livestream.sh @@ -5,11 +5,11 @@ source /etc/birdnet/birdnet.conf if [ -z ${REC_CARD} ];then echo "Stream not supported" elif [[ ! -z ${RTSP_STREAM} ]];then - ffmpeg -loglevel 32 -ac ${CHANNELS} -i ${RTSP_STREAM} -acodec libmp3lame \ + ffmpeg -nostdin -loglevel 32 -ac ${CHANNELS} -i ${RTSP_STREAM} -acodec libmp3lame \ -b:a 320k -ac ${CHANNELS} -content_type 'audio/mpeg' \ -f mp3 icecast://source:${ICE_PWD}@localhost:8000/stream -re else - ffmpeg -loglevel 32 -ac ${CHANNELS} -f alsa -i ${REC_CARD} -acodec libmp3lame \ + ffmpeg -nostdin -loglevel 32 -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