I want to generate an MP4 file using frames produced by a rather complicated simulation. If I have to watch the movie as a side affect of generating it I will not complain too much, but would rather not "show" anything on the screen. The overhead of making the movie is trivial compared to the simulations, so I care much more about clean simple code than about performance.
It seemed natural to use grab_frame with FFMpegFileWriter. The following code seemed right.
fig, ax = plot.subplots(figsize=(6.5, 6.5))
assert(animation.FFMpegFileWriter().isAvailable())
writer = animation.FFMpegFileWriter(fig)
writer.setup(fig, "test1.mp4",224)
with writer.saving(fig,"test1.mp4", dpi=224):
for i in range(len(frameSeg)):
PlotFrame(i)
writer.grab_frame()
# writer.finish()
print("done")
It runs, but yeilds the following error
[image2 demuxer @ 0000021fab8c1000] Unable to parse option value "Figure(650x650)" as video rate [image2 demuxer @ 0000021fab8c1000] Error setting option framerate to value Figure(650x650). [in#0 @ 0000021fab8c1e00] Error opening input: Invalid argument Error opening input file ... AppData\Local\Temp\tmpe19ci2wz\tmp%07d.png. Error opening input files: Invalid argument
subprocess.CalledProcessError: Command '['ffmpeg', '-framerate', 'Figure(650x650)', '-i', 'F:\Users\Kenne.DESKTOP-BT6VROU\AppData\Local\Temp\tmpe19ci2wz\tmp%07d.png', '-loglevel', 'error', '-vcodec', 'h264', '-pix_fmt', 'yuv420p', '-y', 'test1.mp4']' returned non-zero exit status 4294967274.
Did I miss something in setup, is it an installation problem, or is it a bug?
By the way using FFMpegWRiter with FuncAnimation works ...