It is trite, but I note how to build the ffmpeg in this article.
零
Set up your MinGW environment, you could download 32/64 bit installation file from here
you could select which compiler you would like to install. The necessary is mingwg-developer-toolkit, mingw32-base and mingw32-gcc-g++:
After your installation done, open the MinGW shell (on YourMigwPATH\msys\1.0\msys.bat ) to check if the gcc works or not:
Gaiger@i5-4570 ~ $ gcc sh: gcc: command not found
If the gcc be not existing, move all the folder besides msys inYourMigwPATH into the folder
YourMigwPATH\msys\1.0
Currently, the gcc would be work in the MinGW environment.
Gaiger@i5-4570 ~ $ gcc gcc.exe: fatal error: no input files compilation terminated. Gaiger@i5-4570 ~ $
一.
Download the FFmpeg source code, choose which version you like. Warning : HEVC (h264) supporting after verion 2.0.
Uncompress the tar ball file and move the source folder into the folder YourMigwPATH\32\msys\1.0\home\YourUserName .
二.
Go into the ffmpeg source folder on the MinGW shell, my configure be :
./configure --enable-memalign-hack --arch=x86 --target-os=mingw32 --enable-cross-compile --enable-w32threads --cross-prefix=$PWD --prefix=/built
NOTE : I want the static libraries only, if you want the shared ones(to avoid GPL), you should add :
enable-shared
In your configuring parameter.
The configuring time in MinGW costs time more than it in linux, Do not be suspicious the MingW hanging and wait it done.
三.
Open the file ffmpegSourceRootRoot\libavformat\os_support.h, add the 2 line, about line number 32:
#include "config.h" #if defined(__MINGW32__) && !defined(__MINGW32CE__) #define WIN32_LEAN_AND_MEAN # include <windows.h> # include <fcntl.h> # define lseek(f,p,w) _lseeki64((f), (p), (w)) # define stat _stati64 # define fstat(f,s) _fstati64((f), (s)) #endif /* defined(__MINGW32__) && !defined(__MINGW32CE__) */
And Check the file ffmpegSourceRootRoot\cmdutils.c added the code or not , about line number 172:
#if defined(_WIN32) && !defined(__MINGW32CE__) #include <windows.h> #include <shellapi.h> /* Will be leaked on exit */ static char** win32_argv_utf8 = NULL; static int win32_argc = 0;
If it is not being added, complement that. Or you could add the parameter in the configuring :
CFLAGS="-Wno-implicit-function-declaration"
四:
All preparations have been done , type "make" to build it.
After the build done, type "make install" , the portable binaries and libraries would be under folder ffmpegSourceRootRoot\built.
五.
Goto the folder ffmpegSourceRootRoot\built\bin in the MinGW shell, to check if the ffmpeg has been built successfully or not:
Gaiger@i5-4570 ~/ffmpeg/2.4.12/built/bin $ ./ffmpeg.exe ffmpeg version 2.4.12 Copyright (c) 2000-2015 the FFmpeg developers built on Jan 22 2016 05:35:45 with gcc 4.8.1 (GCC) configuration: --enable-memalign-hack --arch=x86 --target-os=mingw32 --cross-p refix= --prefix=/home/Gaiger/ffmpeg/2.4.12/built --enable-cross-compile --enable -w32threads libavutil 54. 7.100 / 54. 7.100 libavcodec 56. 1.100 / 56. 1.100 libavformat 56. 4.101 / 56. 4.101 libavdevice 56. 0.100 / 56. 0.100 libavfilter 5. 1.100 / 5. 1.100 libswscale 3. 0.100 / 3. 0.100 libswresample 1. 1.100 / 1. 1.100 Hyper fast Audio and Video encoder usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfi le}... Use -h to get full help or, even better, run 'man ffmpeg' Gaiger@i5-4570 ~/ffmpeg/2.4.12/built/bin $
沒有留言:
張貼留言