I whant that all frames will be in one place.
code:
f = st.file_uploader("Upload file")
if f is not None:
pass
else:
cap = cv.VideoCapture('small.mp4')
if (cap.isOpened() == False):
st.write("Error opening video stream or file")
while (cap.isOpened()):
success, frame = cap.read()
if success:
to_show = cv.cvtColor(frame, cv.COLOR_BGR2RGB)
st.image(to_show, caption='Video')
else:
break
cap.release()
Just modified your code a little bit, This is a sample to show your webcam feed,
import cv2
import streamlit as st
image_placeholder = st.empty()
cap = cv2.VideoCapture(0)
if (cap.isOpened() == False):
st.write("Error opening video stream or file")
while (cap.isOpened()):
success, frame = cap.read()
if success:
to_show = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
image_placeholder.image(to_show, caption='Video')
else:
break
cap.release()