[FFmpeg-user] Export screenshot then pipe each to external program

Adnan RIHAN axel50397 at gmail.com
Wed Sep 7 20:10:14 EEST 2016

On 7 septembre 2016 at 01:12:47, Moritz Barsnick (barsnick at gmx.net(mailto:barsnick at gmx.net)) wrote: 
> $ ffmpeg -i video.mp4 -vf fps=1/5 -c:v png -f image2pipe - | yourprogram
> If you can modify your program to handle this, you save yourself the
> hassle of passing the files through the filesystem (and cleaning up
> afterwards), guessing when a new file is there and when ffmpeg is
> finished with it, and so on.

Thank you for your suggestion. I have modified my external program, which now accepts a piped image like this, and output « unrecognized » or a result:

$ cat image.png | myProgram -

So, after trying this, unfortunately, no result at all:

$ ffmpeg -i video.mp4 -vf fps=1/5 -c:v png -f image2pipe - | myProgram -

Maybe I haven’t handled correctly something. How does ffmpeg proceed to write to the standard output in that case? Does it buffer until it finishes then write to myProgram standard input (all in once)? Or does it open the standard output and write each image as they're treated?

Ideally, I would love being able to call myProgram individually for each image treated by ffmpeg, the exact same way the unix command « find » works with « -exec », if it’s possible.

Thank you

More information about the ffmpeg-user mailing list