Ubuntu 에서 FFMPEG-PHP 설치하기

일단 gusty 기준으로 설치법

 

(hardy 에는 http://packages.ubuntu.com/source/hardy/ffmpeg-php 패키지가 있는모양이다)

 

 

ffmpeg-php 홈페이지 http://ffmpeg-php.sourceforge.net/

 

API document http://ffmpeg-php.sourceforge.net/doc/api/

 

php는 dev버젼으로 설치되어있어야하고 (php5-dev)

 

ffmpeg은 설치되어있다는 가정하에

 

 

apt-get install ffmpeg libavformat-dev  libavcodev-dev liblame-dev

 

등등 필요한 라이브러리를 설치하고

phpize5
./configure
make
make install

 

 

php.ini 끝에

extension=ffmpeg.so

 

apache2ctl restart

 

 

 

뭐 대충 이렇게 해서 6장의 동영상 썸네일을 뽑아보기

 

$destination = 'video.avi'; 
$movie = new ffmpeg_movie($destination);
$total_frames = $movie->getFrameCount();
$per_frame = round($total_frames / 6);
$start_frame = $per_frame / 2;
$count = 0;
for ($i = $start_frame; $i < $total_frames; $i = $i + $per_frame) {
if ($count > 5) {
break;
}
$frame = $movie->getFrame($i);
if ($frame) {
$frame->resize(400, 300);
$GDimage = $frame->toGDImage();
$filename = sprintf("%04d", $count) . '.png';
imagepng($GDimage, $filename);
$count++;
}
}

 

     
     

 

 

 

 

 

 

 

2008/10/09 21:53 2008/10/09 21:53
juniac
개발 2008/10/09 21:53

트랙백 주소 : http://juniac.net/trackback/170

댓글을 달아 주세요

[로그인][오픈아이디란?]

Powerd by Textcube, designed by criuce