Re: [Matplotlib-users] Saving animations
On Fri, Oct 5, 2012 at 12:43 PM, Andreas Mueller amuel...@ais.uni-bonn.de wrote: Thanks for the tip. I didn't know about ``--verbose-debug``. It told me Unknown encoder 'libx264'. I found out I need to install libavcodec-extra-53 for it to work. Not everything is going smoothly. It would be great if the docs could be updated with how to specify a codec btw. I only found out by chance. Thanks for your help, andy Glad to hear it. It would be nice if there were good docs, period. But that requires a lazy dev (me) to finish his Ph.D. first. :) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] Saving animations
Hi everybody. I have been trying to save some animations I made and I encountered the problem mentioned here http://sourceforge.net/mailarchive/forum.php?thread_name=CAKH0P%2BVLXthNCAZ1K2pKHYqqPiFHP5iXSFwJvEerVmvtmgGv0g%40mail.gmail.comforum_name=matplotlib-devel. I am using current master. To be precise, when I use anim.save(file.mp4, fps=10, extra_args=['-vcodec', 'libx264']) I get RuntimeError: Error writing to file from the agg backend. If I don't use the extra_args, it works, but I get very, very bad quality that can not be redeemed using bitrate. I have ffmpeg and libx264 installed. I also tried the mencoder by passing MencoderWriter() to save, but that resulted in a video where all frames are identical. Any help on this would be appreciated. Is there an easy way to just dump the frames? I can do the mencoder bit myself. Thanks, Andy -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Saving animations
On Thu, Oct 4, 2012 at 10:02 AM, Andreas Mueller amuel...@ais.uni-bonn.dewrote: Hi everybody. I have been trying to save some animations I made and I encountered the problem mentioned herehttp://sourceforge.net/mailarchive/forum.php?thread_name=CAKH0P%2BVLXthNCAZ1K2pKHYqqPiFHP5iXSFwJvEerVmvtmgGv0g%40mail.gmail.comforum_name=matplotlib-devel . I am using current master. To be precise, when I use anim.save(file.mp4, fps=10, extra_args=['-vcodec', 'libx264']) I get RuntimeError: Error writing to file from the agg backend. If I don't use the extra_args, it works, but I get very, very bad quality that can not be redeemed using bitrate. I have ffmpeg and libx264 installed. I also tried the mencoder by passing MencoderWriter() to save, but that resulted in a video where all frames are identical. Any help on this would be appreciated. Is there an easy way to just dump the frames? I can do the mencoder bit myself. Thanks, Andy Exactly which version of mpl are you using, and what is your platform? This will help us diagnose what is going on. Cheers! Ben Root -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] Saving animations
On Thu, Oct 4, 2012 at 12:38 PM, Andreas Mueller amuel...@ais.uni-bonn.de wrote: On 10/04/2012 03:51 PM, Benjamin Root wrote: On Thu, Oct 4, 2012 at 10:02 AM, Andreas Mueller amuel...@ais.uni-bonn.de wrote: Hi everybody. I have been trying to save some animations I made and I encountered the problem mentioned here. I am using current master. To be precise, when I use anim.save(file.mp4, fps=10, extra_args=['-vcodec', 'libx264']) I get RuntimeError: Error writing to file from the agg backend. If I don't use the extra_args, it works, but I get very, very bad quality that can not be redeemed using bitrate. I have ffmpeg and libx264 installed. I also tried the mencoder by passing MencoderWriter() to save, but that resulted in a video where all frames are identical. Any help on this would be appreciated. Is there an easy way to just dump the frames? I can do the mencoder bit myself. Thanks, Andy Exactly which version of mpl are you using, and what is your platform? This will help us diagnose what is going on. Thanks for the quick answer. I am not on the box but I used master from yesterday, so 89482b21c8582d49a2ddc2865e472eb404fd07e2, I guess. The platform is Ubuntu Precise (with loads of random Python packages, but that seems somewhat unrelated). I'm on Ubuntu Precise (12.04) here as well. No problems with/without, but I'm noticing the extra_args aren't being used (which I think is a known bug I need to fix.) Can you run with --verbose-debug and post the relevant output? (Or just compress and attach.) Ryan -- Ryan May Graduate Research Assistant School of Meteorology University of Oklahoma -- Don't let slow site performance ruin your business. Deploy New Relic APM Deploy New Relic app performance management and know exactly what is happening inside your Ruby, Python, PHP, Java, and .NET app Try New Relic at no cost today and get our sweet Data Nerd shirt too! http://p.sf.net/sfu/newrelic-dev2dev ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] saving animations
I cannot see what is wrong, but after saving each figure you should add plt.clf() in order to delete the image and preventing memory leaks, because MPL stores one image in top of the other. For the filecode I suggest you to use something like: savefig(head+str(filecode).zfill(digits)+format, dpi=205) filecode+=1 where head is the name, digits an int and format usually .png. Which backend are you using? Do you need it to be displayed on screen? If not, the backend Agg is best. Regards, David. On Wed, Aug 25, 2010 at 5:28 AM, David Pine djp...@gmail.com wrote: I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples animation_blit_wx.py. The example works fine unless I include the #* line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? def update_line(*args): global blit_time if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) # restore the clean slate background canvas.restore_region(update_line.background) # update the data line.set_ydata(npy.sin(x+update_line.cnt/10.0)) # just draw the animated artist ax.draw_artist(line) # just redraw the axes rectangle t = time.time() canvas.blit(ax.bbox) blit_time += time.time() - t #* plt.savefig('f' + str(update_line.cnt) + '.png') * if update_line.cnt == NBLITS: # print the timing info and quit frame_time = time.time() - tstart print '%d frames: %.2f seconds' % (NBLITS, frame_time) print '%d blits: %.2f seconds' % (NBLITS, blit_time) print print 'FPS: %.2f' % (NBLITS/frame_time) print 'BPS: %.2f' % (NBLITS/blit_time) sys.exit() update_line.cnt += 1 wx.WakeUpIdle() -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
Re: [Matplotlib-users] saving animations
On Tue, Aug 24, 2010 at 10:28 PM, David Pine djp...@gmail.com wrote: I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples animation_blit_wx.py. The example works fine unless I include the #* line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? def update_line(*args): global blit_time if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) # restore the clean slate background canvas.restore_region(update_line.background) # update the data line.set_ydata(npy.sin(x+update_line.cnt/10.0)) # just draw the animated artist ax.draw_artist(line) # just redraw the axes rectangle t = time.time() canvas.blit(ax.bbox) blit_time += time.time() - t #* plt.savefig('f' + str(update_line.cnt) + '.png') * if update_line.cnt == NBLITS: # print the timing info and quit frame_time = time.time() - tstart print '%d frames: %.2f seconds' % (NBLITS, frame_time) print '%d blits: %.2f seconds' % (NBLITS, blit_time) print print 'FPS: %.2f' % (NBLITS/frame_time) print 'BPS: %.2f' % (NBLITS/blit_time) sys.exit() update_line.cnt += 1 wx.WakeUpIdle() Technically speaking, animation to the screen is completely different from what you are trying to do here. When showing an animation to the screen, a bunch of tricks are needed to make it efficient and for looping. However, if you only wish to save the individual frames, I would suggest that you just simply create your figures normally (none of this blitting and update_lines stuff) and save each of them as you would normally. Be sure to call clf() to prevent memory usage to grow out of control. Persoanlly, I then use ImageMagick to merge the image files together into an animated gif: convert `ls -1 *.png | sort -d` -set delay 40 -set dispose none -loop 0 animation.gif The experimental Animation module will have some preliminary support for saving animations (that feature isn't cross-platform right now). Ben Root -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users
[Matplotlib-users] saving animations
I am trying to save the frames from a matplotlib animation and I have a question that is undoubtedly based on a profound lack of understanding about how matplotlib/python works, but I'm hoping someone can offer me an explanation. The following code is excerpted from the animation examples animation_blit_wx.py. The example works fine unless I include the #* line meant to record the animations in included. If the line is included, the animated line is no longer drawn to the screen or to the sequence of plots I am trying to save. That is, the background is displayed and saved, but not the animated line. Why? def update_line(*args): global blit_time if update_line.background is None: update_line.background = canvas.copy_from_bbox(ax.bbox) # restore the clean slate background canvas.restore_region(update_line.background) # update the data line.set_ydata(npy.sin(x+update_line.cnt/10.0)) # just draw the animated artist ax.draw_artist(line) # just redraw the axes rectangle t = time.time() canvas.blit(ax.bbox) blit_time += time.time() - t #* plt.savefig('f' + str(update_line.cnt) + '.png') * if update_line.cnt == NBLITS: # print the timing info and quit frame_time = time.time() - tstart print '%d frames: %.2f seconds' % (NBLITS, frame_time) print '%d blits: %.2f seconds' % (NBLITS, blit_time) print print 'FPS: %.2f' % (NBLITS/frame_time) print 'BPS: %.2f' % (NBLITS/blit_time) sys.exit() update_line.cnt += 1 wx.WakeUpIdle() -- Sell apps to millions through the Intel(R) Atom(Tm) Developer Program Be part of this innovative community and reach millions of netbook users worldwide. Take advantage of special opportunities to increase revenue and speed time-to-market. Join now, and jumpstart your future. http://p.sf.net/sfu/intel-atom-d2d ___ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users