ffmpeg-php 함수를 이용해 썸네일을 추출할 때 발생할 수 있는 오류 입니다.
일단 기본적으로 아래 환경이 설정되어져 있어야 합니다.
php.ini
ffmpeg
ffmpeg-php version 0.6.0-svn
ffmpeg-php built on Jul 16 2009 10:12:33
ffmpeg-php gd support enabled
ffmpeg libavcodec version Lavc1d.51.38.0
ffmpeg libavformat version Lavf1d.51.10.0
ffmpeg swscaler diabled
gd
GD Support enbled
GD Version 2.0 or higher
FreeType Support enabled
FreeType Linkage with freetype
FreeType Version 2.3.5
T1Lib Support enabled
GIF Read Support enabled
GIF Create Support enabled
JPG Support enabled
PNG Support enabled
WBMP Support enabled
ffmpeg_frame() 클래스의 toGDImage() 를 이용해 GDImage를 생성하면,
failed to convert frame to gd image
에러로 생성할 수 없습니다.
이 문제는 0.5.3 이하 버전에서는 문제가 없었던 것 같습니다.
ffmpeg-php-0.6.0 으로 업그레이드 되면서 몇가지 문제들이 발생하네요.
(resize(), crop() 함수는 0.6.0 버젼에서 제외되었습니다. : http://ffmpeg-php.svn.sourceforge.net/viewvc/ffmpeg-php/trunk/ffmpeg-php/ChangeLog?view=markup)
원인은 ffmpeg_frame.c 파일의 버그였습니다.
(http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=496079)
ffmpeg-php-0.6.0.tar.bz2 파일의 압축을 풀고
ffmpeg-php.c 파일을 수정합니다.
ffmpeg_frame.c (수정 전)
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
if (gdImageBoundsSafeMacro(dest, x, y)) {
// copy pixel to gdimage buffer zeroing the alpha channel
dest->tpixels[y][x] = src[x] & 0x00ffffff;
} else {
return -1;
}
}
src += width;
}
ffmpeg_frame.c (수정 후)
if(width > dest->sx || height > dest->sy){
return -1;
}
for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) {
// copy pixel to gdimage buffer zeroing the alpha channel
dest->tpixels[y][x] = src[x] & 0x00ffffff;
}
src += width;
}
수정 후 설치하면, 문제가 해결됩니다..^^
podencoder