Use MJPG stream instead of RTSP

as the webcams already produce MJPG, it wouldn't make sense to re-encode
the stream.
This commit is contained in:
Jakob Lechner 2025-08-02 00:00:39 +02:00
parent 6f735a22d7
commit fcfec4b6a9

View file

@ -21,15 +21,13 @@ if "prom" not in st.session_state:
st.set_page_config(layout="wide", page_title="People Counter")
# RTSP-Stream URL
#RTSP_URL = st.text_input("RTSP Stream URL", "rtsp://<benutzer>:<passwort>@<ip>:<port>/pfad")
RTSP_URL = "rtsp://localhost:8554/cam"
STREAM_URL = "http://192.168.11.76:8080?action=stream"
start_button = st.button("Start Counter")
FRAME_SKIP = 2 # Reduziert Verarbeitungslast
if start_button and RTSP_URL:
if start_button and STREAM_URL:
line_orientation = 'vertical'
line_position = 640
@ -37,7 +35,7 @@ if start_button and RTSP_URL:
model = YOLO("yolo_weights/yolo11n.pt")
counter = Counter(line_orientation)
cap = cv2.VideoCapture(RTSP_URL)
cap = cv2.VideoCapture(STREAM_URL)
frame_idx = 0
while cap.isOpened():