'I want to pipe these two ffmpeg commands for to convert a video to grayscale frames

Please, I want to pipe these two commands. ffmpeg -i input.flv -vf fps=1 out%d.png | ffmpeg -i input -vf format=gray output



Solution 1:[1]

If you just need frames, try this:

ffmpeg -i input.flv -r 1 -pix_fmt gray out%d.png

There is no need to call it twice

  • -r sets the output frame rate (1 frame/sec) dropping excess frames
  • pix_fmt sets the output pixel format

[edit]

Try this to output both grayscale video and images:

ffmpeg -i input.flv \
  -filter_complex format=gray,split[v0][v1]
  -map [v0] -r 1 out%d.png
  -map [v1] output.mp4

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1