Update spectral_analysis.sh

This commit is contained in:
Alexandre
2024-05-27 11:34:02 +02:00
committed by GitHub
parent d378acb520
commit 20743eb3d5

View File

@@ -15,6 +15,8 @@ fi
[ -z "$RECORDING_LENGTH" ] && RECORDING_LENGTH=15
[ -d "$RECS_DIR"/StreamData ] || mkdir -p "$RECS_DIR"/StreamData
filename="Spectrum_$(date "+%Y-%m-%d_%H:%M").wav"
if [ ! -z "$RTSP_STREAM" ];then
# Explode the RSPT steam setting into an array so we can count the number we have
RTSP_STREAMS_EXPLODED_ARRAY=("${RTSP_STREAM//,/ }")
@@ -31,7 +33,7 @@ if [ ! -z "$RTSP_STREAM" ];then
# Map id used to map input to output (first stream being 0), this is 0 based in ffmpeg so decrement our counter (which is more human readable) by 1
MAP_ID="$((RTSP_STREAMS_STARTED_COUNT-1))"
# Build up the parameters to process the RSTP stream, including mapping for the output
FFMPEG_PARAMS+="-vn -thread_queue_size 512 -i ${i} -map ${MAP_ID}:a:0 -t ${RECORDING_LENGTH} -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/spectrum.wav "
FFMPEG_PARAMS+="-vn -thread_queue_size 512 -i ${i} -map ${MAP_ID}:a:0 -t ${RECORDING_LENGTH} -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/$filename "
# Increment counter
((RTSP_STREAMS_STARTED_COUNT += 1))
done
@@ -48,10 +50,10 @@ else
else
if [ -z "${REC_CARD}" ];then
arecord -f S16_LE -c"${CHANNELS}" -r48000 -t wav --max-file-time "${RECORDING_LENGTH}"\
--use-strftime "${RECS_DIR}"/StreamData/spectrum.wav
--use-strftime "${RECS_DIR}"/StreamData/"$filename"
else
arecord -f S16_LE -c"${CHANNELS}" -r48000 -t wav --max-file-time "${RECORDING_LENGTH}"\
-D "${REC_CARD}" --use-strftime "${RECS_DIR}"/StreamData/spectrum.wav
-D "${REC_CARD}" --use-strftime "${RECS_DIR}"/StreamData/"$filename"
fi
fi
fi