Reputation: 21
I am trying to make animations using Python-Matplotlib
.
I am using this tutorial:
http://jakevdp.github.io/blog/2012/08/18/matplotlib-animation-tutorial/
The animation in the first example works fine when I just execute
the Python script, however in order to be able to save it (anim.save command
),
I had to add 'writer=animation.FFMpegFileWriter()
' as an argument. Now however
the saved file plays much slower than the original file. In fact the video
is always 40 seconds long, no matter to what value I set 'interval
' in the
FuncAnimation
object.
Any suggestions on how to fix this?
Thanks for you help :)
Upvotes: 2
Views: 3464
Reputation: 384
You have to specify the desired frames per second as an argument:
anim.save('filename.mp4', fps=120, writer=animation.FFMpegFileWriter())
Upvotes: 0
Reputation: 1521
I have had a similar problem saving with FFMpeg.
A solution that worked for me was to modify
writer=animation.FFMpegFileWriter()
to read
writer=animation.FFMpegFileWriter(fps=n)
where n is your desired output frames per second.
Upvotes: 3