[ACCEPTED]-Can't save matplotlib animation-save
You need to specify your path to
On linux 4 I use:
import numpy as np from matplotlib import pyplot as plt from matplotlib import animation plt.rcParams['animation.ffmpeg_path'] = '/usr/bin/ffmpeg'
You will obviously have to point to 3 your windows .exe instead of '/usr/bin/ffmpeg'
If 2 you don't have
ffmpeg installed, you can get it 1 here
for some animation "anim" i use on windows:
plt.rcParams['animation.ffmpeg_path'] ='E:\\Media\\ffmpeg\\bin\\ffmpeg.exe' FFwriter = animation.FFMpegWriter() anim.save('basic_animation.mp4', writer = FFwriter, fps=30)
where 2 path should be with \ \ and not with / or 1 \ between folders
Line 183 in animation.py is the
subprocess.Popen call to 12
ffmpeg. It seems that the
ffmpeg exe is not where matplotlib 11 expects it to be.
My first attempt would 10 be to put the install path (directory) to 9
ffmpeg into the windows
Path environmental variable. I'm 8 guessing that animation.py is expecting 7 it to be available globally (as it would 6 be under Linux).
If that doesn't work, I'd 5 inspect the
subprocess.Popen call in animation.py to see 4 exactly what it is doing. You could break 3 point it or adjust the verbose.report variable 2 in your matplotlibrc file to spit it out. Line 179 1 there is:
verbose.report('MovieWriter.run: running command: %s' % ' '.join(command))
On Windows, I had to use
plt.rcParams['animation.ffmpeg_path'] = 'C:\\mypath' with all double 8 '\' in the path and this line has to be 7 mentioned before
from matplotlib import animation
and mypath = path of ffmpeg.exe 6 on the local disk.
Additionally, I also added 5 the ffmpeg path in the environment variables.
It 4 took me two days and after going through 3 tons of advice I was able to solve this 2 issue of saving animation.
Thank you everyone 1 for all the answers.
More Related questions