从视频创建动画 - Imagick错误

时间:2012-01-23 13:50:21

标签: php imagick

我有一个代码可以为视频创建一个动画片

$frames = 5; 
 $height = 100; 
 $width = 100;
 $delay = 50; 
 $file = 'new.avi'; 

$movie = new ffmpeg_movie($file); 
 $duration = $movie -> getDuration(); 


$cut = round($duration / ($frames + 2)); 

$image = new Imagick(); 

$image -> setFormat('GIF'); 

$ftime = 0; 

for($i=0;$i<$frames;$i++) 
 { 
 $ftime = $ftime + $cut;
 $frame = new Imagick(); 
 $frame -> newPseudoImage($height, $width, 'ffmpeg:'.$file.'['.$ftime.']');  
 $frame -> cropThumbnailImage($width, $height); 
 $frame -> setFormat('GIF'); 
 $image -> addImage($frame);
 $image -> setImageDelay($delay);
 } 

$image -> writeImages('animation.gif', true);

使用ffmpeg + imagick libs的代码 错误,代码:

Fatal error: Uncaught exception 'ImagickException' with message 'no decode delegate for this image format `E:/home/localhost/www/video/new.avi' @ error/constitute.c/ReadImage/532' in E:\home\localhost\www\video\test.php:26 Stack trace: #0 E:\home\localhost\www\video\test.php(26): Imagick->newpseudoimage(100, 100, 'ffmpeg:E:/home/...') #1 {main} thrown in E:\home\localhost\www\video\test.php on line 26
想象力:2.3.0 | ffmpeg:6.0

我能修复什么?

我的phpinfo:

module version  2.3.0 
imagick classes     Imagick, ImagickDraw, ImagickPixel, ImagickPixelIterator 
ImageMagick version     ImageMagick 6.7.4-9 2012-01-20 Q16 http://www.imagemagick.org 
ImageMagick copyright   Copyright (C) 1999-2012 ImageMagick Studio LLC 
ImageMagick release date    2012-01-20 
ImageMagick Number of supported formats:    215 

0 个答案:

没有答案