简体   繁体   中英

RuntimeError: No MovieWriters available in Matplotlib animation

The problem I am getting is in code similar to this example: https://matplotlib.org/examples/animation/basic_example_writer.html

The error:

RuntimeError: No MovieWriters available occurs at Writer = animation.writers['ffmpeg'] in the example above.

I am using mac, I have installed ffmpeg using brew, and even installed it with conda even though I am not using anaconda for this particular code.

I am positive that it is installed - I have used it in terminal to change files but it is not working within the program.

Thanks!

Try to specify path to ffpmeg program manually like

import matplotlib.pyplot as plt
plt.rcParams['animation.ffmpeg_path'] = '/usr/local/bin/ffmpeg'

You have to put these code lines at the beginning of a script and then use animation Writer .

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""

I have found '/usr/local/bin/ffmpeg' not exists in my computer. so i try this:

 import matplotlib.pyplot as plt import matplotlib.animation as animation Writer = animation.writers['pillow'] writer = Writer(fps=15, metadata=dict(artist='Me'), bitrate=1800)

and it works for me

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM