I'm trying to embed a video on my local drive in Jupyter Notebook.
The file name is "openaigym.video.6.7524.video000000.mp4" and it is in a folder "gym-results".
Using the following code produces nothing whatsoever:
from IPython.display import Video
Video("./gym-results/openaigym.video.4.7524.video000000.mp4",embed =True)
If I try to use HTML directly (which I got from here), it produces an unplayable video:
from base64 import b64encode
def video(fname, mimetype):
from IPython.display import HTML
video_encoded = b64encode(open(fname, "rb").read())
video_tag = '<video controls alt="test" src="data:video/{0};base64,{1}">'.format(mimetype, video_encoded)
return HTML(data=video_tag)
path= f"./gym-results/openaigym.video.6.7524.video000000.mp4"
video(path, "mp4")
That is, it produces the following:
Which cannot be started. How do I solve this?


