Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Display Video on JupyterLab Notebook on GCP

I am having trouble display/embedding a video in a Notebook in Jupyter Lab. I have tried multiple ways to display a video, but it just does not play the video. The player loads but does not load the video. I am using JupyterLab on a Google Cloud (GCP) VM.

Attempt 1:

from IPython.display import Video

Video(LOCAL_PATH)

Attempt 2:

from IPython.display import HTML

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

Attempt 3:

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

enter image description here

like image 216
Bryce Ramgovind Avatar asked Dec 30 '25 11:12

Bryce Ramgovind


1 Answers

I also had the same problem with JupyterLab. The IPython.display and %%HTML solutions did not work for me. Then, I tried the MoviePy library instead. It solved the problem.

Here is the code that worked for me:

from moviepy.editor import *
    
path="you_video_file_path" 
    
clip=VideoFileClip(path)
clip.ipython_display(width=500)

Update for New Version of MoviePy (2025)

from moviepy import VideoFileClip

path="you_video_file_path" 

clip=VideoFileClip(path)
clip.display_in_notebook(width=500)
  • MoviePy on PyPi
  • MoviePy Documentation
like image 128
chan3600 Avatar answered Jan 02 '26 17:01

chan3600



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!