I have a list of numpy arrays lets call frames
. I know I can use cv2.VideoWriter()
to export a series of frames to a video file. However, I would like to just get the byte data instead of actually writing it to a file. My goal is to pass this video to the st.video()
function. https://docs.streamlit.io/library/api-reference/media/st.video. Below is a rough outline of my current setup
vid = st.file_uploader(
label="Upload Video",
type=["mov", "mp4"]
)
if st.button("Load"):
v = VideoClassInAnotherFile(vid)
frames: list[np.ndarray] = v.process() # the function where I manipulate the frames using opencv
byte_data = ... # TODO: turn the frames into byte data acceptable for st.video
st.video(byte_data)