[FFmpeg-user] Feeding frames to ffmpeg directly

Moritz Barsnick barsnick at gmx.net
Sun Jan 16 23:24:37 EET 2022


Hi Violet,

On Sun, Jan 16, 2022 at 15:14:47 -0600, Violet White wrote:
> Hi, I have a program that generates frames of animation and saves
> them to individual files on a disk, but what I would like to do is avoid
> writing the images to disk and simply pipe them in.
>
> Can I expect this to just work if I write multiple png files to the same stream?
> Or will I need to adjust my program's output format?

This should just work. ffmpeg has an input format called "png_pipe"
(and similar for other formats.

Assuming all images have the same dimensions and colorspace - though
I'm not sure that is a must - you can just do:

$ cat *.png | ffmpeg -f png_pipe -i - ...

Of course, you have no files on disk, as in this example. So you would
just change your program to output the consecutive PNGs to stdout, and
pipe that to the ffmpeg command.

$ ./your_program | ffmpeg -f png_pipe -i - ...

Cheers,
Moritz


More information about the ffmpeg-user mailing list