| ffmpeg를 윈도우에서 쓰기 위해서는 소스를 직접 가져와서 컴파일을 해서 써야한다. 그런데 문제는 ffmpeg가 윈도우에서 컴파일을 하기 쉽게 구성되어있지 않은 점이다.
또한 ffmpeg 개발 팀 또한 윈도우에서 컴파일 하기 위해 가장 쉬운 방법인 visual studio를 지원하지 않으며 앞으로 지원할 계획도 없다고 4가지 없게 딱 잘라 말하고 있다.
그럼 어떻게 하면 윈도우에서 ffmpeg를 사용할 수 있느냐.....
다행이도 외국 횽아들이 미리 윈도우용으로 컴파일된 바이너리를 제공해주고 있다. ffmpeg 공식사이트에서도 윈도우용 바이너리를 구하려면 아래 사이트로 가라고 하고 있다.
여기가면 윈도우용으로 빌드된 바이너리를 구할 수 있으며 어떤 라이브러리들이 추가로 포함되어있는지 알 수 있다. 친절하게 64비트용까지 제공하고 있으니 참으로 감사하다.
하지만 나같이 누가 주는 떡 넙죽 받아먹기 보다는 직접 만들어보기 위한 사람들을 위해 내가 현재 사용하고 있는 ffmpeg 빌드 환경과 옵션을 공개하고자 한다.
일단 환경은 아래와 같다.
OS : Fedora 15 32bit Cross-compiler : mingw
cygwin이니 윈도우용 mingw도 있지만 ffmpeg 자체만 컴파일 한다면 무리 없이 되긴한다. 하지만 추가적으로 외부 라이브러리를 포함해서 컴파일을 하고자 한다면 윈도우에서 컴파일이 잘 안된다.
그냥 리눅스에서 윈도우용으로 크로스컴파일 하기를 추천한다.
리눅스를 깔 컴퓨터가 없다고? 요즘 vmware와 같은 가상화 솔루션이 많다. 어둠의 경로로도 많이 있으니 재주껏 설치하면 편하게 할 수 있다.
리눅스를 설치 했으면 크로스컴파일을 위한 mingw32를 설치해야한다. yum이나 apt로 재주껏 설치하면 된다.
아래는 ffmpeg와 기타 외부 라이브러리 컴파일 방법이다.
common ./configure --enable-static --disable-shared --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/sys-root/mingw
frei0r ./configure --prefix=/usr/i686-pc-mingw32/sys-root/mingw
bzip2 make AR=i686-pc-mingw32-ar CC=i686-pc-mingw32-gcc RANLIB=i686-pc-mingw32-ranlib make PREFIX=/usr/i686-pc-mingw32/sys-root/mingw install
rtmp make SYS=mingw SHARED= CROSS_COMPILE=i686-pc-mingw32- INC=-I/usr/i686-pc-mingw32/sys-root/mingw/include make prefix=/usr/i686-pc-mingw32/sys-root/mingw install 설치후 에러메시지는 무시
openssl export AR=i686-pc-mingw32-ar; export CC=i686-pc-mingw32-gcc; export SYSTEM=MINGW32; ./config --prefix=/usr/i686-pc-mingw32/sys-root/mingw
libvpx CROSS=i686-pc-mingw32- ./configure --target=x86-win32-gcc --prefix=/usr/i686-pc-mingw32/sys-root/mingw
x264 ./configure --enable-static --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/sys-root/mingw --cross-prefix=i686-pc-mingw32-
xavs ./configure --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/sys-root/mingw --cross-prefix=i686-pc-mingw32-
xvid ./configure --host=i686-pc-mingw32 --prefix=/usr/i686-pc-mingw32/sys-root/mingw make 후 설치 된 곳에서 아래 실행 rm xvidcore.dll mv xvidcore.a libxvidcore.a
ffmpeg ./configure --prefix=/home/chadr/ffmpeg-cross/build --enable-postproc --cpu=i686 --disable-static --enable-shared --enable-gpl --enable-version3 --enable-runtime-cpudetect --enable-memalign-hack --enable-libvo-amrwbenc --enable-libvo-aacenc --enable-avisynth --enable-frei0r --enable-bzlib --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-libopenjpeg --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxavs --enable-libxvid --enable-zlib --enable-libcelt --enable-cross-compile --cross-prefix=i686-pc-mingw32- --target-os=mingw32 --arch=x86 --extra-cflags="-DENOTSUP=95 -DENOBUFS=105 -I/usr/i686-pc-mingw32/sys-root/mingw/include -I/usr/i686-pc-mingw32/sys-root/mingw/include/freetype2 -I/usr/i686-pc-mingw32/sys-root/mingw/include/SDL" --extra-ldflags="-L/usr/i686-pc-mingw32/sys-root/mingw/lib" --extra-libs="-lssl -lcrypto -lws2_32 -lwinmm -lgdi32 -lorc-0.4 -lSDL -lpthread" --pkg-config=pkg-config
위에 --prefix=/usr/i686-pc-mingw32/sys-root/mingw 와 같이 설치 위치는 리눅스 배포판마다 다를 수 있으므로 본인이 스스로 확인 해야한다.
common이라고 써진 것은 위에 언급된 라이브러리가 아닌 라이브러리의 경우 common에 명시된 옵션으로 컴파일 하면 된다.
ffmpeg의 prefix 또한 자신이 설치하고자 한 위치로 적절히 변경 시켜줘야한다.
이 글을 쓴 시각까지 ffmpeg의 최신 버전은 위 옵션으로 전부다 컴파일이 성공했으니 참고바란다.  ( 0)  ( 0) |
댓글을 달아 주세요