※ 본글은 Windows 10 64bit에서 MSYS 1.0, MinGW 32bit를 이용한 ffmpeg 3.0.1 버전을 32bit build 과정을 다룹니다. 

( 2016-04-22 )


※ build 결과를 이용해서 IP카메라에서 H.264로 streaming 되는 것을 정상적으로 decoding 및 display하는 것 까지 확인.

가지고 있는 영상처리 모듈 중에 가장 부하가 큰 것이 32bit OpenCV로 되어 있어서 ffmpeg 32bit 도 build 해보기로 함.



1. https://sourceforge.net/projects/mingwbuilds/files/external-binary-packages/ 에 가서 MSYS 다운받고 D:\msys_x86에 압축 해제


2. https://sourceforge.net/projects/mingw-w64/ 에 가서 mingw-w64-install.exe 다운받고 실행


3. next 선택




4. Setting - 여기서는 선택이 갈림. 일단 32bit가 목적이니 일단 Architecture는 i686을 선택하고


1) Thread를 posix 로 선택하는 경우


2) thread를 win32로 선택하는 경우



2가지 경우는 다음과정에서 configure 과정과 결과물 사용 과정이 다름.

posix를 선택하는 경우에는 DLL 사용 시점에 " libwinpthread-1.dll "이라는 파일을 필요로함. 아직까지 그 부분을 회피하는 방법은 모름.


5. next를 막 눌러서 설치를 끝냄.


6. 방금 설치한 MinGW를 MSYS하위 경로로 복사.(windows에 환경변수를 등록하고 써도 되겠지만.)

- 위 과정대로 설치했다면 C:\Program Files (x86)\mingw-w64 경로에

"i686-5.3.0-posix-dwarf-rt_v4-rev0" 또는 "i686-5.3.0-win32-dwarf-rt_v4-rev0" 라는 폴더가 있을 것임. 

그 폴더 하위에 있는 "mingw32"라는 폴더를 MSYS에 복사.

ex) " D:\msys_x86\mingw32  " 이런 식으로



7.  yasm 설치

http://yasm.tortall.net/Download.html 에 가서 win32.exe 링크를 눌러서 다운로드.

실제로는 "yasm-1.3.0-win32.exe" 이름으로 다운로드 됨.

이름을 "yasm.exe"로 바꿔주고 mingw의 bin 폴더에 복사

ex) D:\msys_x86\mingw32\bin 에 yasm.exe로 복사


8. msys 실행

- msys.bat 실행


9. 터미널에서 PATH 추가

-터미널에서 다음과 같이 입력

echo 'export PATH=.:/local/bin:/bin:/mingw32/bin' > .profile

echo 'git config --global core.autocrlf false' >> .profile

source .profile


10. ffmpeg 소스를 다운로드

- ffmpeg 소스를 다운로드해서 D:\msys_86\home 아래에 설치하자


https://www.ffmpeg.org/download.html

최신 소스를 쓸려면 git으로 받고(좌측 상단), Release버전을 사용할려면 하단 Release 부분에 있는 Release 압축 파일을 다운받아서 사용


11. ffmpeg 경로로 가서 configure 진행.  (아래 예시는 LPGL 3.0 사용, 외부 라이브러리 없음)


11-1)  MinGW 설치시 thread를 posix로 선택한 경우

./configure --arch=x86 --enable-stripping --disable-w32threads --enable-memalign-hack --disable-static --enable-shared --enable-version3 --disable-doc --extra-ldflags=" -static-libgcc -static-libstdc++ "


11-2)  MinGW 설치시 thread를 win32로 선택한 경우

./configure --arch=x86 --enable-stripping --enable-memalign-hack --disable-static --enable-shared --enable-version3 --disable-doc --extra-ldflags=" -static-libgcc -static-libstdc++ "


12. make


13. DLL 사용 시

13-1)  MinGW 설치시 thread를 posix로 선택한 경우

ex) D:\msys_x86\mingw32\bin 에 있는 "libwinpthread-1.dll "라는 파일을 ffmpeg DLL이 있는 경로에 복사해서 사용.


13-2)  MinGW 설치시 thread를 win32로 선택한 경우

그냥 원래 처럼 DLL 사용



끗.


<출처 - 본인>



'ffmpeg' 카테고리의 다른 글

libmingwex 관련 내용  (0) 2016.05.12
ffmpeg 64bit windows build. (MSYS 1.0, MinGW-w64 사용)  (0) 2016.04.21
Posted by 아..몰라 ㅡ.ㅡ+
,