I would like to create an h264 or divx movie from frames that I generate in a python script in matplotlib. There are about 100k frames in this movie.
In examples on the web [eg. 1], I have only seen the method of saving each frame as a png and then running mencoder or ffmpeg on these files. In my case, saving each frame is impractical. Is there a way to take a plot generated from matplotlib and pipe it directly to ffmpeg, generating no intermediate files?
Programming with ffmpeg's C-api is too difficult for me [eg. 2]. Also, I need an encoding that has good compression such as x264 as the movie file will otherwise be too large for a subsequent step. So it would be great to stick with mencoder/ffmpeg/x264.
Is there something that can be done with pipes [3]?
[1] http://matplotlib.sourceforge.net/examples/animation/movie_demo.html
[2] How does one encode a series of images into H264 using the x264 C API?
[3] http://www.ffmpeg.org/ffmpeg-doc.html#SEC41
See Question&Answers more detail:os