I have a video.mp4 in content/video.mp4
if I wanted to play the video in google colab without downloading , ¿what code I should use to open a kind of video player in my jupyter notebook?
Here's the code
from IPython.display import HTML
from base64 import b64encode
mp4 = open('video.mp4','rb').read()
data_url = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML("""
<video width=400 controls>
<source src="%s" type="video/mp4">
</video>
""" % data_url)
You can test it in a colab notebook here.
To support a big vdo file, I write a library to upload to Google Drive and set it public. Then use the returned URL to display the video.
!pip install -U kora
from kora.drive import upload_public
url = upload_public('video.mp4')
# then display it
from IPython.display import HTML
HTML(f"""<video src={url} width=500 controls/>""")