Created
November 29, 2023 10:43
-
-
Save miladfa7/3ee799bb7a6d0de6c7fdf159e7c582d5 to your computer and use it in GitHub Desktop.
How to load and show video in Jupyter Notebook
This file contains hidden or 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
import io | |
import base64 | |
from IPython.display import HTML | |
video = io.open('21590891783.mp4', 'r+b').read() | |
encoded = base64.b64encode(video) | |
HTML(data=''' | |
<video controls> | |
<source src="data:video/mp4;base64,{0}" type="video/mp4" /> | |
</video>'''.format(encoded.decode('ascii'))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment