Enhancement to allow simultaneous RTSP stream recording
Updated birdnet_recording.sh With a functional change around how ffmpeg is used to make use if it's functionality to accept multiple input streams and map each to a output file. Due to the original implementation generating a filename that contain the date/time streams would be writing to the same file - a small change was make each stream go to it's one file with unique filenames. Updated livestream.sh & spectrogram.php The Livestream service would fail if the RTSP stream setting was more than 1 stream (i.e comma separated list of streams) Made some improvements so streaming is possible from any of the URL's, The Spectrogram page received a new control and some Javascript that allows the user to change between streams, the setting gets saved and the livestream service restarted so it uses's the correct stream. This control is not visible if there are no RTSP streams configured By default the livestream service will stream the the first RTSP URL, if the setting is not set or invalid Updated advanced.php With a small GUI change around RTSP steam entry by providing a input field for each URL and a button to add more fields. In the background nothing changes as we use some Javascript to extract the valus entered and fill in the original rtsp_stream value with the correct comma separated string Updated server.py To work with the recording filename changes so that the correct filename is stored in the DB Updated update_birdnet_snippets.sh To support a new setting RTSP_STREAM_TO_LIVESTREAM on the Spectrogram page and in the livestream service
This commit is contained in:
+18
-1
@@ -1,3 +1,4 @@
|
||||
import re
|
||||
from pathlib import Path
|
||||
from tzlocal import get_localzone
|
||||
import datetime
|
||||
@@ -403,8 +404,24 @@ def handle_client(conn, addr):
|
||||
full_file_name = args.i
|
||||
# print('FULL FILENAME: -' + full_file_name + '-')
|
||||
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()
|
||||
|
||||
# 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)
|
||||
|
||||
# Now we can read the date and time as normal
|
||||
# First portion of the filename contaning the date in Y m d
|
||||
file_date = file_name.split('-birdnet-')[0]
|
||||
# Second portion of the filename containing the time in H:M:S
|
||||
file_time = file_name.split('-birdnet-')[1]
|
||||
# Join the date and time together to get a complete string representing when the audio was recorded
|
||||
date_time_str = file_date + ' ' + file_time
|
||||
date_time_obj = datetime.datetime.strptime(date_time_str, '%Y-%m-%d %H:%M:%S')
|
||||
# print('Date:', date_time_obj.date())
|
||||
@@ -463,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-' + Time + audiofmt
|
||||
Date.replace("/", "-") + '-birdnet-' + rstp_ident_for_fn + Time + audiofmt
|
||||
|
||||
# Connect to SQLite Database
|
||||
for attempt_number in range(3):
|
||||
|
||||
Reference in New Issue
Block a user