Propably the simplest way to use ffmpeg with Imagick is to configure the ffmpeg as a delegate for ImageMagick. I tested this quickly yesterday and I was able to get images out of an Xvid video.
ImageMagick relies on a number of delegate programs to support certain image formats. This means that when an image with a specific format is opened ImageMagick spawns the delegate program to handle the conversion from the original format. I my case the program was ffmpeg.
First start by adding a new delegate into ImageMagick’s delegates.xml, inside the
<delegate decode=”ffmpeg” command=’”ffmpeg” -i “%i” -y -vcodec png -ss %s -vframes 1 -an -f rawvideo “%o”‘ />
After this you should be able to use the following piece of code:
- $im = new imagick();
- $im->newPseudoImage( 200, 200, "ffmpeg:test1.mpg" );
- $im->setImageFormat( "png" );
- header( "Content-Type: image/png" );
- echo $im;
The number inside  is seconds from the begin of the video. Someone more proficient with ffmpeg can propably change that to framenumber but I was unable to find a way to get image output by frame.