0

I need to display video frame on web browser in django html page please guide me how to achieve it

@gzip.gzip_page

def home(request):
    try:
        return StreamingHttpResponse(home_video(), content_type="multipart/x-mixed-replace;boundary=frame")
    except:  # This is bad! replace it with proper handling
        pass
def home_video():
    cap = cv2.VideoCapture('D:/AI/videoplayback.mp4')
    if (cap.isOpened() == False):
        print("Error opening video  file")
    while (cap.isOpened()):
        ret, frame = cap.read()
        if ret == True:
            cv2.resizeWindow('image', 1000, 1000)
            cv2.imshow('Frame', frame)
            if cv2.waitKey(25) & 0xFF == ord('q'):
                break
        else:
            break
    cap.release()
    cv2.destroyAllWindows()
umashankar
  • 11
  • 3
  • 1
    check this answer: https://stackoverflow.com/a/49805833 – Nalin Dobhal Jan 22 '20 at 12:24
  • Does this answer your question? [Opencv Live Stream from camera in Django Webpage](https://stackoverflow.com/questions/49680152/opencv-live-stream-from-camera-in-django-webpage) – Manuel Pap Jan 22 '20 at 14:11

0 Answers0