How to access the video content that has been uploaded on Streamlit

Currently, my system is able to do the real-time recognition using webrtc_streamer but I have no idea how to access the video content that has been uploaded . Below is what I have for now:

uploaded_video = st.file_uploader("Please upload a video.")
    if uploaded_video is not None:
        tfile = tempfile.NamedTemporaryFile(delete=False) 
        tfile.write(uploaded_video.read())
        video_file = open(tfile.name, 'rb')
        video_bytes = video_file.read()

        while video_bytes is not None:
            with lock:
                img = img_container["img"]
            if img is None:
                continue
            frame = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

Is there any suggestions other than using cv2.VideoCapture() as the Streamlit cloud is not allowed to use it. Much appreciated!

Hey @hellojr01,

If you’re looking to access video content uploaded by app users, I would recommend using some type of cloud storage (such as Amazon S3) to store the videos once they’re uploaded. This would ensure that you’ll be able to access the files regardless of whether the app restarts.

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.