在GCP的JupyterLab笔记本上显示视频

时间:2020-08-14 05:55:50

标签: jupyter-notebook jupyter-lab gcp-ai-platform-notebook

我在Jupyter Lab的笔记本中显示/嵌入视频时遇到问题。我尝试了多种显示视频的方法,但是它只是不能播放视频。播放器加载但不加载视频。我正在Google Cloud(GCP)VM上使用JupyterLab。

尝试1:

from IPython.display import Video

Video(LOCAL_PATH)

尝试2:

from IPython.display import HTML

HTML("""
    <video alt="test" controls>
        <source src="./video.mov" type="video/mov">
    </video>
""")

尝试3:

%%html
    <video width='480' height='480' controls>
        <source src='./video.mov'>
    </video>

enter image description here

1 个答案:

答案 0 :(得分:0)

我创建了一个代码单元,并使用以下代码,并且适用于youtube,MP4视频和.mov视频。 我的视频每个大约2 MB。您要加载大型视频吗?

%%HTML
<iframe width="560" height="315" src="https://www.youtube.com/embed/3SeRMd0tGms?rel=0&amp;controls=0&amp;showinfo=0" frameborder="0" allowfullscreen></iframe>
from IPython.display import Video
Video("video.mp4")
from IPython.display import Video
Video("movie.mov")

enter image description here