【全編】ffmpegのインストール(3gp→FLV変換可能)
先日の記事の書き直しです。
おかしいとか、できなーいってとこがあったら教えてください。
てなわけで、ffmpegのインストールを始めます。
今回はここを参考にします。
ただ、設定ファイル等を直さなきゃいけないところがでてきたので、そこを書こうと思う。
参考
謝謝
ffmpeg と mencoder のインストール (まとめ) | dTblog | design and programming
http://www.deftrash.com/blog/archives/2005/05/ffmpeg_mencoder.html
連絡拒否 - CentOS ffmpeg 3gp flv
http://d.hatena.ne.jp/winty/20070327/1174978142
[ロ] CentOS4.4 + ffmpeg でflv から 3gp に変換する(後編) - LOWTECH.NE.JP Weblog
http://yosiwo.lowtech.ne.jp/index.php?itemid=569
必要な物
- lame-3.97.tar.gz
- ffmpeg-0.4.9-pre1.tar.gz ※2007/9/18現在のSVNバージョンはconfigureが通らないので0.4.9を使います。
- 26104-610.zip (amrwb_float用)
- 26204-600.zip (amr_float用)
- 26073-600.zip (amr用)
- faad2-15092004.tar.gz
- faac-18102004.tar.gz
- a52dec-0.7.4.tar.gz
- エラーに負けない心
(1)lameのインストール
cd wget http://nchc.dl.sourceforge.net/sourceforge/lame/lame-3.97.tar.gz tar xvzf lame-3.97.tar.gz cd lame-3.97 ./configure make make install
(2)ffmpeg本体
cd #ダウンロードリンクはここから探してください。 #http://miyagi.ddo.jp/camera_setting/camera_setting.html wget 上から探したURL tar xvzf ffmpeg-0.4.9-pre1.tar.gz cd ffmpeg-0.4.9-pre1/
(3)コーデック関係
mkdir libavcodec/amr_float cd libavcodec/amr_float wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip unzip 26104-610.zip unzip 26104-610_ANSI_C_source_code.zip mv c-code/* ./ cd ../ # libavcodec/にもどる mkdir libavcodec/amrwb_float cd libavcodec/amrwb_float wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip unzip 26204-600.zip unzip 26204-600_ANSI-C_source_code.zip mv c-code/* ./ cd ../ # libavcodec/にもどる mkdir libavcodec/amr cd libavcodec/amr wget http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-600.zip unzip 26073-600.zip unzip 26073-600_ANSI_C_source_code.zip mv c-code/* ./
(4) libavcodec/amr/makefileの修正
vi makefile # CFLAGS = -Wall -pedantic-errors -I. $(CFLAGS_$(MODE)) -D$(VAD) ←コメントアウト CFLAGS = -Wall -I. $(CFLAGS_$(MODE)) -D$(VAD) -DMMS_IO ←追記する 保存する
(5)liba52のインストール
動画ストリームがMPEG-2、音声ストリームがAC3という"DVDレコーダで生成した典型的なMPEG-2ムービー"をPSP仕様に変換可能になる
wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz tar xvfz a52dec-0.7.4.tar.gz cd a52dec-0.7.4 ./configure make make install
(6)faad2のインストール
mkdir faad2 wget http://yosiwo.lowtech.ne.jp/app/faad2-15092004.tar.gz tar xvfz faad2-15092004.tar.gz 下記の2つ(3つ目はやってもらやらなくても大丈夫です。たぶん)のエラー対策をする。 sh bootstrap ./configure make make install
- configure.inの変更
bootstrapで下記のようなエラーが出てしまいます。
sh bootstrap
configure.in:65: warning: underquoted definition of MY_CHECK_TYPEDEF_FROM_INCLUDE
run info '(automake)Extending aclocal'
or see http://sources.redhat.com/automake/automake.html#Extending-aclocal
# automakeのバグなので以下のように修正。 vi configure.in 65行目:AC_DEFUN(MY_CHECK_TYPEDEF_FROM_INCLUDE, ←変換前 65行目:AC_DEFUN([MY_CHECK_TYPEDEF_FROM_INCLUDE], ←変換後
- mp4ffint.hの変更
makeでエラーが出てしまいます。
mp4ff.c:104: error: static declaration of ‘mp4ff_track_add’ follows non-static declaration
mp4ffint.h:348: error: previous declaration of ‘mp4ff_track_add’ was here
# 以下のように修正。 vi common/mp4ff/mp4ffint.h 348行 : void mp4ff_track_add(mp4ff_t *f); 348行 : static void mp4ff_track_add(mp4ff_t *f);
- 改行コード問題
makeで「警告: ファイル末尾に改行がありません」
そのファイルの最後を改行して保存すると警告が消えます。
ちゃんと直す気なら改行コードが間違っているので改行コードを「CR+LF」から「LF」に変換させる。
(7)faacのインストール
wget http://yosiwo.lowtech.ne.jp/app/faac-18102004.tar.gz tar xvfz faac-18102004.tar.gz # 下記のエラー対策をする。 sh bootstrap ./configure make make install
- configure.inの変更
sh bootstrap
configure.in:10: warning: underquoted definition of MY_DEFINE
run info '(automake)Extending aclocal'
10行目:AC_DEFUN(MY_DEFINE, [ AC_DEFINE($1, 1, [define if needed]) ]) 10行目:AC_DEFUN([MY_DEFINE], [ AC_DEFINE($1, 1, [define if needed]) ])
(8)/usr/local/libを呼び出せるようにする
faacをいれるとこのようなことを言われます。
- -
Libraries have been installed in:
/usr/local/libIf you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,--rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
- -
/etc/ld.so.confに/usr/local/libを追加しろといってます。
なので、いわれた通りにやりましょう。
vi /etc/ld.so.conf /usr/local/lib ←追加し、保存 ldconf -n (これでリスト更新…なはず。違うかも!!エロい人教えて!)
(9)待ちに待ったffmpegのインストール
makeは性能があまりよくないPCだと結構時間かかります。
./configure --enable-amr_nb --enable-amr_wb --enable-amr_nb-fixed --enable-mp3lame --enable-faad --enable-faac --enable-a52 --enable-gpl make make install
(11)完成
どつかれさんでした。