Linux – ffmpeg pipe images extracted from video

ffmpeglinuxpipevideo

I can use the following command to extract images from a video using ffmpeg, saving them to the filesystem:

... | ffmpeg -i - -f image2 'img-%03d.png'

I would like to pipe these images to another application, rather than save them to the filesystem – how they are separated in the pipe is of little importance, since it'll be a NodeJS script that I control myself.

The following does not work:

... | ffmpeg -i - -f image2 pipe: | ...

Erroring with

[image2 @ 0xe1cfc0] Could not get frame filename number 2 from pattern 'pipe:' (either set updatefirst or use a pattern like %03d within the filename pattern)
av_interleaved_write_frame(): Invalid argument

Is there any way to pipe out images extracted from a video using ffmpeg, without using the filesystem?

Best Answer

yes there is!

add the argument -f image2pipe, and specify the output filename as a single hypen (-, in this context it means stdout), and specify the input filename also as a single hypen (-i -, in this context it means stdin) and explicitly specify the output format (eg for png: -c:v png), here is a complete example:

ffmpeg -i - -ss 00:00:3 -s 650x390 -vframes 1 -c:v png -f image2pipe -
Related Question