[FFmpeg-user] Feeding frames to ffmpeg directly
Carl Eugen Hoyos
ceffmpeg at gmail.com
Sun Jan 23 01:11:44 EET 2022
Am So., 16. Jan. 2022 um 22:24 Uhr schrieb Moritz Barsnick <barsnick at gmx.net>:
> 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 - ...
Nothing wrong but note that png is a format that will not work at
all if auto-detection fails (there are many formats where forcing
the format can be necessary) so in this specific case, the
following will always work if the above works:
$ ./your_program | ffmpeg -i - ...
As an advantage, this may also work if the program sometimes
outputs png, sometimes other formats.
More information about the ffmpeg-user