hereの例を使用して、matplotlib でアニメーションを作成しようとしています。最初の問題は ffmpeg がインストールされていないことだったので、macports からインストールしましたが、「rgba」がサポートされていないと言っているわけではありません。エラーメッセージ:
File "Plot_shocktube1D.py", line 85, in <module>
animDensity.save(densityAnimationName, extra_args=['-vcodec', 'libx264']) #, writer=movWriter)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py", line 615, in save
writer.grab_frame()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py", line 199, in grab_frame
dpi=self.dpi)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 1363, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2012, in print_figure
print_method = self._get_print_method(format)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 1953, in _get_print_method
'%s.' % (format, ', '.join(formats)))
ValueError: Format "rgba" is not supported.
Supported formats: bmp, emf, eps, gif, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff.
さて、苦労した後、代わりにをFFMpegWriter
使用してセットアップしましたが、新しいエラーが発生しています...png
rgba
movWriter = anim.FFMpegWriter(fps=5, codec=None, bitrate=None, extra_args=None, metadata=None)
movWriter.frame_format = 'jpg'
animDensity = anim.FuncAnimation(fig, animateDensity, frames=10, interval=100, blit=True)
animDensity.save(densityAnimationName, extra_args=['-vcodec', 'libx264'], writer=movWriter)
エラーあり:
File "Plot_shocktube1D.py", line 85, in <module>
animDensity.save(densityAnimationName, extra_args=['-vcodec', 'libx264'], writer=movWriter)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py", line 615, in save
writer.grab_frame()
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/animation.py", line 199, in grab_frame
dpi=self.dpi)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/figure.py", line 1363, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backend_bases.py", line 2093, in print_figure
**kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 326, in print_jpg
self._print_bitmap(filename, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/backends/backend_macosx.py", line 319, in _print_bitmap
self.write_bitmap(filename, width, height, dpi)
ValueError: Unknown file type
必要なものがインストールされていないという印象を受けています...通常、macportsはすべてをセットアップしますが、どこを見ればよいかわかりません。どんな助けでも大歓迎です。