基于Windows 10系统编译FFmpeg for UWP

来源:互联网 发布:java list 查询条件 编辑:程序博客网 时间:2024/05/20 20:17

看过很多在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 效果:


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
原创粉丝点击