1. FFMPEG 란
- cross-platfom 미디어 솔루션
- 오픈 소스
- 녹화, 변조, 재생, 스트리밍 서버 가능
2. 사이트
3. 개발 환경 구축
빌드된 형태의 library를 제공 하지 않고, 소스 코드를 제공하고 있다.
4. 윈도우 환경 구축 하기 (visual studio)
1) FFMPEG Library 다운로드
ffmpeg\ffmpeg-20141012-git-20df026-win32-dev
D:.
├─doc
│ └─examples
├─include
│ ├─libavcodec
│ ├─libavdevice
│ ├─libavfilter
│ ├─libavformat
│ ├─libavutil
│ ├─libpostproc
│ ├─libswresample
│ └─libswscale
├─lib
└─licenses
ffmpeg-20141012-git-20df026-win32-shared
D:.
├─bin
├─doc
│ └─examples
├─licenses
└─presets
필요한 파일 폴더
~dev : /include , /lib
~shared : /bin
3개의 폴더를 다른 폴더에 복사 해서 사용합니다.
2) 해더 파일 추가
gcc 컴파일 경우 필요 없지만, visual studio 2013이전 버전일 경우 inttypes.h를 추가 해줘야 함.
VC++60.의 경우 stdint.h도 없으므로 헤더파일에 추가 해주어야 한다.
initypes.h가 없는 경우 소스코드를 수정합니다. (visual studio 헤더 파일폴더에 복사해도 무방합니다. )
/include/libavutil/common.h 소스를 에디터로 편집합니다.
#include <initypes.h> --> #include "inttypes.h"
3) Project 생성
visual studio에서 Console Application - 빈 프로젝트를 생성 합니다.
프로젝트 설정을 변경합니다.
- Character Set [Not Set]으로 변경
- include 디렉 토리 설정
- library 디렉토리 설정
- 출력 디렉토리 설정
* Releas에서 "1>avutil.lib(dkifbs00226.o) : error LNK2026: 모듈이 SAFESEH 이미지에 대해 안전하지 않습니다." 오류가 발생하는 경우
project property - Linker - commandLine - 텍스트 박스에 /safeseh:no 추가
Sample 코드
extern "C" { #include <libavformat/avformat.h> }
#pragma comment( lib, "avformat.lib" ) #pragma comment( lib, "avutil.lib" )
int main(void) { av_log(NULL, AV_LOG_INFO, "Hello FFMPEG \n" ); return 0; } |