8

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?

  • Try -f png - | ... – Gyan Mar 2 '16 at 12:44
  • @Mulvya This results in erroring with [NULL @ 0x10e2860] Requested output format 'png' is not a suitable output format pipe:: Invalid argument. – Birjolaxew Mar 2 '16 at 14:28
  • 2
    Try -f image2pipe -vcodec png - | .... PNG may not work, if so output will be MJPEG after removing vcodec. – Gyan Mar 2 '16 at 14:41
  • @Mulvya That did indeed work. Thank you very much :) – Birjolaxew Mar 2 '16 at 15:23
1

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 -

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.