天天看點

基于Windows 10系統編譯FFmpeg for UWP Prerequisites and First Time Setup Instructions

看過很多在windows系統上編譯FFMPEG的文章,多多少少總有一些坑過不去。這個guide是FFMPEG官方提供,對于我來說是唯一一個一次性編譯成功(在windows10系統)的流程。

相關需要下載下傳的檔案,以及最終編譯出來的庫檔案我都整理在網盤連結,供有需要的朋友下載下傳:

連結: http://pan.baidu.com/s/1i5Mfxe1 密碼: 4x8x

另外在Github上也上傳了一份,包括一個UWP的media player demo和源碼。

https://github.com/zhubin215130/ffmpeg_win10_player

demo 效果:

基于Windows 10系統編譯FFmpeg for UWP Prerequisites and First Time Setup Instructions

guide雖然英文版但是很簡單,按照上面一步一步做能夠很友善的編譯通過:

Prerequisites and First Time Setup Instructions

Prerequisites

  • For Windows 10: ​Microsoft Visual Studio 2015 (tested with Visual Studio 2015 RTM)
  • For Windows 8.1: ​Microsoft Visual Studio 2013 (use MSVC 2013 Update 3 RTM or newer)
  • ​MSYS2 (GNU Make environment)
  • ​YASM (x86 assembly code compiler)
  • ​gas-preprocessor.pl (ARM assembly pre-processor)

Windows 10 Setup

Download and install ​Microsoft Visual Studio 2015 on a Windows 10 machine.

Windows 8.1 Setup

Download and install ​Microsoft Visual Studio 2013 on a Windows 8.1 machine

MSYS2 Setup

Download the latest MSYS2 installer from ​http://msys2.github.io/ and follow the installation instruction closely from the installation webpage. In order for the environment from the Windows side to be inherited on the MSYS2 side, uncomment the following line from msys2_shell.cmd if it is present: replace rem set MSYS2_PATH_TYPE=inherit with set MSYS2_PATH_TYPE=inherit this will allow the environment variables for Visual Studio to be transferred to the MSYS2 environment and back.

Once base MSYS2 is successfully installed, get the latest make package by invoking the following command in your MSYS2 shell

pacman -S make
      

Also get the latest gcc package

pacman -S gcc
      

Rename or remove link.exe in the MSYS2 usr bin folder (E.g. C:\msys64\usr\bin\link.exe) to prevent conflict with MSVC link.exe

Install perl as it will be needed to run 'gas-preprocessor.pl'

pacman -S perl
      

Install also diffutils for configure script

pacman -S diffutils
      

YASM Setup

Download YASM executable from ​http://yasm.tortall.net/Download.html. You have to download the "general use" binaries and NOT the ones for VS2010. Either Win32 or Win64 binaries support outputting object files for both architectures so that should not matter. The last tested version was yasm-1.3.0-win64.exe.

Rename the downloaded executable to yasm.exe and place it in your MSYS2 path. E.g.C:\msys64\usr\bin\yasm.exe.

gas-preprocessor Setup

Download gas-preprocessor.pl Perl script from ​https://github.com/FFmpeg/gas-preprocessor

Place the downloaded Perl script in your MSYS2 path. E.g. C:\msys64\usr\bin\gas-preprocessor.pl

Verifying your FFmpeg Environment Setup

Launch Visual Studio ARM Cross Tools Command Prompt. E.g.

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 ARM Cross Tools Command Prompt
      

Open MSYS2 Shell from the command prompt above (use the correct drive and location of your MSYS2 installation). Note that the command shell above will close and it may take a while for the MSYS2 shell to launch.

C:\msys64\msys2_shell.cmd
      

In the MSYS2 shell verify that all the tools below are setup properly by running the following commands

$ which cl
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/cl

$ which link
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/link

$ which armasm
/c/Program Files (x86)/Microsoft Visual Studio 14.0/VC/BIN/x86_ARM/armasm

$ which yasm
/usr/bin/yasm

$ which cpp
/usr/bin/cpp

$ which gas-preprocessor.pl
/usr/bin/gas-preprocessor.pl
      

Verify that the tools are in the path and point to the right location where MSYS2 and Visual Studio are installed

To keep the source tree clean and the platforms separated, we will have the intermediate files go to the Output\<Platform>\<Architecture> folder under the FFmpeg source tree. We will also have the install files (the files necessary to link and use FFmpeg in your application) go to the Build\<Platform>\<Architecture> folder under the FFmpeg source tree.

連結: http://pan.baidu.com/s/1i5Mfxe1 密碼: 4x8x

繼續閱讀