Issue
I'm getting the error RuntimeError: Requested MovieWriter (ffmpeg) not available
when trying to run this simple example of creating and displaying an animation in a Jupyter Notebook.
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-1-799d6a3690af> in <module>
8
9 # Define the meta data for the movie
---> 10 FFMpegWriter = manimation.writers['ffmpeg']
11 metadata = dict(title='Movie Test', artist='Matplotlib',
12 comment='a red circle following a blue sine wave')
/usr/local/lib/python3.8/dist-packages/matplotlib/animation.py in __getitem__(self, name)
164 if self.is_available(name):
165 return self._registered[name]
--> 166 raise RuntimeError(f"Requested MovieWriter ({name}) not available")
167
168
RuntimeError: Requested MovieWriter (ffmpeg) not available
Running !pip install ffmpeg
didn't help, as ffmpeg
is already installed, apparently:
Requirement already satisfied: ffmpeg in /home/username/.local/lib/python3.8/site-packages
How can I make this work?
Solution
I managed to fix this, but it took me quite some time to find the right solution, so I will share it in case it helps someone. Basically, you need to download the latest static build of FFmpeg
and add it to PATH
, so that it can be found by python
. You can do this easily by running this script:
# Download a static FFmpeg build and add it to PATH.
exist = !which ffmpeg
if not exist:
!curl https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz -o ffmpeg.tar.xz \
&& tar -xf ffmpeg.tar.xz && rm ffmpeg.tar.xz
ffmdir = !find . -iname ffmpeg-*-static
path = %env PATH
path = path + ':' + ffmdir[0]
%env PATH $path
print('')
!which ffmpeg
print('Done!')
Hope it helps!
Answered By - Clerni
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.