I have a 4D numpy array of movie frames. I'm looking for a function to write them to a movie, at a given framerate. I have FFMPEG installed on my OS, and as I can see from these answers, the most efficient way to do so is via pipes.
However, I have very little experience using pipes, and the explanations in the link above make little sense to me. Furthermore, very few of the answers seem actually implement pipes, and the one that does uses mencoder, not FFMPEG. I am relatively inexperienced with FFMPEG, so am not sure how to modify the command string from the mencoder answer to make it work in FFMPEG.
WHAT I WOULD LIKE:
A function of the following form:
animate_np_array(4d_array, framerate) -> output.mp4 (or other video codec)
Which implements pipes to send frames one after the other to FFMPEG, and which I can copy-paste into my existing code.
Furthermore, it is absolutely necessary that this function never actually plots any of the frames, as calls to the matplotlib.imshow() function (as I have most typically seen used) slow things down considerably.