简体   繁体   中英

Qt C++ ffmpeg cannot find library

I use Qt 5.0.2 with Mingw 4.7 on windows.

I'm working on a c++ program and i'm trying to get the duration of video files. I found ffmpeg . Now i tried to compile a simple program but I think it fails with the libraries. I've tried to include both the shared and dev but they both will fail. ( Zeranoe FFmpeg builds )

This is my pro file:

TEMPLATE = app
CONFIG += console
CONFIG -= app_bundle
CONFIG -= qt

SOURCES += main.cpp

INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-shared\bin

LIBS += -LC:\programming\ffmpeg-20130606-git--win32-shared\bin -lavcodec-55.dll -     lavformat-55.dll -lavutil-52.dll

i get errors like:

":-1: error: cannot find -lavcodec-55.dll"

":-1: error: cannot find -lavformat-55.dll"

I've also tried:

INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include
INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\lib

LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -lavcodec -lavformat -lavutil

LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib -llibavcodec.dll.a -llibavformat.dll.a -llibavutil.dll.a

Here it gives a error "During startup program exited with code 0x0000135'

I even tried to include each library individually. But no results..

This is my main file:

#include <iostream>
using namespace std;
extern "C" {
  #include <libavcodec/avcodec.h>    // required headers
  #include <libavformat/avformat.h>
}
int main(int argc, char**argv) {
   av_register_all();             // offending library call
   return 0;
}

A program simple as this will have 2 outcomes:

  1. the program runs but crashes if i call 'av_register_all()'
  2. It just tells me he cannot find the libraries.

Can someone tell me what it is i'm doing wrong? Or even give me a hint? I can't really find a lot of good documentation on this one.

Thanks in advance!

Configure PRO-file as shown below:

INCLUDEPATH += C:\programming\ffmpeg-20130606-git--win32-dev\include

LIBS += -LC:\programming\ffmpeg-20130606-git--win32-dev\lib
LIBS += -lavcodec -lavformat -lavutil

Then, build the project, copy the all dll libraries from C:\\programming\\ffmpeg-20130606-git--win32-shared\\bin to exe output path and run application.

UPD

Maybe you need to copy some of the following libraries from Qt\\5.0.2\\mingw47_32\\bin\\ :

libgcc_s_sjlj-1.dll
libstdc++-6.dll
libwinpthread-1.dll

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM