Matplotlib-Animation "No MovieWriters Available"

PythonLinuxAnimationMatplotlibRuntime Error

Python Problem Overview


Under Linux, I've been checking out matplotlib's animation class, and it seems to work except that I cant initialise the movie writer to write out the movie.

Using either of the examples:

results in the error "RuntimeError: No MovieWriters available!"

Im using matplotlib version 1.3.x and have installed (hopefully) all the codecs.

Can someone please suggest as to why I get this error? If its a codecs issue, which codecs (+versions) should I install? If its something else that's broken, is there an alternative for creating animations in python?

Python Solutions


Solution 1 - Python

For fellow googlers using Anaconda, install the ffmpeg package:

conda install -c conda-forge ffmpeg

This works on Windows too.

(Original answer used menpo package owner but as mentioned by @harsh their version is a little behind at time of writing)

Solution 2 - Python

Had the same problem....managed to get it to work after a little while.

Thing to do is follow instructions on installing FFmpeg - which is (at least on windows) a bundle of executables you need to set a path to in your environment variables

http://www.wikihow.com/Install-FFmpeg-on-Windows

Download from ffmpeg.org

Hope this helps someone - even after a while after the question - good luck

Solution 3 - Python

I know this question is about Linux, but in case someone stumbles on this problem on Mac like I did here is the solution for that. I had the exact same problem on Mac because ffmpeg is not installed by default apparently, and so I could solve it using:

brew install yasm
brew install ffmpeg

Solution 4 - Python

Had the same problem under Linux. By default the animate.save method is using ffmpeg but it seems to be deprecated. https://askubuntu.com/questions/432542/is-ffmpeg-missing-from-the-official-repositories-in-14-04

Solution: Install some coder, like avconv or mencoder. Provide the alternative coder in the call:

ani.save('the_movie.mp4', writer = 'mencoder', fps=15)

Solution 5 - Python

If you are using Ubuntu 14.04 ffmpeg is not available. You can install it by using the instructions directly from https://www.ffmpeg.org/download.html.

In short you will have to:

sudo add-apt-repository ppa:mc3man/trusty-media
sudo apt-get update
sudo apt-get install ffmpeg gstreamer0.10-ffmpeg

If this does not work maybe try using sudo apt-get dist-upgrade but this may broke things in your system.

Solution 6 - Python

I had the following error while running the cell. enter image description here

This may be due to not having ffmpeg in your system. Try the following command in your terminal.

sudo apt install ffmpeg

This works for me. I hope it will work out for you too.

Solution 7 - Python

I'm running Ubuntu 20 and I had a similar problem

Installed ffmpeg

pip install ffmpeg

then

sudo apt install ffmpeg

Solution 8 - Python

(be sure to follow JPH feedback above about the proper ffmpeg download) Not sure why, but in my case here is the one that worked (in my case was on windows).

Initialize a writer:

import matplotlib.pyplot as plt
import matplotlib.animation as animation
Writer = animation.FFMpegWriter(fps=30, codec='libx264')  #or 
Writer = animation.FFMpegWriter(fps=20, metadata=dict(artist='Me'), bitrate=1800) ==> This is WORKED FINE ^_^

Writer = animation.writers['ffmpeg'] ==> GIVES ERROR ""RuntimeError: Requested MovieWriter (ffmpeg) not available""

Solution 9 - Python

If error "MovieWriter imagemagick unavailable; using Pillow instead." pops up, try to import PillowWriter explicitly to save as mp4-File by:

from matplotlib.animation import FuncAnimation, PillowWriter

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionParadiseView Question on Stackoverflow
Solution 1 - PythonfiatView Answer on Stackoverflow
Solution 2 - PythonJPHView Answer on Stackoverflow
Solution 3 - Pythonpatapouf_aiView Answer on Stackoverflow
Solution 4 - PythonTapioView Answer on Stackoverflow
Solution 5 - PythonHeberto MayorquinView Answer on Stackoverflow
Solution 6 - PythonNisan ChhetriView Answer on Stackoverflow
Solution 7 - Pythonuser14432237View Answer on Stackoverflow
Solution 8 - PythonHassanSh__3571619View Answer on Stackoverflow
Solution 9 - PythonStephan_HView Answer on Stackoverflow