Skip to content

Instantly share code, notes, and snippets.

@zabir-nabil
Created May 3, 2020 04:52
Show Gist options
  • Save zabir-nabil/95c54453cbe6df1d1d867574d1383721 to your computer and use it in GitHub Desktop.
Save zabir-nabil/95c54453cbe6df1d1d867574d1383721 to your computer and use it in GitHub Desktop.
Watching local videos on google colab
Display the source blob
Display the rendered blob
Raw
# to upload
from google.colab import files
files.upload()
# to view
from IPython.display import HTML
from base64 import b64encode
video_path = 'video_name.mp4'
mp4 = open(video_path,'rb').read()
decoded_vid = "data:video/mp4;base64," + b64encode(mp4).decode()
HTML(f'<video width=400 controls><source src={decoded_vid} type="video/mp4"></video>')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment