Created
May 3, 2020 04:52
-
-
Save zabir-nabil/95c54453cbe6df1d1d867574d1383721 to your computer and use it in GitHub Desktop.
Watching local videos on google colab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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