티스토리 뷰

OS/Windows

ffmpeg 컴파일 - 1

파란크리스마스 2019. 2. 2. 13:20
728x90

출처

msys 실행

D:\MinGW\msys\1.0\msys.bat

msys 실행

nasm 설치

http://www.nasm.us/pub/nasm/releasebuilds/ 사이트에서 파일 nasm.exe와 ndisasm.exe를 C:\MinGW\msys\1.0\bin 으로 복사

yasm 설치

http://yasm.tortall.net/Download.html 사이트에서 파일 yasm-1.3.0-win32.exe을 다운로드 받아서 yasm.exe로 변경하여 경로에 C:\MinGW\msys\1.0\bin 복사

pr.exe 설치 (설치 불필요)

FFMpeg 컴파일할 때, pr이 없어서 컴파일 에러가 떨어진다.

https://sourceforge.net/projects/mingw/files/MSYS/Base/msys-core/_obsolete/coreutils-5.97-MSYS-1.0.11-2/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2/download 압축 해제하고, /bin 폴더에 있는 pr.exe를 C:\MinGW\bin에 복사한다.

zlib 설치

$ git clone https://github.com/madler/zlib.git
$ cd zlib
$ make -f win32/Makefile.gcc
$ export "INCLUDE_PATH=/mingw/include"
$ export "LIBRARY_PATH=/mingw/lib"
$ export "BINARY_PATH=/mingw/bin"
$ make install -f win32/Makefile.gcc
if [ "0" = "1" ]; then \
                mkdir -p '/mingw/bin'; \
                cp -fp zlib1.dll '/mingw/bin'; \
                cp -fp libz.dll.a '/mingw/lib'; \
        fi
cp -fp zlib.h '/mingw/include'
cp -fp zconf.h '/mingw/include'
cp -fp libz.a '/mingw/lib'
sed \
                -e 's|@prefix@|/usr/local|g' \
                -e 's|@exec_prefix@|/usr/local|g' \
                -e 's|@libdir@|/mingw/lib|g' \
                -e 's|@sharedlibdir@|/mingw/lib|g' \
                -e 's|@includedir@|/mingw/include|g' \
                -e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
                zlib.pc.in > '/mingw/lib'/pkgconfig/zlib.pc

libiconv (libiconv-1.15) 설치

$ wget https://ftp.gnu.org/gnu/libiconv/libiconv-1.15.tar.gz
$ tar xvf libiconv-1.15.tar.gz
$ cd libiconv-1.15
$ ./configure --prefix=/mingw
$ make; make install

gettext (gettext-0.18.1.1) 설치

$ https://ftp.gnu.org/gnu/gettext/gettext-0.18.1.1.tar.gz
$ tar xvf gettext-0.18.1.1.tar.gz
$ cd gettext-0.18.1.1
$ ./configure --prefix=/mingw --disable-shared -with-libiconv-prefix=/mingw --enable-threads=win32 --enable-relocatable
$ make; make install

glib 설치

$ wget --no-check-certificate https://ftp.gnome.org/pub/gnome/sources/glib/2.28/glib-2.28.8.tar.xz
$ tar xvf glib-2.28.8.tar.xz
$ cd glib-2.28.8
$ ./configure --prefix=/mingw
$ make
$ make install

pkg-config 설치

$ tar xvf pkg-config-0.25.tar.gz
$ cd pkg-config-0.25
$ ./configure --prefix=/mingw
$ make
$ make install

x264 설치

$ git clone http://git.videolan.org/git/x264.git
$ cd x264
$ export PATH=$PATH:/mingw/mingw32/i686-w64-mingw32/bin
$ ./configure --prefix=/mingw --enable-shared --enable-static
platform:      X86
byte order:    little-endian
system:        WINDOWS
cli:           no
libx264:       internal
shared:        yes
static:        yes
asm:           yes
interlaced:    yes
avs:           no
lavf:          no
ffms:          no
mp4:           no
gpl:           yes
thread:        win32
opencl:        yes
filters:       crop select_every
lto:           no
debug:         no
gprof:         no
strip:         no
PIC:           no
bit depth:     all
chroma format: all
 
You can run 'make' or 'make fprofiled' now.
 
$ make
$ make install
install -d /mingw/bin
install x264.exe /mingw/bin
install -d /mingw/include /mingw/lib/pkgconfig
install -m 644 ./x264.h x264_config.h /mingw/include
install -m 644 x264.pc /mingw/lib/pkgconfig
install -d /mingw/lib
install -d /mingw/bin
install -m 755 libx264-157.dll /mingw/bin
install -m 644 libx264.dll.a /mingw/lib
install -d /mingw/lib
install -m 644 libx264.a /mingw/lib
ranlib /mingw/lib/libx264.a

faac 설치

$ curl -#LO https://github.com/knik0/faac/archive/1_29_9_2.tar.gz
$ tar xzvf 1_29_9_2.tar.gz
$ cd faac-1_29_9_2
$ autoreconf -i
$ ./configure --prefix=/mingw --enable-shared --enable-static
$ make
$ make install

libpng설치

$ git clone https://github.com/glennrp/libpng.git
$ cd libpng/
$ cmake -DCMAKE_C_COMPILER=gcc -DCMAKE_ASM_COMPILER=gcc -DCMAKE_INSTALL_PREFIX=/mingw -G "MSYS Makefiles" .
$ cp scripts/pnglibconf.h.prebuilt pnglibconf.h
$ make -f scripts/makefile.gcc
$ cp png.h pngconf.h pnglibconf.h /mingw/include
$ cp libpng-config /mingw/bin

libfreetype 설치

$ git clone https://github.com/ricardoquesada/libfreetype.git
$ cd libfreetype
$ export "CFLAGS=-I/usr/local/include"
$ export "LDFLAGS=-L/usr/local/lib"
$ sh autogen.sh
$ ./configure --enable-shared --enable-static
$ make
$ make install

libfreetype2 설치

$ git clone git://git.sv.nongnu.org/freetype/freetype2.git
$ cd freetype2
$ sh autogen.sh
$ export "CFLAGS=-I/usr/local/include"
$ export "LDFLAGS=-L/usr/local/lib"
$ ./configure --prefix=/mingw
$ make
$ make install

fribidi 설치

$ curl -#LO https://ftp.osuosl.org/pub/blfs/conglomeration/fribidi/fribidi-0.19.7.tar.bz2
$ tar xvf fribidi-0.19.7.tar.bz2
$ cd fribidi-0.19.7
$ ./configure --prefix=/mingw --enable-shared --enable-static
$ make -C charset
$ make -C charset install
$ make -C lib
$ make -C lib install
$ cp fribidi.pc /mingw/lib/pkgconfig

libass 설치

$ git clone https://github.com/libass/libass.git
$ cd libass
$ autoreconf -iv
$ export "CFLAGS=-I/usr/local/include -I/mingw/mingw32/i686-w64-mingw32/include"
$ export "LDFLAGS=-L/usr/local/lib"
$ ./configure --prefix=/mingw 
$ make
$ make install

ffmpeg 설치

ffmpeg 컴파일 성공은 했지만, 너무 많은 라이브러리의 컴파일과 삭제를 많이 해서 위에 정리 내용이 일부 부정확할 수가 있습니다.

$ git config --global core.autocrlf false
$ git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
$ cd ffmpeg
$ PKG_CONFIG_PATH="/usr/local/lib/pkgconfig/"
$ ./configure --prefix=/usr/local --enable-gpl --enable-libx264 --enable-libfreetype --enable-libfribidi --enable-libass --enable-nonfree
$ make
$ ./ffmpeg -version
ffmpeg version N-93332-g0321370601 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7.3.0 (Rev2, Built by MSYS2 project)
configuration: --prefix=/usr/local --enable-gpl --enable-libx264 --enable-libfreetype --enable-libfribidi --enable-libass --enable-nonfree
libavutil      56. 26.100 / 56. 26.100
libavcodec     58. 47.103 / 58. 47.103
libavformat    58. 26.101 / 58. 26.101
libavdevice    58.  6.101 / 58.  6.101
libavfilter     7. 48.100 /  7. 48.100
libswscale      5.  4.100 /  5.  4.100
libswresample   3.  4.100 /  3.  4.100
libpostproc    55.  4.100 / 55.  4.100
댓글
300x250
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
«   2024/04   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30
글 보관함