| Version 2 (modified by , 12 years ago) ( diff ) |
|---|
Compile FFmpeg Libraries for Windows Runtime (WinRT)
- Prerequisites and First Time Setup Instructions
- Windows Store 8.1 x86 (Windows 8.1 Win32 in Visual Studio)
- Windows Store 8.1 x64 (Windows 8.1 x64 in Visual Studio)
- Windows Store 8.1 ARM (Windows 8.1 ARM in Visual Studio)
- Windows Phone 8.1 x86 (Windows Phone 8.1 Win32 Emulator in Visual Studio)
- Windows Phone 8.1 ARM (Windows Phone 8.1 ARM Device in Visual Studio)
FFmpeg libraries can be built for Windows Store 8.1 and Windows Phone 8.1 apps development using MSVC 2013 (Update 3 RTM or newer). The guide below provides build instruction for all supported target configurations (platform & architecture). Each configuration requires distinct set of tools, environment variables, and configure options outlined in each section below.
Prerequisites and First Time Setup Instructions
Prerequisites
- 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)
MSYS2 Setup
Download the latest MSYS2 installer from http://msys2.github.io/ and follow the installation instruction
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
YASM Setup
Download YASM executable from http://yasm.tortall.net/Download.html. 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 VS2013 ARM Cross Tools Command Prompt
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > VS2013 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.bat
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 12.0/VC/BIN/x86_ARM/cl $ which link /c/Program Files (x86)/Microsoft Visual Studio 12.0/VC/BIN/x86_ARM/link $ which armasm /c/Program Files (x86)/Microsoft Visual Studio 12.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
Windows Store 8.1 x86 (Windows 8.1 Win32 in Visual Studio)
Launch Developer Command Prompt for VS2013
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > Developer Command Prompt for VS2013
Set the following environment variables in the launched command prompt above. These environment variables overwrite the default paths with correct target specific ones.
SET LIB=%VSINSTALLDIR%VC\lib\store;%VSINSTALLDIR%VC\atlmfc\lib;%WindowsSdkDir%lib\winv6.3\um\x86;; SET LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;;%VSINSTALLDIR%VC\atlmfc\lib;%VSINSTALLDIR%VC\lib; SET INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%WindowsSdkDir%Include\um;%WindowsSdkDir%Include\shared;%WindowsSdkDir%Include\winrt;;
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.bat
In your MSYS2 shell navigate to your cloned FFmpeg folder
Invoke the following make commands
./configure \ --toolchain=msvc \ --disable-programs \ --disable-dxva2 \ --arch=x86 \ --enable-shared \ --enable-cross-compile \ --target-os=win32 \ --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -D_WIN32_WINNT=0x0603" \ --extra-ldflags="-winmd -appcontainer" \ --prefix=Build/Windows81/Win32 make make install
Generated libraries can be found in Build/Windows81/Win32 folder specified in --prefix option above
Clean FFmpeg build before switching to a different target or architecture.
make clean make distclean
Windows Store 8.1 x64 (Windows 8.1 x64 in Visual Studio)
Launch VS2013 x64 Cross Tools Command Prompt
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > VS2013 x64 Cross Tools Command Prompt
Set the following environment variables in the launched command prompt above. These environment variables overwrite the default paths with correct target specific ones.
SET LIB=%VSINSTALLDIR%VC\lib\store\amd64;%VSINSTALLDIR%VC\atlmfc\lib\amd64;%WindowsSdkDir%lib\winv6.3\um\x64;; SET LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;;%VSINSTALLDIR%VC\atlmfc\lib\amd64;%VSINSTALLDIR%VC\lib\amd64; SET INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%WindowsSdkDir%Include\um;%WindowsSdkDir%Include\shared;%WindowsSdkDir%Include\winrt;;
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.bat
In your MSYS2 shell navigate to your cloned FFmpeg folder
Invoke the following make commands
./configure \ --toolchain=msvc \ --disable-programs \ --disable-dxva2 \ --arch=x86_64 \ --enable-shared \ --enable-cross-compile \ --target-os=win32 \ --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -D_WIN32_WINNT=0x0603" \ --extra-ldflags="-winmd -appcontainer" \ --prefix=Build/Windows81/x64 make make install
Generated libraries can be found in Build/Windows81/x64 folder specified in --prefix option above
Clean FFmpeg build before switching to a different target or architecture.
make clean make distclean
Windows Store 8.1 ARM (Windows 8.1 ARM in Visual Studio)
Launch VS2013 ARM Cross Tools Command Prompt
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > VS2013 ARM Cross Tools Command Prompt
Set the following environment variables in the launched command prompt above. These environment variables overwrite the default paths with correct target specific ones.
SET LIB=%VSINSTALLDIR%VC\lib\store\ARM;%VSINSTALLDIR%VC\atlmfc\lib\ARM;%WindowsSdkDir%lib\winv6.3\um\arm;; SET LIBPATH=%WindowsSdkDir%References\CommonConfiguration\Neutral;;%VSINSTALLDIR%VC\atlmfc\lib\ARM;%VSINSTALLDIR%VC\lib\ARM; SET INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%WindowsSdkDir%Include\um;%WindowsSdkDir%Include\shared;%WindowsSdkDir%Include\winrt;;
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.bat
In your MSYS2 shell navigate to your cloned FFmpeg folder
Invoke the following make commands
./configure \ --toolchain=msvc \ --disable-programs \ --disable-dxva2 \ --arch=arm \ --as=armasm \ --cpu=armv7 \ --enable-thumb \ --enable-shared \ --enable-cross-compile \ --target-os=win32 \ --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_PC_APP -D_WIN32_WINNT=0x0603 -D__ARM_PCS_VFP" \ --extra-ldflags="-MACHINE:ARM -winmd -appcontainer" \ --prefix=Build/Windows81/ARM make make install
Generated libraries can be found in Build/Windows81/ARM folder specified in --prefix option above
Clean FFmpeg build before switching to a different target or architecture.
make clean make distclean
Windows Phone 8.1 x86 (Windows Phone 8.1 Win32 Emulator in Visual Studio)
Launch Developer Command Prompt for VS2013
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > Developer Command Prompt for VS2013
Set the following environment variables in the launched command prompt above. These environment variables overwrite the default paths with correct target specific ones.
SET LIB=%VSINSTALLDIR%VC\lib\store;%VSINSTALLDIR%VC\atlmfc\lib;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\lib\x86;; SET LIBPATH=%VSINSTALLDIR%VC\atlmfc\lib;%VSINSTALLDIR%VC\lib SET INCLUDE=%VSINSTALLDIR%VC\INCLUDE;%VSINSTALLDIR%VC\ATLMFC\INCLUDE;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\abi;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\mincore;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\minwin;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\wrl;
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.bat
In your MSYS2 shell navigate to your cloned FFmpeg folder
Invoke the following make commands
./configure \ --toolchain=msvc \ --disable-programs \ --disable-dxva2 \ --arch=x86 \ --enable-shared \ --enable-cross-compile \ --target-os=win32 \ --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP -D_WIN32_WINNT=0x0603" \ --extra-ldflags="-subsystem:console -opt:ref WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib -NODEFAULTLIB:kernel32.lib -NODEFAULTLIB:ole32.lib" \ --prefix=Build/WindowsPhone81/Win32 make make install
Generated libraries can be found in Build/WindowsPhone81/Win32 folder specified in --prefix option above
Clean FFmpeg build before switching to a different target or architecture.
make clean make distclean
Windows Phone 8.1 ARM (Windows Phone 8.1 ARM Device in Visual Studio)
Launch VS2013 ARM Cross Tools Command Prompt
Start Menu > Visual Studio 2013 (Start Menu Folder) > Visual Studio Tools > VS2013 ARM Cross Tools Command Prompt
Set the following environment variables in the launched command prompt above. These environment variables overwrite the default paths with correct target specific ones.
SET LIB=%VSINSTALLDIR%VC\lib\store\ARM;%VSINSTALLDIR%VC\atlmfc\lib\ARM;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\lib\arm;; SET LIBPATH=%VSINSTALLDIR%VC\atlmfc\lib\ARM;%VSINSTALLDIR%VC\lib\ARM SET INCLUDE=%VSINSTALLDIR%VC\include;%VSINSTALLDIR%VC\atlmfc\include;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\abi;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\mincore;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\minwin;%WindowsSdkDir%..\..\Windows Phone Kits\8.1\Include\wrl;
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.bat
In your MSYS2 shell navigate to your cloned FFmpeg folder
Invoke the following make commands
./configure \ --toolchain=msvc \ --disable-programs \ --disable-dxva2 \ --arch=arm \ --as=armasm \ --cpu=armv7 \ --enable-thumb \ --enable-shared \ --enable-cross-compile \ --target-os=win32 \ --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_PHONE_APP -D_WIN32_WINNT=0x0603 -D__ARM_PCS_VFP" \ --extra-ldflags="-MACHINE:ARM -subsystem:console -opt:ref WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib -NODEFAULTLIB:kernel32.lib -NODEFAULTLIB:ole32.lib" \ --prefix=Build/WindowsPhone81/ARM make make install
Generated libraries can be found in Build/WindowsPhone81/ARM folder specified in --prefix option above
Clean FFmpeg build before switching to a different target or architecture.
make clean make distclean


