Display a video player.

Function signature[source]

st.video(data, format="video/mp4", start_time=0)


data (str, bytes, BytesIO, numpy.ndarray, or file)

Raw video data, filename, or URL pointing to a video to load. Includes support for YouTube URLs. Numpy arrays and raw data formats must include all necessary file headers to match specified file format.

format (str)

The mime type for the video file. Defaults to 'video/mp4'. See https://tools.ietf.org/html/rfc4281 for more info.

start_time (int)

The time from which this element should start playing.


import streamlit as st

video_file = open('myvideo.mp4', 'rb')
video_bytes = video_file.read()



Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV), as this codec is not widely supported by browsers. Converting your video to H.264 will allow the video to be displayed in Streamlit. See this StackOverflow post or this Streamlit forum post for more information.


Still have questions?

Our forums are full of helpful information and Streamlit experts.

Was this page helpful?

editEdit this page on GitHub