2012-04-11 9 views
2

Ich versuche, ffmpeg Bibliothek unter Windows in C++/Qt zu verwenden. Das ist meine Hauptfunktion:C++/Qt FFmpeg Bibliothek Fehler: Programm ist unerwartet beendet

#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; 
} 

Es & verknüpft fein zusammengestellt wird. Aber ich bekomme diesen Fehler, wenn ich versuche, es auszuführen:
Das Programm wurde unerwartet beendet
Dies geschieht auf * avformat_open_input * -Funktion. Was ist das Problem? Geht es um meinen Code oder um ein Problem mit meinen Bibliotheken?
Vielen Dank im Voraus

Antwort

0

Könnte ein Problem mit dem AVI sein. Stellen Sie sicher, dass Ihr Avi von FFMPEG unterstützt wird. use this tool Um zu überprüfen, was genau das Format ist und suchen Sie die FFMPEG-Bibliothek Hilfe/Unterstützung, um zu sehen, ob das Format unterstützt wird oder nicht.

1

Endlich habe ich es gefunden. Die Antwort ist so einfach. ctx sollte mit NULL initialisiert werden.

AVFormatContext *ctx = NULL; 
Verwandte Themen