On Sat, Apr 7, 2012 at 8:40 PM, Benjamin Root <[email protected]> wrote:

>
>
> On Sat, Apr 7, 2012 at 1:34 PM, Tony Yu <[email protected]> wrote:
>
>> I've been using the animations subpackage since it was introduced, but I
>> only recently tried to save an animation using the `save` method.
>> Unfortnately, I get a RuntimeError whenever I try to use it:
>>
>> ...
>>   File
>> "/Users/Tony/python/devel/mpl/lib/matplotlib/backends/backend_agg.py", line
>> 4
>> 52, in print_raw
>>     renderer._renderer.write_rgba(filename_or_obj)
>> RuntimeError: Error writing to file
>>
>>
>> This can be reproduced with any animation example, e.g. 
>> simple_anim.py<http://matplotlib.sourceforge.net/examples/animation/simple_anim.html>,
>>  by
>> replacing `plt.show()` with `ani.save('simple_anim.avi')`. The actual error
>> is from a shell call to ffmpeg, which roughly boils down to:
>>
>> #~~~~
>>     import subprocess
>>     import matplotlib.pyplot as plt
>>
>>     fig, ax = plt.subplots()
>>     ax.plot([0, 1])
>>     command = ['ffmpeg', '-f', 'rawvideo', '-vcodec', 'rawvideo',
>>                '-s', '800x600', '-pix_fmt', 'rgba', '-r', '5.0',
>>                '-i', 'pipe:', '-vcodec', 'mpeg4', '-y', 'test.avi']
>>     proc= subprocess.Popen(command, shell=False, stdout=subprocess.PIPE,
>>                            stderr=subprocess.STDOUT,
>> stdin=subprocess.PIPE)
>>     fileobj = proc.stdin
>>     fig.savefig(fileobj, format='rgba', dpi=100)
>> #~~~~
>>
>> (I just copied the ffmpeg command from an example run, so the option
>> values may vary on other systems.) The error here is the same, and,
>> unfortunately, not very informative. Is this saving functionality platform
>> dependent? (I'm on osx.)
>>
>> Thanks,
>> -Tony
>>
>>
> Tony,
>
> The animation saving feature has be completely rewritten by Ryan recently
> and is in master.  Could you give that a try?
>
> Ben Root
>
> Hey Ben,

This is error is using the current master, actually. I think the previous
implementation saved images and read them with ffmpeg (or some other
utility) instead of piping directly to ffmpeg.

-Tony

(Ben: sorry for the duplicate emails. Forgot to "reply-all")
------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Matplotlib-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to