I am trying to include ffmpeg in my qt project in windows. I am running QT4 and compiling with microsoft visual compiler 2010 on 32-bit Windows 7. I am trying to enable ffmpeg 2.8 which got dev and shared is loading from zeranoe . When I run it, I get the following output:
Starting (executable path)... The program has unexpectedly finished. (executable path) exited with code -1073741819
I can create this output with the following:
ffmpeg_test.pro:
QT += core TARGET = ffmpeg_test INCLUDEPATH += (ffmpeg dev path)/include LIBS += -L(ffmpeg dev path)/lib LIBS += -lavformat SOURCES += main.cpp
main.cpp:
extern "C" { #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif #include <libavformat/avformat.h> } int main(int argc, char *argv[]) { av_register_all(); return 0; }
I put the .dll files from bin ffmpeg in the same folder where QT creates the ffmpeg_test.exe file. I also confirmed that they were found using a dependent walker that shows a question mark when they are not in this directory, and the path to the avformat-56.dll file when they are (the fact that the .dll files are found does not affect program result).
The dependency approach shows that something strange is happening because there are no expected functions, but the functions found in the avformat-56.dll file look correct. I also ran Dumpbin.exe / EXPORTS on avformat.lib and it also looks great (I can post the output if that would be useful). It is worth noting that I included this version of ffmpeg in another application on this machine, but it was not a qt project. This project generated its make file using CMake, not QMake, and was created with Microsoft Visual C ++ 2010, and not with QT Creator.
I also included other .lib / .dll pairs in qt and they have no problem. I notice two differences from these pairs. First, in the ffmpeg-dev lib folder, instead of having only .lib files (as with all other .lib / .dll pairs). I also have a .def and .dll.a file for each library. The second ffmpeg is a c-library, while all my other included libraries are C ++.
update 3/29 :
I tried replacing the LIBS lines in my .pro with two of the following:
LIBS += (ffmpeg dev path)/lib/avformat.lib
LIBS += (ffmpeg dev path)/lib/libavformat.dll.a
Both indicate the same error message. I also tried adding the following to my .pro file also without effect.
DEFINES += __STDC_CONSTANT_MACROS QMAKE_CXX_FLAGS += -D_STDC_CONSTANT_MACROS
In addition, I tried to add #define inline __inline to main.cpp, as shown on the ffmpeg website. Any ideas on what to try would be greatly appreciated!
update 3/31 :
I tried to start with a new Windows build environment, but the result did not change with the above test code. (The new environment was able to launch the world hello program).
My process of setting up this environment was to install a new version of 32-bit windows 7. Install Visual C ++ 2010 Express from Visual Studio 2010 Express All-in-One ISO . Install Qt 4.8.6 for 32-bit windows and Visual Studio 2010 . Finally, install Qt Creator 2.5.2 . To set up the Qt creator, I went to tools-> options and told him where to find Qt 4.8.6 qmake. I downloaded dev and shared for ffmpeg 2.8 from Zeranoe. I was missing stdint.h and inttypes , so I downloaded them and put the files in / include / libavutil. Then I fixed any of the header files that complained about "stdint.h". Then I put the dll files from ffmpeg-2.8-win32-shared / bin in the folder where qt created ffmpeg_test ffmpeg_test-build-desktop-Qt_4_8_6__4_8_6__Release / release.