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

Moritz Barsnick barsnick at gmx.net
Wed Sep 7 02:12:35 EEST 2016

On Tue, Sep 06, 2016 at 23:44:23 +0200, Adnan RIHAN wrote:

> For now, all I have, is the screenshots export:  ffmpeg -i video.mp4 -vf fps=1/5 sh%03d.png

> Currently, my external program only reads files from the filesystem,
> so if possible, it would be great being able to pipe the output
> filename.

Do you want ffmpeg to tell your program the filename? Well, thanks to
sh%03d.png, it's already predictable, isn't it? Does your program want
a new filename every 5 seconds, in order to be able to read it? I don't
quite understand what you're trying to achieve.

> Else, I think I can try to manage something with the standard output
> of ffmpeg (also, if it’s possible).

That is certainly possible. I don't see documentation or examples for
using it as a muxer, but image2pipe should be right for you:

$ 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.


More information about the ffmpeg-user mailing list