I would like to preview a recorded video (using OpenCV) in the webpage but keep getting this error.
Knowing that I can read on my laptop both videos, the original, and the recorded one.
I have tested on Firefox and Chromium.
On top, I display the original video et on the bottom of the processed one.
Here is a code I used:
import cv2 import streamlit as st cap = cv2.VideoCapture("demo.mp4") st.video("demo.mp4") ret = True record =None fourcc = cv2.VideoWriter_fourcc('M', 'J', 'P', 'G') while ret: ret, frame = cap.read() if record is None: (H, W) = frame.shape[:2] out = cv2.VideoWriter('demo_.mp4',fourcc, 10, (W, H)) record = True if ret==True: frame = cv2.flip(frame,0) out.write(frame) cap.release() out.release() video_byte = open("demo_.mp4", 'rb').read() st.video(video_byte)
Any help is appreciated.