Page 1 of 1

pipe ffmpeg output to magick

Posted: 2019-01-25T08:41:42-07:00
by mhansen49
Is there a way to pipe output files from FFPEG directly into MAGICK CONVERT?
I want to take the output frames then average them without making hundreds of intermediate files.
(working on a PC)

This example fails ERROR MESSAGE: Unable to find a suitable output format for 'pipe:1'
ffmpeg -i MDI_3434.avi -vf fps=1 pipe:1 | magick convert - -average test3.png

Thanks for your help

Re: pipe ffmpeg output to magick

Posted: 2019-01-25T11:28:14-07:00
by snibgo
"-average" is deprecated. You should use "-evaluate-sequence mean". For example:

Code: Select all

ffmpeg  -r 1 -i 2.avi -r 1 -c:v pam -f image2pipe pipe:1 | magick - -evaluate-sequence mean x1_%06d.png

Re: pipe ffmpeg output to magick

Posted: 2019-02-01T08:01:21-07:00
by mhansen49
The suggested code only pipes the first image. I need to pipe all images in order to compute the mean.

Re: pipe ffmpeg output to magick

Posted: 2019-02-01T08:58:35-07:00
by snibgo
I get all the frames. To demonstrate this, insert "+write info:" after the "-" for magick's input:

Code: Select all

ffmpeg  -r 1 -i 2.avi -r 1 -c:v pam -f image2pipe pipe:1 | magick - +write info: -evaluate-sequence mean x1_%06d.png
This creates text output from magick that starts:

Code: Select all

-[0] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.016
-[1] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.031
-[2] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.031
-[3] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.047
-[4] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.062
-[5] PAM 960x540 960x540+0+0 8-bit TrueColor sRGB 0.016u 0:00.062
The result of "-evaluate-sequence mean" is only one image, of course. If you remove "-evaluate-sequence mean" you will get all frames as PNG files.