Recently I have never used FFMPEG before, so I have found many tutorials on the Internet, but they are not comprehensive. Therefore, I have integrated the following:
FFmpeg is developed on the Linux platform, but it can also be compiled and run in other operating system environments. This article describes how to compile FFMPEG in Windows XP.
I. preparation environment:
1. Download mingw and msys
Go to http://sourceforge.net/projects/mingw/ download
A click "Download mingw-get-inst-...exe ";
B. Switch to the page: Download? Check your browser's security bar, or try a direct link, or try another mirror .;
C Click "direct link" to download files similar to: mingw-get-inst-20110802.exe.
Tip: msyshere is downloaded. mingw-get-inst-20110802.exe already contains msys1.0, which can be seen later during installation.
2. Download yasm
Compilation code in ffmpegcompilation example yasm.exe
Go to the official website: http://yasm.tortall.net/Download.html download
Download: Win32. EXE (for general use on 32-bit Windows)
File Name: yasm-1.1.0-win32.exe
3 download FFMPEG
FFmpeg is available in http://www.ffmpeg.org/releases/
I chose the latest version: ffmpeg-0.8.5.tar.gz
File Name: ffmpeg-0.8.5.tar.gz
4. Download SDL
SDL download can go to: http://www.libsdl.org/download-1.2.php
Choice: SDL-1.2.14.tar.gz-GPG signed
Round (mingw32)
5. Download pthreadgc2.dll
Pthreadgc2.dll is a powerful DLL file for processing digital video editing software premiere6. This is a non-threatening file. Files belonging to the open source software Community project. Go to Baidu.com and search for the download.
Step 2
1. Install mingw and msys
Run the download file: mingw-get-inst-20110802.exe,
Select "Download latest repository catalogues" in step 1"
Select the installation path: C: \ mingw (I directly use the default path without modification)
In the select components step, select:
√ C compiler (selected by default)
√ C ++ Compiler
√ Msys Basic System (msys will be installed if this option is selected, and msys does not need to be installed separately)
√ Mingw developer Toolkit
Wait until installation is complete! (You need to wait for a certain amount of time, because the file needs to be downloaded during the installation process. The faster the network speed, the faster the installation)
After the installation is complete, you can see the msys folder in the C: \ mingw directory, and msys has been installed.
2. Configure the msys. bat batch file
To facilitate vs200x and vs2010 to call the FFMPEG dynamic library, you can configure FFMPEG to generate the Lib corresponding to DLL calls in windows during compilation. Of course, if you do not need this, you can skip the following steps and go to step 3.
Go to the C: \ mingw \ msys \ 1.0 \ folder, use ultraedit to open the msys. BAT file, and add the following line at the beginning of the file:
Call "D: \ Program Files \ Microsoft Visual Studio 10.0 \ Vc \ bin \ vcvars32.bat"
Among them, "d: \ Program Files \ Microsoft Visual Studio 10.0" installs vs200x or vs2010 directories on your machine. My computer installs vs2010 and is installed on the D Drive. Save the modified file.
3. Configure yasm
To reduce the trouble of configuring environment variables, you can directly change the yasm-1.1.0-win32.exe file name to: yasm.exe and put it in the system directory: c: \ windows \ system32.
4. Decompress FFMPEG and SDL
Ffmpeg-0.8.5.tar.gz decompression directory you can directly choose, I decompress to: D: \ FFMPEG, decompress the directory is: D: \ FFMPEG \ ffmpeg-0.8.5
SDL-1.2.14.tar.tar decompress to D: \ FFMPEG \ ffmpeg-0.8.5 directory, the decompressed directory structure is: D: \ FFMPEG \ ffmpeg-0.8.5 \ SDL-1.2.14
5. Compile SDL
Double-click "C: \ mingw \ msys \ 1.0 \ msys. Bat" to start "mingw32 ",
Switch to the SDL Directory: D: \ FFMPEG \ ffmpeg-0.8.5 \ SDL-1.2.14 as follows:
$ CD/d
$ CD FFMPEG
$ Ffmpeg-0.8.5 CD
$ SDL-1.2.14 CD
Run the following command:
$./Configure -- prefix =/usr press enter to wait...
$ Make press enter to wait...
$ Make install press enter to wait...
After compilation, you can view the compilation result in the bin, include, and Lib folders of c: \ mingw \ msys \ 1.0.
When we directly compiled ffmpeg, we found that ffplay.exe was not generated,
The following message is displayed when configuring configure:
SDL support no
Therefore, you need to enable SDL. I am exposed to this item the first day and do not know how to enable it. However, after compiling SDL
SDL support Yes
If your SDL connector is decompressed, copy the files in the bin, include, and Lib folders in the decompressed package to the D: \ FFMPEG \ ffmpeg-0.8.5, which is the same as step 6, but not from C: \ mingw \ msys \ 1.0.
6. Copy the compilation result:
C: \ mingw \ msys \ 1.0 to C:/mingw Overwrite
Copy SDL. dll and SDL-config in BIN to bin.
Copy the SDL folder under include to include.
Libsdl. A, libsdl. dll. A, libsdl. LA, and libsdlmain. A under lib are copied to Lib.
7. Modify the SDL-config configuration file
Use ultraedit to open the SDL-config file under D: \ FFMPEG \ ffmpeg-0.8.5 \ bin
Set prefix =/usr to: prefix = C:/mingw.
Here: C:/mingw is the installation path of mingw. Please modify it according to your installation.
8 compile FFMPEG
Double-click "C: \ mingw \ msys \ 1.0 \ msys. Bat" to start "mingw32 ",
Switch to the SDL Directory: D: \ FFMPEG \ ffmpeg-0.8.5 \ SDL-1.2.14,
The switchover method is as follows:
$ CD/d
$ CD FFMPEG
$ Ffmpeg-0.8.5 CD
If your "mingw32" is not closed, you can directly switch the path to: D: \ FFMPEG \ ffmpeg-0.8.5.
Run the following command:
$./Configure -- enable-shared -- disable-static -- enable-memalign-hack
Please wait for a while
$ Make
It takes a long time to complete compilation.
To summarize the compilation results, run the following command:
$ Make install
Wait for completion. In c: \ mingw \ msys \ 1.0 \ local, a bin1_demo-libfolder is generated, including ffmpeg.exe0000ffplay.exe0000ffprobe.exe, DLL, Lib, and header file.
9 run the test
Run javasffplay.exe directly in double-click mode. If you are prompted that the "pthreadgc2.dll" file does not exist, you can package "pthreadgc2.dll" to directly copy it to the current directory or put it in the system directory c: \ windows \ system32.
Avcodec. Lib avformat. Lib swscale. Lib avutil. Lib