Skip to content

Cent5 ffmpeg 설치

조회 수 17996 추천 수 0 2009.03.17 04:11:57
. Create a directory to do our work in

mkdir ~/ffmpeg

cd ~/ffmpeg


2. Get all the source files

wget http://www3.mplayerhq.hu/MPlayer/releases/codecs/essential-20061022.tar.bz2

wget http://rubyforge.org/frs/download.php/9225/flvtool2_1.0.5_rc6.tgz

wget http://easynews.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz

wget http://superb-west.dl.sourceforge.net/sourceforge/ffmpeg-php/ffmpeg-php-0.5.0.tbz2

wget http://downloads.xiph.org/releases/ogg/libogg-1.1.3.tar.gz

wget http://downloads.xiph.org/releases/vorbis/libvorbis-1.1.2.tar.gz


3. Extract all the source files

bunzip2 essential-20061022.tar.bz2

tar xvf essential-20061022.tar

tar zxvf flvtool2_1.0.5_rc6.tgz

tar zxvf lame-3.97.tar.gz

bunzip2 ffmpeg-php-0.5.0.tbz2

tar xvf ffmpeg-php-0.5.0.tar

tar zxvf libogg-1.1.3.tar.gz

tar zxvf libvorbis-1.1.2.tar.gz

 

 

4. Create the codecs directory & import them

mkdir /usr/local/lib/codecs/

mv essential-20061022/* /usr/local/lib/codecs/

chmod -R 755 /usr/local/lib/codecs/

 

5. Install SVN/Ruby (Depends on OS, this is for RHEL/CentOS)

yum install subversion*  <-- 수정

yum install ruby

yum install ncurses-devel*  <-- 안나와서 수정

 

6. Get the latest FFMPEG/MPlayer from the subversion

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg

svn checkout svn://svn.mplayerhq.hu/mplayer/trunk mplayer


 ** ffmpeg 버전의 문제로 make 오류가 발생하는 경우가 있다.    이런 경우 ffmpeg 버전을 지정하여 다운로드 하는 방법이 있다.

svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk/ ffmpeg -r15261

7. Compile LAME

cd ~/ffmpeg/lame-3.97

./configure

make

make install

 

rpm -q libogg

#rpm 설치 파일이 존재 아래 설치하지 않음

8. Compile libOGG <-- 2차대 진행했음.

cd ~/ffmpeg/libogg-1.1.3

./configure

make

make install

 

rpm - q libvorbis

#rpm 설치 파일이 존재 아래 설치하지 않음

9. Compile libVorbis <-- 2차때 했음.

cd ~/ffmpeg/libvorbis-1.1.2

./configure

make

make install

 

10. Compile flvtool2

cd ~/ffmpeg/flvtool2_1.0.5_rc6

ruby setup.rb config

ruby setup.rb setup

ruby setup.rb install

 

 

11. Compile MPlayer

cd ~/ffmpeg/mplayer

./configure

make

make install

 

vi /etc/ld.so.conf

/usr/local/lib # 없으면 추가

ldconfig # 추가 했다면 실행

 

12. Compile FFMPEG

cd ~/ffmpeg/ffmpeg

./configure --enable-libmp3lame --enable-libogg --enable-libvorbis --disable-mmx --enable-shared
 <--
--enable-libogg 는 빼고 할것. 넣고 하면 에러

 

ㅤㅃㅒㅤ고 하면 이렇게 되겠지.
./configure --enable-libmp3lame --enable-libvorbis --disable-mmx --enable-shared

참고 : 107번 서버에서는 에러 발생
 /tmp
파일에 퍼미션 어쩌고 그러면 configure 파일 열고 /tmp 의 경로를 /tmp2 로 바꾸고 퍼미션 777로 하고 삭제 할것
cd /  (
서버 루트로 이동후 )
mkdir tmp2  (tmp2
라는 폴더를 새로 만들고)

hmod 777 tmp2  (퍼미션을 777 로 주고 모든 작업 끝난후 본 폴더는 지워주자)

echo '#define HAVE_LRINTF 1' >> config.h

make

make install

 

13. Finalize the codec setups

ln -s /usr/local/lib/libavformat.so.50 /usr/lib/libavformat.so.50     #파일이 없어서 실행 안함 ㅡㅡ? 해열은 잘됨. 107 성공

ln -s /usr/local/lib/libavcodec.so.51 /usr/lib/libavcodec.so.51

ln -s /usr/local/lib/libavutil.so.49 /usr/lib/libavutil.so.49

ln -s /usr/local/lib/libmp3lame.so.0 /usr/lib/libmp3lame.so.0

ln -s /usr/local/lib/libavformat.so.51 /usr/lib/libavformat.so.51
  
위 심볼릭 링크 작업 중 안되는거 있음 걍 무시하고 지나 가 보고 최종 적으로 설치 안되면 다시 검토 해 보자.

 

14. Compile FFMPEG-PHP

cd ~/ffmpeg/ ffmpeg-php-0.5.0

phpize # phpize 가 없다면 옆에 실행 => yum install php-devel.i386

This allowed ffmpeg-php to configure

./configure

위 실행시 아래와 같은 문제 발생할 경우

checking for ffmpeg headers... configure: error: ffmpeg headers not found. Make sure you've built ffmpeg as shared libs using the --enable-shared option

(107서버에서 )
위와 같은 에러발생해결책
:
 
참조문서:
http://groups.google.com/group/ffmpeg-php/browse_thread/thread/7902bd06430ad75c

ffmpeg폴더의 ffmpeg 폴더 아래에서 아래 파일을 찾아서 아래 경로로 복사해준다.
cd /ffmpeg/ffmpeg/


/usr/local/include/ffmpeg/avcodec.h

/usr/local/include/ffmpeg/avformat.h

/usr/local/include/ffmpeg/avio.h

 

make

make install

 

 

15. Install FFMPEG-PHP (make sure the php.ini path is correct.)

echo 'extension=/usr/local/lib/php/extensions/ no-debug-non-zts-20020429/ffmpeg.so' >> /usr/local/Zend/etc/php.ini

-- 주의 무작정 위에 껄 따라 하면 낭패 봄.
/etc/php.ini
파일에서 extension_dir 을 찾아서 예를 들면 107번 같은 경우는

   extension_dir = "/usr/lib/php/modules"

이렇게 되어 있음. 그러면 /usr/lib/php/modules ffmpeg.so 파일이 있을것임.

확인하고 아래 실행.

echo 'extension=ffmpeg.so' >> /usr/local/Zend/etc/php.ini

 
** /usr/local/Zend/etc/php.ini 파일에서 extension_dir = "./" 로 되 있다..
==> /usr/local/php/lib/php/extensions 디렉토리를 참조하여 extension 모듈을 찾는다..
** /usr/local/php/lib/php/extensions  디렉토리에 ffmpeg.so 파일을 copy 만 해 주니 모든것이 해결이 되었다.
 

16. Restart Apache to load FFMPEG-PHP (Depends on OS, this is for RHEL/CentOS)

service httpd restart

 

17. Verify if it works

php -r 'phpinfo();' | grep ffmpeg

 

If you get a few lines such as

ffmpeg

ffmpeg support (ffmpeg-php) => enabled

ffmpeg-php version => 0.5.0

ffmpeg.allow_persistent => 0 => 0

 

# 위와 같이 보이면 성공

 

Then everything is installed and working. FFMPEG, FFMPEG-PHP, MPlayer, MEncoder, flv2tool, LAME MP3 encoder & libOGG.

 

# 17번에서 Error:cannot restore segment prot after reloc: Permission denied 이런 메세지가 있으면..

vi /etc/sysconfig/selinux

SELINUX=enforcing

 

위와 같은 설정이 있다면 위부분을

SELINUX=disabled 로 변경

시스템 부팅 selinux가 커널쪽에 무슨 설정이 있다고 합니다 그래서 리붓

 

차후 확인 php -r 'phpinfo();' | grep ffmpeg 정상적으로 보임



****************************************************
[root@ns1 ffmpeg-php-0.5.0]# /usr/local/php/bin/php -v
PHP 5.1.6 (cli) (built: Mar 20 2007 18:10:32)
Copyright (c) 1997-2006 The PHP Group
Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
    with Zend Extension Manager v1.0.9, Copyright (c) 2003-2006, by Zend Technologies
    with Zend Optimizer v2.6.2, Copyright (c) 1998-2006, by Zend Technologies
/usr/local/php/bin/php: symbol lookup error: /usr/local/php/lib/php/extensions/no-debug-zts-20050922/ffmpeg.so: undefined symbol: av_free_static



=>[root@ns1 ffmpeg-php-0.5.0]# pwd
/usr/local/src/ffmpeg/ffmpeg-php-0.5.0
[root@ns1 ffmpeg-php-0.5.0]# pwd
[root@ns1 ffmpeg-php-0.5.0]# vi ffmpeg-php.c



/* {{{ php module shutdown function
 */
PHP_MSHUTDOWN_FUNCTION(ffmpeg)
{
   //av_free_static();

     // TODO: Free any remaining persistent movies here?

    UNREGISTER_INI_ENTRIES();

    return SUCCESS;
}
/* }}} */

This is a common error when we issue a “php -v” over command line or when we browse a phpinfo.php on a site.

To quickly fix this problem you will need to recompile your ffmpeg-php again.

How we fix this?

1)

  1. #cd %ffmpeg-php-DIR%
  2. #vi ffmpeg-php.c

remove/comment the call to av_free_static()

save.

2)

rebuild ffmpeg-php and place the new ffmpeg.so on your extension directory.

profile

일요일은 짜빠게뤼~ 먹는날~^^

엮인글 :
http://adminplay.com/1334/843/trackback
List of Articles
번호 제목 글쓴이 날짜 조회 수

데몬 및 프로세스 관리

시스템 백업과 응급 복구

Ascii Art관련 사이트 링크

퍼미션 설정

Linux 파일 오픈 갯수 확인

Centos5 버전에서 메모리 인식 file

MRTG 로그 데이터 시간확인하기

리눅스 java tocmat 설치

ssh, ftp 접근 딜레이 현상 발생시 조치방법

관리, 개발자를 위한 vi 환경 설정 ( vim-enhanced)

time.bora.net 시간 동기화후 dovecot 데몬이 죽는 현상 해결

리눅스 페도라 인터넷잡는것좀 알켜주세요^^; [1]

  • 시풍
  • 2009-04-07
  • 조회 수 20670

.vimrc 설정 설정, 색상 (VI 설정 색상)

사이트 이전시 - rsync

dumpe2fs 파일 시스템의 슈퍼 블럭과 블럭 그룹 정보를 출력

rm -rf / ==> 그 결과는...ㄷㄷ;;

Cent5 ffmpeg 설치

리눅스 TIP

특정 디랙토리 인증걸기 htpasswd, htaccess

netstat 의 Send-Q, Recv-Q의 의미

Copyright ADMINPLAY corp. All rights reserved.

abcXYZ, 세종대왕,1234

abcXYZ, 세종대왕,1234