2012-04-11 2 views
2

C++/Qt에서 Windows에서 ffmpeg 라이브러리를 사용하려고합니다. 이것은 내 주요 기능입니다 :C++/Qt FFmpeg 라이브러리 오류 : 프로그램이 예기치 않게 종료되었습니다.

#include <iostream> 
#include <stdio.h> 
#include <math.h> 
using namespace std; 

#define INT64_C(val) val##LL 
#define UINT64_C(val) val##ULL 
#include <QtCore> 


#include <SDL/SDL.h> 
#ifdef __MINGW32__ 
#undef main 
#endif 


//--------------- FFMPEG Headers and Libraries --------------- 
extern "C" 
{ 
#include <libavcodec/avcodec.h> 
#include <libavformat/avformat.h> 
#include <libswscale/swscale.h> 
} 

int main(int c, char *args[]) 
{ 
    av_register_all(); 
    AVFormatContext *ctx; 

    if(avformat_open_input(&ctx,"salam.avi",NULL,NULL)!=0) 
     return -1; 
    return 0; 
} 

& 링크가 잘 맞습니다. 하지만 실행하려고하면이 오류가 발생합니다.
프로그램이 예기치 않게 종료했습니다.
* avformat_open_input * 기능에서 발생합니다. 뭐가 문제 야? 그것은 내 코드에 관한 것입니까, 아니면 내 라이브러리에 문제입니까?
미리 감사드립니다.

답변

0

AVI에 문제가있을 수 있습니다. avi 파일이 FFMPEG에 의해 지원되는지 확인하십시오. use this tool 형식이 정확히 무엇인지 확인하고 형식이 지원되는지 여부를 확인하려면 FFMPEG 라이브러리 도움말/지원을 찾으십시오.

1

마침내 발견했습니다. 대답은 아주 간단합니다. ctx은 NULL로 초기화해야합니다.

AVFormatContext *ctx = NULL; 
관련 문제