-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
75 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,54 @@ | ||
## Build FFmpeg With MSVC | ||
## FFmpeg Build Script | ||
|
||
The difficulty is compiling FFmpeg with msvc. The method can be found on the internet. But there is an easier way. When compiling the latest version of FFmpeg with mingw gcc, the *.lib are also created and installed in /usr/local/bin, which can be linked by msvc. | ||
For other libraries compiled with mingw gcc, we can link them in a similar way. I introduce how to use the portaudio library created by mingw gcc. If you compile portaudio with mingw gcc, portaudio.lib file will not be created. So we should create it manually. But the def file can be found in lib/.lib, it will not be installed by default. There is a powerful tool named _dlltool_, with which we can create a lib from a def file for vc, using the following command | ||
`dlltool -m i386 -d libportaudio-2.dll.def -l portaudio.lib -D libportaudio-2.dll` | ||
Then put portaudio.lib into /usr/local/lib and it will be found when linking. | ||
The compiled libraries with msvc support can be found [here](https://sourceforge.net/projects/qtav/files/depends) | ||
I write a script to simplify the build. The script is in QtAV/scripts/build_ffmpeg.sh. It supports mingw gcc, msvc(2013), android, maemo5, maemo6(meego), sailfish os etc. Just put the script in ffmpeg source tree and run | ||
|
||
./build_ffmpeg.sh | ||
|
||
To cross build for android, maemo etc, you have to set some vars, for example NDK_ROOT for android. The vars can be set in config-android.sh, config-maemo5.sh etc. | ||
|
||
#### Install | ||
|
||
make install prefix=some_dir | ||
|
||
ref: http://ffmpeg.org/platform.html#Microsoft-Visual-C_002b_002b-or-Intel-C_002b_002b-Compiler-for-Windows | ||
|
||
## Build with VC | ||
|
||
Open vs prompt, go to msys' bin dir and run | ||
|
||
sh --login -i | ||
|
||
Then your are ready to use bash environment and with VC environment. Then go to ffmpeg source dir and run './build_ffmpeg.sh vc' | ||
|
||
if get error about gawk, just ignore `make -ki` | ||
|
||
## Additional Tools for Windows | ||
|
||
Your msys may lack of some command line tools that ffmpeg build system needs, such as pr, od, install, pkg-config, nasm. You can download one of build-ffmpeg-win-additinal-tools_msys2/gnuwin32.7z here: https://sourceforge.net/projects/qtav/files/depends/ | ||
|
||
extract and append it's bin dir to PATH. then you can build ffmpeg with gcc or vc. | ||
|
||
If you build with vc and not vs2013, you have to download [c99wrap](https://github.com/libav/c99-to-c89/) | ||
|
||
|
||
## Use MinGW libraries in VC | ||
|
||
If we build FFmpeg using mingw gcc, the `*,lib` are also created and installed in /usr/local/bin. So VC linker can use those. `*,lib` are generated by vc toolchain's `lib.exe` and `link.exe` if they are found. Otherwise `dlltool` is used. You may need additional link flag `/SAFESEH:NO` when linking to libs created by dlltool to avoid link error. | ||
|
||
If gcc does not create `*.lib`, for example, portaudio, then you can do it yourself. | ||
|
||
dlltool -m i386 -d libportaudio-2.dll.def -l portaudio.lib -D libportaudio-2.dll | ||
|
||
the def file can be found in lib/.lib for portaudio | ||
|
||
## Build PortAudio | ||
|
||
cmake is recommended. It's not difficult. | ||
|
||
|
||
## Build QtAV | ||
|
||
https://github.com/wang-bin/QtAV/wiki/Build-QtAV | ||
|
||
|
||
[prebuilt FFmpeg+portuaido](https://sourceforge.net/projects/qtav/files/depends) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters