I need YASM software in Windows 10 in Microsoft visual 2015 could any one tell the steps for installing yasm.
I already uses the below link.
https://github.com/yasm/yasm/tree/master/Mkfiles
with the help of source code I am not able to install yasm i got lots of errors in it.
asked Dec 19, 2017 at 8:29
I read somewhere that Windows users are advised to install yasm via Chocolatey
First, you need to install chocolately and after that you just need to run the following command:
choco install yasm
So, You just need to run only two commands one for chocolately installation and another one for yasm.
answered Dec 19, 2017 at 9:16
TwinkleTwinkle
3943 silver badges17 bronze badges
Compilation guide for Windows (using Visual Studio and vcpkg)
This guide contains steps required to allow compilation of Cataclysm-BN on Windows using Visual Studio and vcpkg.
Steps from current guide were tested on Windows 10 and 11 (64 bit), Visual Studio 2019 and 2022 (64 bit), but should as well work with slight modifications for other versions of Windows and Visual Studio.
Prerequisites:
- Computer with modern Windows operating system installed (Windows 10 or 11), Windows 7 and 8.1 are not guaranteed to work;
- NTFS partition with ~15 Gb free space (~10 Gb for Visual Studio, ~1 Gb for vcpkg installation, ~3 Gb for repository and ~1 Gb for build cache);
- Git for Windows (installer can be downloaded from Git homepage);
- Visual Studio 2019 or 2022
- Note: If you are using Visual Studio 2022, you must install the Visual Studio 2019 compilers to work around a vcpkg bug. In the Visual Studio Installer, select the ‘Individual components’ tab and search for / select the component that looks like ‘MSVC v142 — VS 2019 C++ x64/x86 Build Tools’. See microsoft/vcpkg#22287.
- Latest version of vcpkg (see instructions on vcpkg homepage).
- If you plan on contributing your changes to Bright Nights, you’ll also have to install a code formatter, see Code style section for more info.
Note: Windows XP is unsupported!
Installation and configuration:
- Install
Visual Studio
(installer can be downloaded from Visual Studio homepage).
- Select the «Desktop development with C++» and «Game development with C++» workloads.
-
Install
Git for Windows
(installer can be downloaded from Git homepage). -
Install and configure latest
vcpkg
:
WARNING: It is important that, wherever you decide to clone this repo, the path does not include whitespace. That is, C:/dev/vcpkg
is acceptable, but C:/dev test/vcpkg
is not.
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat -disableMetrics
vcpkg integrate install
Cloning and compilation:
- Clone Cataclysm-BN repository with following command line:
Note: This will download the entire CBN repository; 3+ GB of data. If you’re just testing you should probably add --depth=1
.
git clone https://github.com/cataclysmbnteam/Cataclysm-BN.git
cd Cataclysm-BN
-
Open the provided solution (
msvc-full-featuresCataclysm-vcpkg-static.sln
) inVisual Studio
, select configuration (Release
is advised if you just want to compile,Debug
is if you’re planning on editing code) and platform (x64
orx86
) and build it. All necessary dependencies will be built and cached for future use by vcpkg automatically. -
Open the
Build > Configuration Manager
menu and adjustActive solution configuration
andActive solution platform
to match your intended target.
This will configure Visual Studio to compile the release version, with support for Sound, Tiles, and Localization (note, however, that language files themselves are not automatically compiled; this will be done later).
-
Start the build process by selecting either
Build > Build Solution
orBuild > Build > Cataclysm-vcpkg-static
. The process may take a long period of time, so you’d better prepare a cup of coffee and some books in front of your computer The first build of each architecture will also download and install dependencies through vcpkg, which can take an especially long time. -
If you want to launch the game directly from Visual Studio, make sure you have specified correct working directory as explained below. Otherwise, you’ll only be able to launch the game from the file explorer.
-
If you need localization support, execute the bash script
lang/compile_mo.sh
inside Git Bash GUI just like on a UNIX-like system. This will compile the language files that were not automatically compiled in step 2 above.
Running from Visual Studio and debugging
-
Ensure that the Cataclysm game binary project (
Cataclysm-vcpkg-static
) is the selected startup project (right click on it in Solution Explorer ->Set as Startup Project
) -
Configure the working directory in the project properties to
$(ProjectDir)..
(right click on it in Solution Explorer ->Properties
-> selectAll Configurations
andAll Platforms
at the top ->Debugging
->Working Directory
) -
Press the debug button (green right-facing triangle near the top, or use the appropriate shortcut, e.g. F5)
If you discover that after pressing the debug button in Visual Studio, Cataclysm just exits after launch with return code 1, that is because of the wrong working directory.
Debug vs Release builds
Debug
builds run significantly slower than Release
builds, but provide additional safety checks.
If you just want to build the executable and play the game, Release
is advised.
If you plan on editing the code, Debug
is advised.
If you have enough experience with C++ to know:
- under-the-hood differences between
Debug
andRelease
- how
Release
optimizations may affect the debugger - how to avoid undefined behavior in code
Then you might want to use Release
build all the time to speed up dev process, and disable optimizations on a file-by-file basis by adding
#pragma optimize("", off)
line at the top of the file.
Running unit tests
Ensure that the Cataclysm test binary project (Cataclysm-test-vcpkg-static
) is the selected startup project, configure the working directory in the project properties to $(ProjectDir)..
, and then press the debug button (or use the appropriate shortcut, e.g. F5). This will run all of the unit tests. Additional command line arguments may be configured in the project’s command line arguments setting, or if you are using a compatible unit test runner (e.g. Resharper) you can run or debug individual tests from the unit test sessions.
Code style
We use Artistic Style
source code formatter to keep the style of our C++ code consistent. While it’s available as pre-built Windows executables, which you could install and run or configure to automatically format the code before commit, a much more convenient option for Visual Studio users is to install a specific extension, see «Astyle extensions for Visual Studio» in doc/DEVELOPER_TOOLING.md for more info.
As of October 2022, the code style check is run automatically on each PR on GitHub, so if you forgot to style your changes you’ll see the corresponsing check failing.
Make a distribution
There is a batch script in msvc-full-features
folder distribute.bat
. It will create a sub folder distribution
and copy all required files(eg. data/
, Cataclysm.exe
and dlls) into that folder. Then you can zip it and share the archive on the Internet.
Compilation guide for Windows (using Visual Studio and vcpkg)
This guide contains steps required to allow compilation of Cataclysm-BN on Windows using Visual Studio and vcpkg.
Steps from current guide were tested on Windows 10 and 11 (64 bit), Visual Studio 2019 and 2022 (64 bit), but should as well work with slight modifications for other versions of Windows and Visual Studio.
Prerequisites:
- Computer with modern Windows operating system installed (Windows 10 or 11), Windows 7 and 8.1 are not guaranteed to work;
- NTFS partition with ~15 Gb free space (~10 Gb for Visual Studio, ~1 Gb for vcpkg installation, ~3 Gb for repository and ~1 Gb for build cache);
- Git for Windows (installer can be downloaded from Git homepage);
- Visual Studio 2019 or 2022
- Note: If you are using Visual Studio 2022, you must install the Visual Studio 2019 compilers to work around a vcpkg bug. In the Visual Studio Installer, select the ‘Individual components’ tab and search for / select the component that looks like ‘MSVC v142 — VS 2019 C++ x64/x86 Build Tools’. See microsoft/vcpkg#22287.
- Latest version of vcpkg (see instructions on vcpkg homepage).
- If you plan on contributing your changes to Bright Nights, you’ll also have to install a code formatter, see Code style section for more info.
Note: Windows XP is unsupported!
Installation and configuration:
- Install
Visual Studio
(installer can be downloaded from Visual Studio homepage).
- Select the «Desktop development with C++» and «Game development with C++» workloads.
-
Install
Git for Windows
(installer can be downloaded from Git homepage). -
Install and configure latest
vcpkg
:
WARNING: It is important that, wherever you decide to clone this repo, the path does not include whitespace. That is, C:/dev/vcpkg
is acceptable, but C:/dev test/vcpkg
is not.
git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
bootstrap-vcpkg.bat -disableMetrics
vcpkg integrate install
Cloning and compilation:
- Clone Cataclysm-BN repository with following command line:
Note: This will download the entire CBN repository; 3+ GB of data. If you’re just testing you should probably add --depth=1
.
git clone https://github.com/cataclysmbnteam/Cataclysm-BN.git
cd Cataclysm-BN
-
Open the provided solution (
msvc-full-featuresCataclysm-vcpkg-static.sln
) inVisual Studio
, select configuration (Release
is advised if you just want to compile,Debug
is if you’re planning on editing code) and platform (x64
orx86
) and build it. All necessary dependencies will be built and cached for future use by vcpkg automatically. -
Open the
Build > Configuration Manager
menu and adjustActive solution configuration
andActive solution platform
to match your intended target.
This will configure Visual Studio to compile the release version, with support for Sound, Tiles, and Localization (note, however, that language files themselves are not automatically compiled; this will be done later).
-
Start the build process by selecting either
Build > Build Solution
orBuild > Build > Cataclysm-vcpkg-static
. The process may take a long period of time, so you’d better prepare a cup of coffee and some books in front of your computer The first build of each architecture will also download and install dependencies through vcpkg, which can take an especially long time. -
If you want to launch the game directly from Visual Studio, make sure you have specified correct working directory as explained below. Otherwise, you’ll only be able to launch the game from the file explorer.
-
If you need localization support, execute the bash script
lang/compile_mo.sh
inside Git Bash GUI just like on a UNIX-like system. This will compile the language files that were not automatically compiled in step 2 above.
Running from Visual Studio and debugging
-
Ensure that the Cataclysm game binary project (
Cataclysm-vcpkg-static
) is the selected startup project (right click on it in Solution Explorer ->Set as Startup Project
) -
Configure the working directory in the project properties to
$(ProjectDir)..
(right click on it in Solution Explorer ->Properties
-> selectAll Configurations
andAll Platforms
at the top ->Debugging
->Working Directory
) -
Press the debug button (green right-facing triangle near the top, or use the appropriate shortcut, e.g. F5)
If you discover that after pressing the debug button in Visual Studio, Cataclysm just exits after launch with return code 1, that is because of the wrong working directory.
Debug vs Release builds
Debug
builds run significantly slower than Release
builds, but provide additional safety checks.
If you just want to build the executable and play the game, Release
is advised.
If you plan on editing the code, Debug
is advised.
If you have enough experience with C++ to know:
- under-the-hood differences between
Debug
andRelease
- how
Release
optimizations may affect the debugger - how to avoid undefined behavior in code
Then you might want to use Release
build all the time to speed up dev process, and disable optimizations on a file-by-file basis by adding
#pragma optimize("", off)
line at the top of the file.
Running unit tests
Ensure that the Cataclysm test binary project (Cataclysm-test-vcpkg-static
) is the selected startup project, configure the working directory in the project properties to $(ProjectDir)..
, and then press the debug button (or use the appropriate shortcut, e.g. F5). This will run all of the unit tests. Additional command line arguments may be configured in the project’s command line arguments setting, or if you are using a compatible unit test runner (e.g. Resharper) you can run or debug individual tests from the unit test sessions.
Code style
We use Artistic Style
source code formatter to keep the style of our C++ code consistent. While it’s available as pre-built Windows executables, which you could install and run or configure to automatically format the code before commit, a much more convenient option for Visual Studio users is to install a specific extension, see «Astyle extensions for Visual Studio» in doc/DEVELOPER_TOOLING.md for more info.
As of October 2022, the code style check is run automatically on each PR on GitHub, so if you forgot to style your changes you’ll see the corresponsing check failing.
Make a distribution
There is a batch script in msvc-full-features
folder distribute.bat
. It will create a sub folder distribution
and copy all required files(eg. data/
, Cataclysm.exe
and dlls) into that folder. Then you can zip it and share the archive on the Internet.
Latest Release: 1.3.0
Release Date: August 10, 2014
- Yasm 1.3.0 Release Notes
- Source .tar.gz
- Win32 VS2010 .zip (for use with VS2010+ on 32-bit Windows)
- Win64 VS2010 .zip (for use with VS2010+ on 64-bit Windows)
- Win32 .exe (for general use on 32-bit Windows)
- Win64 .exe (for general use on 64-bit Windows)
- CygWin32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
Visual Studio 2010+ Integration
Download the appropriate VS2010 “vsyasm” zip file above for your system, and follow the readme.txt instructions for integrating yasm into Visual Studio 2010 (later versions are similar). Thanks to Brian Gladman for contributing this!
Visual Studio 2005/2008 Integration
See VisualStudio2005 for detailed instructions on integrating Yasm with Visual Studio 2005 (Visual Studio 2008 is similar).
See Structured Exception Handling (part of the Yasm User’s Manual) for detailed information on using structured exception handling in the Windows x64 environment. Yasm also supports the SAFESEH directive for structured exception handling in the Win32 environment.
Nightly Development Snapshots
A complete build of Yasm is performed daily at 1:20 AM PDT if there are any repository changes since the previous day. The latest snapshot is the most recent available. It is updated at the same time as the daily build. A Windows executable is also built nightly as “yasm-{version}.exe” in the latest snapshot directory. Older snapshots are also available.
Git Repository
All Yasm development is taking place using a Git repository. The repository is browseable online.
Yasm’s Git repository is hosted at GitHub and can be checked out with the following command.
git clone git://github.com/yasm/yasm.git
Developers can access the tree via SSH using the following command. A developer account must be set up on GitHub with the proper permissions to the yasm project for write access. You may request a developer account by contacting Peter Johnson.
git clone git@github.com:yasm/yasm.git
Older Releases
1.2.0
Release Date: October 31, 2011
- Yasm 1.2.0 Release Notes
- Source .tar.gz
- Win32 VS2010 .zip (for use with VS2010 on 32-bit Windows)
- Win64 VS2010 .zip (for use with VS2010 on 64-bit Windows)
- Win32 .exe (for general use on 32-bit Windows)
- Win64 .exe (for general use on 64-bit Windows)
- CygWin32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
1.1.0
Release Date: August 7, 2010
- Yasm 1.1.0 Release Notes
- Source .tar.gz
- Win32 VS2010 .zip (for use with VS2010 on 32-bit Windows)
- Win64 VS2010 .zip (for use with VS2010 on 64-bit Windows)
- Win32 .exe (for general use on 32-bit Windows)
- Win64 .exe (for general use on 64-bit Windows)
- DOS .exe (for use on pure DOS or for use with DJGPP)
1.0.1
Release Date: May 17, 2010
- Yasm 1.0.1 Release Notes
- Source .tar.gz
- Win32 VS2010 .zip (for use with VS2010 on 32-bit Windows)
- Win64 VS2010 .zip (for use with VS2010 on 64-bit Windows)
- Win32 .exe (for general use on 32-bit Windows)
- Win64 .exe (for general use on 64-bit Windows)
- DOS .exe (for use on pure DOS or for use with DJGPP)
1.0.0
Release Date: Apr 8, 2010
- Yasm 1.0.0 Release Notes
- Source .tar.gz
- Win32 VS2010 .zip (for use with VS2010 on 32-bit Windows)
- Win64 VS2010 .zip (for use with VS2010 on 64-bit Windows)
- Win32 .exe (for general use on 32-bit Windows)
- Win64 .exe (for general use on 64-bit Windows)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.8.0
Release Date: Apr 10, 2009
- Yasm 0.8.0 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.7.2
Release Date: Oct 8, 2008
- Yasm 0.7.2 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.7.1
Release Date: May 14, 2008
- Yasm 0.7.1 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
- Mac .dmg
0.7.0
Release Date: April 16, 2008
- Yasm 0.7.0 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.6.2
Release Date: September 21, 2007
- Yasm 0.6.2 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.6.1
Release Date: June 5, 2007
- Yasm 0.6.1 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.6.0
Release Date: February 24, 2007
- Yasm 0.6.0 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.5.0
Release Date: July 12, 2006
- Yasm 0.5.0 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.5.0rc2
Release Date: April 6, 2006
- Yasm 0.5.0rc2 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.5.0rc1
Release Date: February 11, 2006
- Yasm 0.5.0rc1 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use on 32-bit Windows)
- Win64 .exe (for “normal” (Visual Studio or similar) use on 64-bit Windows)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.4.0
Release Date: October 31, 2004
- Yasm 0.4.0 Release Notes
- Source .tar.gz
- Win32 .exe (for “normal” (Visual Studio or similar) use)
- Win32 .exe (for CygWin use)
- DOS .exe (for use on pure DOS or for use with DJGPP)
0.3.0
Release Date: September 4, 2003
- 0.3.0 Release Notes
- yasm-0.3.0.tar.gz
- DOS (DJGPP) .exe
- Win32 .exe (built with Visual C++ 6)
- Win32 .exe (built with GCC on CygWin)
0.2.2
Release Date: June 6, 2003
- 0.2.2 Release Notes
- yasm-0.2.2.tar.gz
- DOS (DJGPP) .exe
- Win32 .exe (built with Visual C++ 6)
- Win32 .exe (built with GCC on CygWin)
0.2.1
Release Date: April 1, 2003
- 0.2.1 Release Notes
- yasm-0.2.1.tar.gz
- DOS (DJGPP) .exe
- Win32 .exe (built with Visual C++ 6)
- Win32 .exe (built with GCC on CygWin)
0.2.0
Release Date: March 26, 2003
- 0.2.0 Release Notes
- yasm-0.2.0.tar.gz
- DOS (DJGPP) .exe
- Win32 .exe (built with Visual C++ 6)
- Win32 .exe (built with GCC on CygWin)
0.1.0
Release Date: March 19, 2002
- 0.1.0 Release Notes
- yasm-0.1.0.tar.gz
- DOS (DJGPP) .exe
- Win32 .exe (built with Visual C++ 6)
1. Окружающая среда
- Windows 10(1803)
- Visual Studio 2017 (набор инструментов VC ++ 2015.3 v140 для настольных ПК (x86, x64))
- MSYS2(Среда сборки GNU)
- YASM(компилятор ассемблерного кода x86)
- gas-preprocessor.pl(Препроцессор компонента ARM)
2. Этапы работы
2.1, установите Visual Studio 2017
Выберите [Install VC ++ 2015.3 v140 desktop toolset (x86, x64)], как показано ниже.
)
2.2, установите MSYS2
-
ссылка на скачивание:http://www.msys2.org/
-
Установите msys2-i686 для 32-битной Windows и msys2-x86_64 для 64-битной Windows.
Я использую 64 бита. - Измените набор rem MSYS2_PATH_TYPE = наследовать, чтобы установить MSYS2_PATH_TYPE = наследовать в msys2_shell.cmd в каталоге MSYS2.
- Получите последнюю версию make в командном окне MSYS2, команда выглядит следующим образом:
pacman -S make
- Получите последнюю версию gcc в командном окне MSYS2, команда выглядит следующим образом:
pacman -S gcc
- Удалите или переименуйте link.exe в msys2 ( usr bin link.exe)
- Установите perl в командном окне MSYS2, команда выглядит следующим образом:
pacman -S perl
- Установите diffutils в командном окне MSYS2
pacman -S diffutils
- Измените свойство Text окна msys2 на GBK, чтобы избежать искаженных символов, отображаемых во время компиляции
Щелкните окно правой кнопкой мыши, выберите меню [Параметры], выберите [Текст], выберите языковой стандарт: zh_CN и выберите GBK для набора символов.
2.3, установите YASM
- ссылка на скачивание:http://yasm.tortall.net/Download.html
Я использую Win64.exe. После загрузки переименуйте загруженный yasm-1.3.0-win64.exe в yasm.exe и поместите его в установочный каталог MSYS2.
2.4, установить газ-препроцессор
- ссылка на скачивание:https://github.com/FFmpeg/gas-preprocessor
- Поместите загруженный файл gas-preprocessor.pl в usr bin в каталог установки msys2.
2,5, инструмент проверки
- Запустите [Командная строка инструмента, совместимого с ARM VS2015 x86]
- Запустите [C: msys64 msys2_shell.cmd] в окне командной строки.
-
проверка
$ 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
2.6, скачать ffmpeg3.4.2
#Получить код
git clone https://git.ffmpeg.org/ffmpeg.git
# Переключить филиал
git checkout -b release3.4.2 n3.4.2
2.7、Windows 10 x86
- Запустите [командная строка собственного инструмента VS2015 x86]
- Запустите [C: msys64 msys2_shell.cmd] в окне командной строки.
- Войдите в каталог ffmpeg
cd /e/test/ffmpeg
-
Выполните следующие команды в командной строке msys2:
mkdir -p Output/Windows10/x86 cd Output/Windows10/x86 ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --disable-dxva2 --arch=x86 --enable-shared --enable-cross-compile --target-os=win32 --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/x86 make make install
2.8、Windows 10 x64
- Запустите [командная строка собственного инструмента VS2015 x64]
- Запустите [C: msys64 msys2_shell.cmd] в окне командной строки.
- Войдите в каталог ffmpeg
cd /e/test/ffmpeg
-
Выполните следующие команды в командной строке msys2:
mkdir -p Output/Windows10/x64 cd Output/Windows10/x64 ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --disable-dxva2 --arch=x86_64 --enable-shared --enable-cross-compile --target-os=win32 --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/x64 make make install
2.9、Windows 10 ARM
- Запустите [командная строка собственного инструмента VS2015 x64]
- Запустите [C: msys64 msys2_shell.cmd] в окне командной строки.
- Войдите в каталог ffmpeg
cd /e/test/ffmpeg
-
Выполните следующие команды в командной строке msys2:
mkdir -p Output/Windows10/ARM cd Output/Windows10/ARM ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --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_APP -D_WIN32_WINNT=0x0A00 -D__ARM_PCS_VFP" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/ARM make make install
PS:
- Ссылка:https://trac.ffmpeg.org/wiki/CompilationGuide/WinRT
Compile and Use FFmpeg Libraries for Windows Runtime (Windows 10 or Windows 8.1 Apps)
- Compile and Use FFmpeg Libraries for Windows Runtime (Windows 10 or …
-
Prerequisites and First Time Setup Instructions
- Prerequisites
- Verifying your FFmpeg Environment Setup
-
Compiling for Windows 10
- Windows 10 x86
- Windows 10 x64
- Windows 10 ARM
-
Compiling for Windows 8.1
- 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)
- Troubleshooting
- Windows Store Certification, File I/O, and Other Details
- Verifying Built FFmpeg Libraries and Sample Applications
FFmpeg libraries can be built and used for Windows Apps development targeting Windows 10, Windows 8.1, and Windows Phone 8.1. 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. It concludes with some practical and potentially non-obvious information for consuming the FFmpeg DLLs from your app.
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:msys64usrbinlink.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:msys64usrbinyasm.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:msys64usrbingas-preprocessor.pl
Verifying your FFmpeg Environment Setup
Launch Visual Studio ARM Cross Tools Command Prompt. E.g.
C:ProgramDataMicrosoftWindowsStart MenuProgramsVisual Studio 2015Visual Studio ToolsWindows Desktop Command PromptsVS2015 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:msys64msys2_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.
Compiling for Windows 10
Windows 10 x86
Launch VS2015 x86 Native Tools Command Prompt. E.g.
C:ProgramDataMicrosoftWindowsStart MenuProgramsVisual Studio 2015Visual Studio ToolsWindows Desktop Command PromptsVS2015 x86 Native Tools Command Prompt
Set the following environment variables in the launched command prompt above
SET LIB=%VSINSTALLDIR%VClibstore;%VSINSTALLDIR%VCatlmfclib;%UniversalCRTSdkDir%lib%UCRTVersion%ucrtx86;;%UniversalCRTSdkDir%lib%UCRTVersion%umx86;C:Program Files (x86)Windows KitsNETFXSDK4.6libumx86;;C:Program Files (x86)Windows KitsNETFXSDK4.6Libumx86 SET LIBPATH=%VSINSTALLDIR%VCatlmfclib;%VSINSTALLDIR%VClib; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%UniversalCRTSdkDir%Include%UCRTVersion%ucrt;%UniversalCRTSdkDir%Include%UCRTVersion%um;%UniversalCRTSdkDir%Include%UCRTVersion%shared;%UniversalCRTSdkDir%Include%UCRTVersion%winrt;C:Program Files (x86)Windows KitsNETFXSDK4.6Includeum;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows10/x86 cd Output/Windows10/x86 ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --disable-dxva2 --arch=x86 --enable-shared --enable-cross-compile --target-os=win32 --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/x86 make make install
Generated libraries can be found in Build/Windows10/x86
folder specified in --prefix
option above
Windows 10 x64
Launch VS2015 x86 x64 Cross Tools Command Prompt. E.g.
C:ProgramDataMicrosoftWindowsStart MenuProgramsVisual Studio 2015Visual Studio ToolsWindows Desktop Command PromptsVS2015 x86 x64 Cross Tools Command Prompt
Set the following environment variables in the launched command prompt above
SET LIB=%VSINSTALLDIR%VClibstoreamd64;%VSINSTALLDIR%VCatlmfclibamd64;%UniversalCRTSdkDir%lib%UCRTVersion%ucrtx64;;%UniversalCRTSdkDir%lib%UCRTVersion%umx64;C:Program Files (x86)Windows KitsNETFXSDK4.6libumx64;;C:Program Files (x86)Windows KitsNETFXSDK4.6Libumx64 SET LIBPATH=%VSINSTALLDIR%VCatlmfclibamd64;%VSINSTALLDIR%VClibamd64; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%UniversalCRTSdkDir%Include%UCRTVersion%ucrt;%UniversalCRTSdkDir%Include%UCRTVersion%um;%UniversalCRTSdkDir%Include%UCRTVersion%shared;%UniversalCRTSdkDir%Include%UCRTVersion%winrt;C:Program Files (x86)Windows KitsNETFXSDK4.6Includeum;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows10/x64 cd Output/Windows10/x64 ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --disable-dxva2 --arch=x86_64 --enable-shared --enable-cross-compile --target-os=win32 --extra-cflags="-MD -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_WIN32_WINNT=0x0A00" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/x64 make make install
Generated libraries can be found in Build/Windows10/x64
folder specified in --prefix
option above
If you encounter an error linking because link.exe complains that MSPDB140.dll has the wrong version installed. Run the following command from an administrative command-prompt and rebuild:
copy "C:Program Files (x86)Microsoft Visual Studio 14.0VCbinmspdbsrv.exe" "C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDE"
Windows 10 ARM
Launch VS2015 x86 ARM Cross Tools Command Prompt. E.g.
C:ProgramDataMicrosoftWindowsStart MenuProgramsVisual Studio 2015Visual Studio ToolsWindows Desktop Command PromptsVS2015 x86 ARM Cross Tools Command Prompt
Set the following environment variables in the launched command prompt above
SET LIB=%VSINSTALLDIR%VClibstoreARM;%VSINSTALLDIR%VCatlmfclibARM;%UniversalCRTSdkDir%lib%UCRTVersion%ucrtarm;;%UniversalCRTSdkDir%lib%UCRTVersion%umarm;C:Program Files (x86)Windows KitsNETFXSDK4.6libumarm;;C:Program Files (x86)Windows KitsNETFXSDK4.6Libumarm SET LIBPATH=%VSINSTALLDIR%VCatlmfclibARM;%VSINSTALLDIR%VClibARM; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%UniversalCRTSdkDir%Include%UCRTVersion%ucrt;%UniversalCRTSdkDir%Include%UCRTVersion%um;%UniversalCRTSdkDir%Include%UCRTVersion%shared;%UniversalCRTSdkDir%Include%UCRTVersion%winrt;C:Program Files (x86)Windows KitsNETFXSDK4.6Includeum;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows10/ARM cd Output/Windows10/ARM ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --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_APP -D_WIN32_WINNT=0x0A00 -D__ARM_PCS_VFP" --extra-ldflags="-APPCONTAINER WindowsApp.lib" --prefix=../../../Build/Windows10/ARM make make install
Generated libraries can be found in Build/Windows10/ARM
folder specified in --prefix
option above
If you encounter an error linking because link.exe
complains that
MSPDB140.dll
has the wrong version installed. Run the following command from an administrative command-prompt and rebuild:
copy "C:Program Files (x86)Microsoft Visual Studio 14.0VCbinmspdbsrv.exe" "C:Program Files (x86)Microsoft Visual Studio 14.0Common7IDE"
Compiling for Windows 8.1
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%VClibstore;%VSINSTALLDIR%VCatlmfclib;%WindowsSdkDir%libwinv6.3umx86;; SET LIBPATH=%WindowsSdkDir%ReferencesCommonConfigurationNeutral;;%VSINSTALLDIR%VCatlmfclib;%VSINSTALLDIR%VClib; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%WindowsSdkDir%Includeum;%WindowsSdkDir%Includeshared;%WindowsSdkDir%Includewinrt;;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows8.1/x86 cd Output/Windows8.1/x86 ../../../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="-APPCONTAINER" --prefix=../../../Build/Windows8.1/x86 make make install
Generated libraries can be found in Build/Windows8.1/x86
folder specified in --prefix
option above
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%VClibstoreamd64;%VSINSTALLDIR%VCatlmfclibamd64;%WindowsSdkDir%libwinv6.3umx64;; SET LIBPATH=%WindowsSdkDir%ReferencesCommonConfigurationNeutral;;%VSINSTALLDIR%VCatlmfclibamd64;%VSINSTALLDIR%VClibamd64; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%WindowsSdkDir%Includeum;%WindowsSdkDir%Includeshared;%WindowsSdkDir%Includewinrt;;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows8.1/x64 cd Output/Windows8.1/x64 ../../../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="-APPCONTAINER" --prefix=../../../Build/Windows8.1/x64 make make install
Generated libraries can be found in Build/Windows8.1/x64
folder specified in --prefix
option above
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%VClibstoreARM;%VSINSTALLDIR%VCatlmfclibARM;%WindowsSdkDir%libwinv6.3umarm;; SET LIBPATH=%WindowsSdkDir%ReferencesCommonConfigurationNeutral;;%VSINSTALLDIR%VCatlmfclibARM;%VSINSTALLDIR%VClibARM; SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%WindowsSdkDir%Includeum;%WindowsSdkDir%Includeshared;%WindowsSdkDir%Includewinrt;;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/Windows8.1/ARM cd Output/Windows8.1/ARM ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --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="-APPCONTAINER -MACHINE:ARM" --prefix=../../../Build/Windows8.1/ARM make make install
Generated libraries can be found in Build/Windows8.1/ARM
folder specified in --prefix
option above
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%VClibstore;%VSINSTALLDIR%VCatlmfclib;%WindowsSdkDir%....Windows Phone Kits8.1libx86;; SET LIBPATH=%VSINSTALLDIR%VCatlmfclib;%VSINSTALLDIR%VClib SET INCLUDE=%VSINSTALLDIR%VCINCLUDE;%VSINSTALLDIR%VCATLMFCINCLUDE;%WindowsSdkDir%....Windows Phone Kits8.1Include;%WindowsSdkDir%....Windows Phone Kits8.1Includeabi;%WindowsSdkDir%....Windows Phone Kits8.1Includemincore;%WindowsSdkDir%....Windows Phone Kits8.1Includeminwin;%WindowsSdkDir%....Windows Phone Kits8.1Includewrl;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/WindowsPhone8.1/x86 cd Output/WindowsPhone8.1/x86 ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --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="-APPCONTAINER -subsystem:console -opt:ref WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib -NODEFAULTLIB:kernel32.lib -NODEFAULTLIB:ole32.lib" --prefix=../../../Build/WindowsPhone8.1/x86 make make install
Generated libraries can be found in Build/WindowsPhone8.1/x86
folder specified in --prefix
option above
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%VClibstoreARM;%VSINSTALLDIR%VCatlmfclibARM;%WindowsSdkDir%....Windows Phone Kits8.1libarm;; SET LIBPATH=%VSINSTALLDIR%VCatlmfclibARM;%VSINSTALLDIR%VClibARM SET INCLUDE=%VSINSTALLDIR%VCinclude;%VSINSTALLDIR%VCatlmfcinclude;%WindowsSdkDir%....Windows Phone Kits8.1Include;%WindowsSdkDir%....Windows Phone Kits8.1Includeabi;%WindowsSdkDir%....Windows Phone Kits8.1Includemincore;%WindowsSdkDir%....Windows Phone Kits8.1Includeminwin;%WindowsSdkDir%....Windows Phone Kits8.1Includewrl;
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:msys64msys2_shell.cmd
In your MSYS2 shell navigate to your cloned FFmpeg
folder. E.g.
cd /c/ffmpeg
Invoke the following make commands
mkdir -p Output/WindowsPhone8.1/ARM cd Output/WindowsPhone8.1/ARM ../../../configure --toolchain=msvc --disable-programs --disable-d3d11va --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="-APPCONTAINER -MACHINE:ARM -subsystem:console -opt:ref WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib -NODEFAULTLIB:kernel32.lib -NODEFAULTLIB:ole32.lib" --prefix=../../../Build/WindowsPhone8.1/ARM make make install
Generated libraries can be found in Build/WindowsPhone8.1/ARM
folder specified in --prefix
option above
Troubleshooting
Building ARM libraries using Visual Studio armasm ARM assembler requires proper setup of gas-preprocessor.pl
and Perl in your MSYS2 environment. Please follow the setup instruction closely.
Windows Store Certification, File I/O, and Other Details
FFmpeg is an excellent alternative to Windows Media Foundation, which supports a small fraction of the codecs that FFmpeg has. Fortunately,
FFmpeg does not use any prohibited Windows or CRT APIs, and apps linked to the DLLs built with this method pass the latest Windows App Certification Kit. However, there are important things to remember.
First, don’t forget to make sure your app package includes all the necessary FFmpeg DLLs in the root folder. In your Visual C++ project, you should include links to the FFmpeg DLLs in the root project folder, making sure to set «Build Action» to «Content» and «Copy to Output Directory» to «Copy Always». It is not enough just to link to the import libraries. You will fail certification if you require your users to install the FFmpeg DLLs separately.
You will also need to supply a custom file I/O context to any AVFormatContext
rather than relying on avio_xxx
functions, because the standard I/O functions utilize CRT I/O that is not supported in WinRT. (You won’t fail certification, but your app will be unable to access the file specified in the AVFormatContext.filename
member, unless potentially it is located in the app’s local storage). The file I/O context needs to be initialized to point to your read
, write
, and seek
functions, with the opaque
member pointing to a struct
containing an IRandomAccessStream^
that you obtain when opening a file using proper WinRT IO calls in the Windows::Storage
namespace. (You need a struct
to hold the IRandomAccessStream^
, since you cannot cast a void*
to a ref handle). Your read
, write
, and seek
functions should cast the void* opaque
argument to the struct*
you define, and then use the IRandomAccessStream^
for all I/O.
Since FFmpeg I/O calls are synchronous, but the IRandomAccessStream
members are all asynchronous, you will need to utilize create_task
and wait()
on all I/O calls in your IO context implementation functions. Note that this necessitates that any FFmpeg functions utilizing file I/O be executed on a WORKER thread, as WinRT will generate an exception if you use wait()
in the UI thread. The best solution here is to create WinRT-friendly wrapper functions of the major FFmpeg functions you will utilize, by using the concurrency::create_async
function, for example:
IAsyncOperation<int>^ av_read_frame_async(AVFormatContext* s, AVPacket* pkt) { return create_async([s, pkt]()->int { return av_read_frame(s, pkt); }); }
Alternatively, if you don’t want to use Windows Runtime extensions, and don’t mind COM, you can use the Windows 8-API function CreateStreamOverRandomAccessStream
, which gives you an IStream*
COM interface from an IRandomAccessStream^
, utilizes synchronous I/O, and can be passed as the void* opaque
member of the IO context. The IStream
I/O calls are easier to use with C++ since they support direct pointer buffer access (you don’t have to deal with IBuffer
) and more closely correspond to the functions required in AVIOContext
. However, you should still make sure to wrap any code that utilizes file I/O in a background thread, as excessive blocking of the UI does violate Windows Store guidelines and may cause your app to be terminated at runtime.
Verifying Built FFmpeg Libraries and Sample Applications
The generated FFmpeg libraries from the compilation above can be consumed by Windows Runtime Components or Apps. They can be tested against the interop component and sample media players in the following project:
https://github.com/Microsoft/FFmpegInterop