Christopher Degawa 91ecb657b3 av1an: always make sure it uses the release/7.1 branch | 2 주 전 | |
---|---|---|
.github | 5 년 전 | |
build | 2 주 전 | |
doc | 2 달 전 | |
.gitattributes | 6 년 전 | |
.gitignore | 5 년 전 | |
LICENSE | 6 년 전 | |
README.md | 1 개월 전 | |
media-autobuild_suite.bat | 1 개월 전 |
Before opening an issue, check if it's an issue directly from executing the suite. This isn't Doom9, reddit, stackoverflow or any other forum for general questions about the things being compiled. This script builds them, that's all.
This source code is also mirrored in GitLab.
Most git sources in the suite use GitHub, so if it's down, it's probably useless to run the suite at that time.
Click here to download latest version
For information about the compiler environment see the wiki, there you also have a example of how to compile your own tools.
FFmpeg (shared or static) with these libraries (all optional, but compiled by default unless said otherwise):
other tools
This tool is inspired by the very nice, linux cross-compiling tool from Roger Pack (rdp): https://github.com/rdp/ffmpeg-windows-build-helpers
It is based on msys2 and tested under Windows 8.1, 10 and 11. http://sourceforge.net/projects/msys2/
I use some jscript parts from nu774: https://github.com/nu774/fdkaac_autobuild
Thanks to all of them!
This Windows Batchscript setups a Mingw-w64/GCC compiler environment for building ffmpeg and other media tools under Windows. After building the environment it retrieves and compiles all tools. All tools get static compiled, no external .dlls needed (with some optional exceptions)
How to use it:
git clone
the project. Compilers and tools will get installed there. Please make sure you use a folder with a short path and without space characters. A good place might be: C:\mabsThe script writes an .ini file at /build/media-autobuild_suite.ini, so you only need to make these choices the first time what you want to build.
The script doesn't build any registry key or system variables, when you don't need it any more you can delete the folder and your system will be clean. Building everything from scratch takes about ~3 hours depending on how many CPU cores are utilized and what is enabled.
Check forcing-recompilations for documentation on how you can force a rebuild of all libs/binaries.
To save a bit of space after compiling, you can delete all source folders (except the folders with a "-git" or "-svn" on end) in /build. There's an option in the .bat for the script to remove these folders automatically. To save even more space, you can delete /msys64 after compiling. If the suite is run after /msys64 has been deleted, it will download again.
Have fun!
If there's some error during compilation follow these steps:
logs.zip
that the script gives or attach the file yourself to the issue page.--enable-libnpp
and/or --enable-cuda-nvcc
, see Notes about CUDA SDKmedia-autobuild_suite.bat
/build/media-autobuild_suite.ini
/build/media-suite_compile.sh
make -j $cpuCount
, here you need to put your cpu count). You don't need to start this script, it's called by the batch script./build/media-suite_update.sh
/build/media-suite_helper.sh
source
'd by the user if desired./build/media-suite_deps.sh
build/media-suite_compile.sh
. These URLs can be appended with #branch=BRANCH
, #commit=COMMITHASH
, or #tag=TAG
to build from a branch, commit, or tag respectively. They can also be replaced to build from forked repositories (For example, changing SOURCE_REPO_SVTAV1=https://gitlab.com/AOMediaCodec/SVT-AV1.git
to SOURCE_REPO_SVTAV1=https://github.com/gianni-rosato/svt-av1-psy.git
)./build/ffmpeg_options.txt
& /build/mpv_options.txt
/local32|64/etc/custom_profile
& $HOME/custom_build_options
/local32|64/etc/profile2.local
for example usage.Using custom patches is not officially supported, if you do use custom patches, do not expect much support from this suite. Either go to the patch's author or to a forum for help
To use a custom patch, within the build folder, create a script with the filename: <repository's name>_extra.sh
.
ffmpeg_extra.sh
.game-music-emu_extra.sh
SVT-VP9_extra.sh
The commands will run in the cloned/unzipped folder unless otherwise stated. (flac_extra.sh would run commands within flac-git)
To reference the cloned folder itself (flac-git
ffmpeg-git
) you can use the variable ${REPO_DIR}
.
To reference the generated build folder, you would need to use ${REPO_DIR}/build-${bits}
to reference the build-64bit folder for 64 bit builds or build-32bit folder for 32 bit builds.
build-shared-${bits}
for shared ffmpeg or build-light-${bits}
for light build, etc. Try to compile at least once to see what folders are generated or look through the compile script)If you are building for both 32 and 64-bit, you can gate certain commands using if [[ $bits = 64bit ]]; then <command>; fi
to only run them when building for 64 bits.\
Be careful with certain packages due to their unique build process (x265, x264, and some others) so make sure to check the compile script
Example Script: /build/aom_extra.sh
for aom-git
#!/bin/bash
# Don't automatically run cmake || configure
touch do_not_reconfigure
# Commands to run before running cmake
_pre_cmake(){
# Installs libwebp
do_pacman_install libwebp
# Downloads the patch and then applies the patch
do_patch "https://gist.githubusercontent.com/1480c1/9fa9292afedadcea2b3a3e067e96dca2/raw/50a3ed39543d3cf21160f9ad38df45d9843d8dc5/0001-Example-patch-for-learning-purpose.patch"
# Change directory to the build folder
cd_safe "build-${bits}"
# Run cmake with custom options. This will override the previous cmake commands.
# $LOCALDESTDIR refers to local64 or local32
cmake .. -G"Ninja" -DCMAKE_INSTALL_PREFIX="$LOCALDESTDIR" \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=clang \
-DBUILD_SHARED_LIBS=off -DENABLE_TOOLS=off
}
_post_cmake(){
# post cmake and post configure will be unavailable due to "touch do_not_reconfigure"
# as the do_not_reconfigure flag will skip the post commands.
}
# Commands to run before building using ninja
_pre_ninja(){
# Change directory to the build folder (Absolute path or relative to aom-git)
cd_safe "build-${bits}"
# applies a local patch (Absolute or relative to aom-git)
do_patch "My-Custom-Patches/test-diff-files.diff"
# run a custom ninja command.
ninja aom_version_check
# Not necessary, but just for readability sake
cd_safe ..
}
Example Script: /build/ffmpeg_extra.sh
for ffmpeg-git
#!/bin/bash
# Force to the suite to think the package has updates to recompile.
# Alternatively, you can use "touch recompile" for a similar effect.
touch custom_updated
_pre_configure(){
#
# Apply a patch from ffmpeg's patchwork site.
do_patch "https://patchwork.ffmpeg.org/patch/12563/mbox/" am
#
# Apply a local patch inside the directory where is "ffmpeg_extra.sh"
patch -p1 -i "$LOCALBUILDDIR/ffmpeg-0001-my_patch.patch"
#
# Add extra configure options to ffmpeg (ffmpeg specific)
# If you want to add something to ffmpeg not within the suite already
# you will need to install it yourself, either through pacman
# or compiling from source.
FFMPEG_OPTS+=(--enable-libsvthevc)
#
}
_post_make(){
# Don't run configure again.
touch "$(get_first_subdir -f)/do_not_reconfigure"
# Don't clean the build folder on each successive run.
# This is for if you want to keep the current build folder as is and just recompile only.
touch "$(get_first_subdir -f)/do_not_clean"
}
For a list of possible directive, look under unset_extra_script
in media-suite_helper.sh.
Beware as they may change in the future.
For --enable-cuda-nvcc
and --enable-libnpp
to work, you need NVIDIA's CUDA SDK installed with CUDA_PATH
variable to be set system-wide (Usually set by default on CUDA SDK install) and VS2017 or better installed which should come with vswhere.exe
.\
If for some reason CUDA_PATH
isn't set and/or vswhere.exe
isn't installed, you need to export the CUDA_PATH
variable path using the above mentioned user files and manually export the correct PATH
including the absolute cygpath
converted path to MSVC's cl.exe
.
If you did not understand any of the words above, assume the best and hope the compilation will succeed the first time, else try reinstalling the SDK and MSVC to a path without any spaces.
You will only need to be worried if running the following command in the mintty terminal produces a path with a space or if you have 8.3 short paths disabled.
cygpath -sm "$CUDA_PATH"
If running the above command produces a path with a space, you will need to either disable cuda/npp stuff or reinstall your cuda sdk to a path without spaces.
For example, if you need to manually set the CUDA_PATH
and include in the PATH
the binaries for MSVC cl.exe
and nvcc.exe
, add this bit of bash script inside a text file in /local64/etc/custom_profile
:
# adapt these to your environment
_cuda_basepath="C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA"
_cuda_version=10.0
_msvc_basepath="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC"
_msvc_version=14.15.26726
_msvc_hostarch=x64
_msvc_targetarch=x64
# you shouldn't need to change these unless your environment is weird or you know what you're doing
export CUDA_PATH=$(cygpath -sm "${_cuda_basepath}")/${_cuda_version}
export PATH=$PATH:$(dirname "$(cygpath -u "\\${_msvc_basepath}\\${_msvc_version}\bin\Host\\${_msvc_hostarch}\\${_msvc_targetarch}\cl.exe")")
export PATH=$PATH:$CUDA_PATH/bin