0

I am writing a human detection live streaming with Django + YOLOv5.

Firstly I import the video source form rtsp, then detect with it run() function, then yield frame by frame. To stream, I use StreamingHttpResponse with streaming_content=run().

It seems to work fine, but when I reload the streaming page, maybe the run() is called again, if I reload too much, the fps decreases then the stream stops, with an AssertionError: cannot open rtsp...

I've tried a solution, to use iframe on front-end, but every time front-end shows the stream, it calls StreamingHttpRespone and run() again. Do you have any solution for it?

def video_feed(request):
    return StreamingHttpResponse(streaming_content=run(), content_type='multipart/x-mixed-replace; boundary=frame')
haduki
  • 1,145
  • 5
  • 23
  • follow this to avoid assertion_Error https://stackoverflow.com/questions/11587223/how-to-handle-assertionerror-in-python-and-find-out-which-line-or-statement-it-o – Ajay K Dec 02 '22 at 11:34

0 Answers0