Issue
I'm running a Jupyter Notebook on VS code and trying to display/play a video. From all the other forums, I've seen that using IPython.display is the standard method; however, it isn't working for me.
For example, for Video:
from IPython.display import Video
Video('test.mp4')
This code generates a video box in the output and I don't have any errors but I can't press play. The same happens when I try playing an Audio file.
I've ensured that the file is in the current folder and I'm using Python 3.8.2 in a virtual environment (venv) and IPython 7.27.0.
Solution
To get it to work I did the following:
Uninstalled and reinstalled VS Code and installed the extensions Python, Jupyter and Jupyter Keymap
Installed FFmpeg through Homebrew:
brew install ffmpeg
Converted the video codec from "MPEG4" to "H.264":
ffmpeg -i test.mp4 video.mp4
Then used the following code to display the video:
from IPython.display import Video
Video('video.mp4', width=128, height=128)
Answered By - Mia
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.