0

I have got FFmpeg compiled using MSYS2. I have a strange issue that appeared only recently.the app crashes. This is my main file:

#include "mainwindow.h"
#include <QApplication>
#include <QDebug>

extern "C" {
#include <libavdevice/avdevice.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavcodec/avcodec.h>
}


int main(int argc, char *argv[])
{
   //qDebug() << av_version_info();
  // avdevice_register_all();
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

The program runs but crashes if I call 'avdevice_register_all()' and others FFmpeg functions,but only call 'av_version_info()' is runs, not crashes. I don't really know how to solve this?

I have already tried to use google solving the problem,but no result.

c47296
  • 1
  • 1
  • Start by running your code under a [debugger](https://ericlippert.com/2014/03/05/how-to-debug-small-programs/) to get the backtrace at the crash site. It may well be you have undefined behaviour in code not shown rather than it being anything to do with the `ffmpeg` libraries. – G.M. Nov 10 '22 at 10:48
  • Try using pre-built stable release as `ffmpeg-release-full-shared.7z` from [here](https://www.gyan.dev/ffmpeg/builds/#release-builds). Make sure the system path is set correctly to use the correct DLLs. In case it's working with the stable release and crashes with your built, you may use "bad build" of FFmpeg. The [following answer](https://stackoverflow.com/a/36359591/4926757) may also be relevant. – Rotem Nov 10 '22 at 21:34

0 Answers0