diff --git a/scripts/birdnet_recording.sh b/scripts/birdnet_recording.sh index d9e81f6..dfdcefc 100755 --- a/scripts/birdnet_recording.sh +++ b/scripts/birdnet_recording.sh @@ -8,7 +8,7 @@ source /etc/birdnet/birdnet.conf if [ ! -z $RTSP_STREAM ];then [ -d $RECS_DIR/StreamData ] || mkdir -p $RECS_DIR/StreamData # Explode the RSPT steam setting into an array so we can count the number we have - RSTP_STREAMS_EXPLODED_ARRAY=(${RTSP_STREAM//,/ }) + RTSP_STREAMS_EXPLODED_ARRAY=(${RTSP_STREAM//,/ }) while true;do # Original loop @@ -17,18 +17,18 @@ if [ ! -z $RTSP_STREAM ];then # done # Initially start the count off at 1 - our very first stream - RSTP_STREAMS_STARTED_COUNT=1 + RTSP_STREAMS_STARTED_COUNT=1 FFMPEG_PARAMS="" # Loop over the streams - for i in "${RSTP_STREAMS_EXPLODED_ARRAY[@]}" + for i in "${RTSP_STREAMS_EXPLODED_ARRAY[@]}" do # Map id used to map input to output, this is 0 based in ffmpeg decrement - MAP_ID=$((RSTP_STREAMS_STARTED_COUNT-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} -t ${RECORDING_LENGTH} -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/$(date "+%F")-birdnet-RSTP_${RSTP_STREAMS_STARTED_COUNT}-$(date "+%H:%M:%S").wav " + FFMPEG_PARAMS+="-vn -thread_queue_size 512 -i ${i} -map ${MAP_ID} -t ${RECORDING_LENGTH} -acodec pcm_s16le -ac 2 -ar 48000 file:${RECS_DIR}/StreamData/$(date "+%F")-birdnet-RTSP_${RTSP_STREAMS_STARTED_COUNT}-$(date "+%H:%M:%S").wav " # Increment counter - ((RSTP_STREAMS_STARTED_COUNT += 1)) + ((RTSP_STREAMS_STARTED_COUNT += 1)) done # Make sure were passing something valid to ffmpeg, ffmpeg will run interactive and control our look by waiting ${RECORDING_LENGTH} between loops diff --git a/scripts/server.py b/scripts/server.py index fd0e690..22df448 100755 --- a/scripts/server.py +++ b/scripts/server.py @@ -406,15 +406,15 @@ def handle_client(conn, addr): file_name = Path(full_file_name).stem # Get the RSTP stream identifier from the filename if it exists - rstp_ident_for_fn = "" - rstp_ident = re.search("RSTP_[0-9]+-", file_name) - if rstp_ident is not None: - rstp_ident_for_fn = rstp_ident.group() + RTSP_ident_for_fn = "" + RTSP_ident = re.search("RTSP_[0-9]+-", file_name) + if RTSP_ident is not None: + RTSP_ident_for_fn = RTSP_ident.group() # Find and remove the identifier for the RSTP stream url it was from that is added when more than one # RSTP stream is recorded simultaneously, in order to make the filenames unique as filenames are all # generated at the same time - file_name = re.sub("RSTP_[0-9]+-", "", file_name) + file_name = re.sub("RTSP_[0-9]+-", "", file_name) # Now we can read the date and time as normal # First portion of the filename contaning the date in Y m d @@ -480,7 +480,7 @@ def handle_client(conn, addr): Overlap = str(args.overlap) Com_Name = Com_Name.replace("'", "") File_Name = Com_Name.replace(" ", "_") + '-' + Confidence + '-' + \ - Date.replace("/", "-") + '-birdnet-' + rstp_ident_for_fn + Time + audiofmt + Date.replace("/", "-") + '-birdnet-' + RTSP_ident_for_fn + Time + audiofmt # Connect to SQLite Database for attempt_number in range(3):