celluloid
celluloid copied to clipboard
View videos in colab
Is there a way to view videos in google colab?
Same question!
from IPython.display import HTML, display
import base64
def Video(path, width=800, type='mp4'):
display(HTML(f"<video width={width} controls src='data:video/{type};base64,{(base64.b64encode(open(path, 'rb').read()).decode('utf-8'))}'>" ))
Video('vid.mp4')
works fine on videos with relatively small sizes.
ref: https://stackoverflow.com/a/68294183, https://stackoverflow.com/a/57378660
Oh, that's a great idea. Thank you!