Skip to content

Commit 48778c1

Browse files
committed
Added x264 and x265 encoders.
1 parent 9db9d96 commit 48778c1

23 files changed

+288
-47
lines changed

.github/workflows/build.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
tag_name:
1515
description: "Tag"
1616
required: true
17+
1718
jobs:
1819
build:
1920
strategy:
@@ -37,6 +38,7 @@ jobs:
3738
with:
3839
ref: ${{env.TAG_NAME}}
3940
submodules: recursive
41+
4042
- uses: msys2/setup-msys2@v2
4143
with:
4244
install: >-
@@ -47,24 +49,18 @@ jobs:
4749
yasm
4850
nasm
4951
50-
- name: Rebase
51-
if: ${{inputs.tag_name}}
52-
shell: msys2 {0}
53-
run: |
54-
cd FFmpeg
55-
git fetch --tags
56-
git checkout ${{inputs.tag_name}}
57-
git submodule update --init --recursive --depth 1
58-
5952
- name: Remove MSYS2 link
6053
shell: msys2 {0}
61-
run: rm $(which link)
54+
run: |
55+
rm $(which link)
56+
rm -rf /usr/local
6257
6358
- name: Build
6459
shell: cmd
6560
run: |
6661
CALL "${{steps.msvc.outputs.installationPath}}\VC\Auxiliary\Build\vcvarsall.bat" ${{env.target}} ${{env.SDK_VER}}
6762
msys2 -c "./build.sh ${{matrix.arch}} ${{matrix.type}} ${{matrix.license}}"
63+
6864
- name: Debug log
6965
if: ${{ failure() }}
7066
shell: bash
@@ -73,16 +69,18 @@ jobs:
7369
cat FFmpeg/ffbuild/config.log
7470
cat FFmpeg/ffbuild/config.mak
7571
cat FFmpeg/config.h
72+
7673
- name: Pack
7774
shell: msys2 {0}
7875
run: |
79-
cd dist
80-
zip -9 ../${{env.name}}.zip -r .
81-
cd ..
76+
CWD=$(pwd)
77+
cd /usr/local
78+
zip -9 ${CWD}/${{env.name}}.zip -r .
79+
cd ${CWD}
8280
sha1sum ${{env.name}}.zip >${{env.name}}.sha1
8381
./build-changelog.sh > changelog
8482
- name: Release
85-
if: ${{startsWith(github.ref, 'refs/tags/')||inputs.tag_name}}
83+
if: ${{startsWith(github.ref, 'refs/tags/')}}
8684
uses: softprops/action-gh-release@v2
8785
with:
8886
tag_name: ${{env.TAG_NAME}}

.gitmodules

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,9 @@ url = https://github.com/madler/zlib.git
2525
[submodule "openexr"]
2626
path = openexr
2727
url = https://github.com/AcademySoftwareFoundation/openexr.git
28+
[submodule "x265_git"]
29+
path = x265_git
30+
url = https://bitbucket.org/multicoreware/x265_git.git
31+
[submodule "x264"]
32+
path = x264
33+
url = https://code.videolan.org/videolan/x264.git

README.md

Lines changed: 64 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,71 @@
1-
# FFmpeg Builder
1+
# FFmpeg GitHub Action Builds (MSVC)
2+
3+
This repository provides **FFmpeg builds** compiled with **MSVC (Microsoft Visual C++)**, leveraging GitHub Actions to automate the process. Each release includes complete precompiled binaries, libraries, and development files, optimized for various platforms and configurations.
24

35
[![Build FFmpeg](https://github.com/System233/ffmpeg-builds/actions/workflows/build.yml/badge.svg)](https://github.com/System233/ffmpeg-builds/actions/workflows/build.yml)
46

5-
Build results: [Download](https://github.com/System233/ffmpeg-msvc-prebuilt/releases)
7+
## Contents of the Release Packages
8+
9+
Each release provides the following for all build variants, architectures, and licenses:
10+
11+
1. **Precompiled binaries** (`ffmpeg`, `ffplay`, `ffprobe`, etc.).
12+
2. **Dynamic and static libraries** for FFmpeg and included dependencies.
13+
3. **Header files** for development.
14+
4. **pkg-config (.pc) files** for library integration.
15+
5. **CMake configuration files** for easy integration with CMake-based projects.
16+
6. **SHA1 checksum files** for verifying integrity.
17+
18+
The files are packaged into **.zip** archives for each configuration, making it easy to download and integrate into your workflow.
19+
20+
## Downloading and Using the Builds
21+
22+
1. Visit the **[Releases](https://github.com/System233/ffmpeg-msvc-prebuilt/releases)** section.
23+
2. Download the `.zip` archive and its corresponding `.sha1` checksum file for your desired configuration.
24+
3. Verify the archive integrity using the `.sha1` checksum file.
25+
```sh
26+
sha1sum -c <filename>.sha1
27+
```
28+
4. Extract the archive to access binaries, libraries, and development files.
29+
30+
## Features
31+
32+
### Built with MSVC
33+
34+
- Ensures compatibility with Windows development environments.
35+
- Generates high-performance binaries optimized for modern Windows platforms.
36+
37+
### Build Variants
38+
39+
- **Shared**: Includes dynamic libraries and runtime dependencies.
40+
- **Static**: Fully self-contained binaries for standalone usage.
41+
42+
### Supported Architectures
43+
44+
- **amd64** (x86_64)
45+
- **x86** (32-bit)
46+
- **arm** (armv7l)
47+
- **arm64** (aarch64)
48+
49+
### Licensing Options
50+
51+
- **GPL Builds**: Includes additional components like **x264** and **x265** encoders.
52+
- **LGPL Builds**: Excludes GPL-licensed components for more permissive licensing.
53+
54+
### Included Dependencies
655

7-
## Build Info
56+
All builds include the following libraries:
857

9-
- Binaries: Now includes ffmpeg, ffplay and ffprobe executable files, as well as related header files and lib.
10-
- Arch support: x64, x86, arm and arm64.
11-
- Linker: static, shared
12-
- License: GPLv3, LGPLv2.1
58+
- [nv-codec-headers](https://github.com/FFmpeg/nv-codec-headers.git)
59+
- [zlib](https://github.com/madler/zlib.git)
60+
- [libjxl](https://github.com/libjxl/libjxl.git)
61+
- [openexr](https://github.com/AcademySoftwareFoundation/openexr.git)
62+
- [freetype](https://gitlab.freedesktop.org/freetype/freetype.git)
63+
- [harfbuzz](https://github.com/harfbuzz/harfbuzz.git)
64+
- [SDL2](https://github.com/libsdl-org/SDL.git)
65+
- [x264](https://code.videolan.org/videolan/x264.git) (GPL builds only)
66+
- [x265](https://bitbucket.org/multicoreware/x265_git.git) (GPL builds only)
1367

14-
## Enabled dependencies
68+
## License
1569

16-
- freetype2 (filter)
17-
- harfbuzz (filter)
18-
- libjxl (jxl,exr)
19-
- SDL2 (ffplay)
20-
- zlib (libpng,png/apng)
70+
- The scripts in this repository are licensed under the **MIT License**.
71+
- The binaries inherit the licensing terms of FFmpeg and its dependencies, which may include **GPL** or **LGPL**.

RELEASE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
This release contains FFmpeg builds, compiled with MSVC (Microsoft Visual C++) via GitHub Actions, and organized as follows:
2+
3+
- **Variants**: Includes both **shared** and **static** builds.
4+
- **Architectures**: Each variant is available for **amd64**, **x86**, **arm**, and **arm64**.
5+
- **Licenses**:
6+
- **GPL**: Includes GPL components such as the **x264** and **x265** encoders.
7+
- **LGPL**: Excludes GPL-licensed components.
8+
9+
#### Included Dependencies
10+
11+
- [nv-codec-headers](https://github.com/FFmpeg/nv-codec-headers.git)
12+
- [zlib](https://github.com/madler/zlib.git)
13+
- [libjxl](https://github.com/libjxl/libjxl.git)
14+
- [openexr](https://github.com/AcademySoftwareFoundation/openexr.git)
15+
- [freetype](https://gitlab.freedesktop.org/freetype/freetype.git)
16+
- [harfbuzz](https://github.com/harfbuzz/harfbuzz.git)
17+
- [SDL2](https://github.com/libsdl-org/SDL.git)
18+
- [x264](https://code.videolan.org/videolan/x264.git) (GPL builds only)
19+
- [x265](https://bitbucket.org/multicoreware/x265_git.git) (GPL builds only)
20+
21+
#### Release Notes

build-changelog.sh

100644100755
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# This software is released under the MIT License.
55
# https://opensource.org/licenses/MIT
66

7+
cat RELEASE.md
78
flag=0
89
while IFS= read -r line; do
910
if [[ "$line" =~ ^version ]]; then

build-cmake-dep.sh

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ amd64)
2222
esac
2323

2424
if [ $BUILD_TYPE == "static" ]; then
25-
BUILD_SHARED_LIBS=ON
25+
BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-OFF}
2626
CMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY:-MultiThreaded}
2727
else
28-
BUILD_SHARED_LIBS=ON
28+
BUILD_SHARED_LIBS=${BUILD_SHARED_LIBS:-ON}
2929
CMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY:-MultiThreadedDLL}
3030
fi
31-
cmake "$SRC_DIR" --install-prefix "$INSTALL_PREFIX" -A=$BUILD_ARCH -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DCMAKE_MSVC_RUNTIME_LIBRARY=$CMAKE_MSVC_RUNTIME_LIBRARY $@
31+
cmake "$SRC_DIR" -G "NMake Makefiles" --install-prefix "$INSTALL_PREFIX" -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -DCMAKE_MSVC_RUNTIME_LIBRARY=$CMAKE_MSVC_RUNTIME_LIBRARY $@
3232
cmake --build . --config Release -j$(nproc)
3333
cmake --install . --config Release

build-ffmpeg.sh

100644100755
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ shift 1
1111
cd $SRC_DIR
1212

1313
if [ $BUILD_TYPE == "static" ]; then
14-
TYPE_ARGS="--enable-static"
14+
CFLAGS="$CFLAGS /MT"
15+
TYPE_ARGS="--enable-static --pkg-config-flags=--static"
1516
else
17+
CFLAGS="$CFLAGS /MD"
1618
TYPE_ARGS="--enable-shared"
1719
fi
1820
if [[ $BUILD_ARCH =~ arm ]]; then

build-make-dep.sh

100644100755
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ echo -e "\n[Build $1]"
99
SRC_DIR=$(pwd)/$1
1010
shift 1
1111
cd $SRC_DIR
12+
if [ -e ./configure ]; then
13+
./configure $@
14+
fi
1215
make -j$(nproc)
13-
make install PREFIX=$INSTALL_PREFIX $@
16+
make ${INSTALL_TARGET:-install} PREFIX=$INSTALL_PREFIX

build-meson-dep.sh

100644100755
File mode changed.

build.sh

100644100755
Lines changed: 54 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ HELP_MSG="Usage: build.sh <x86,amd64,arm,arm64> [static,shared] [gpl,lgpl] ...FF
88
set -e
99
source ./env.sh
1010

11-
export BUILD_ARCH=${1:-$VSCMD_ARG_TGT_ARCH}
12-
export BUILD_TYPE=${2:-shared}
13-
export BUILD_LICENSE=${3:-gpl}
14-
1511
if [ -z $BUILD_ARCH ]; then
1612
echo "$HELP_MSG" >&2
1713
exit 1
@@ -32,13 +28,55 @@ echo BUILD_TYPE=$BUILD_TYPE
3228
echo BUILD_LICENSE=$BUILD_LICENSE
3329
echo FF_ARGS=$FF_ARGS
3430

35-
git -C zlib apply ../zlib.patch
36-
git -C FFmpeg apply ../ffmpeg.patch || true
31+
apply-patch() {
32+
GIT_CMD="git -C $1 apply ../patches/$2 --ignore-whitespace"
33+
if ! $GIT_CMD -R --check; then
34+
$GIT_CMD --ignore-whitespace
35+
else
36+
echo Skip $2 for $1
37+
fi
38+
}
39+
40+
apply-patch zlib zlib.patch
41+
apply-patch FFmpeg ffmpeg.patch
42+
apply-patch harfbuzz harfbuzz.patch
3743

3844
# --enable-libfribidi --enable-libass
3945
# ./build-meson-dep.sh fribidi -Ddocs=false
4046
# ./build-meson-dep.sh libass
4147

48+
if [ "$BUILD_LICENSE" == "gpl" ]; then
49+
50+
apply-patch x265_git x265_git-${BUILD_TYPE}.patch
51+
52+
if [ "$BUILD_TYPE" == "static" ]; then
53+
X265_ARGS="-DSTATIC_LINK_CRT=ON"
54+
ENABLE_SHARED=OFF
55+
else
56+
X265_ARGS="-DSTATIC_LINK_CRT=OFF"
57+
ENABLE_SHARED=ON
58+
fi
59+
60+
if [ "$BUILD_ARCH" == arm ]; then
61+
apply-patch x265_git x265_git-arm.patch
62+
fi
63+
64+
git -C x265_git fetch --tags
65+
./build-cmake-dep.sh x265_git/source -DCMAKE_SYSTEM_NAME=Windows -DENABLE_SHARED=$ENABLE_SHARED -DENABLE_CLI=OFF $X265_ARGS
66+
FF_ARGS="$FF_ARGS --enable-libx265"
67+
68+
if [ "$BUILD_TYPE" == "shared" ]; then
69+
apply-patch x264 x264-${BUILD_TYPE}.patch
70+
fi
71+
if [[ "$BUILD_ARCH" =~ arm ]]; then
72+
X264_ARGS="--disable-asm"
73+
fi
74+
75+
INSTALL_TARGET=install-lib-${BUILD_TYPE} ./build-make-dep.sh x264 --enable-${BUILD_TYPE} $X264_ARGS
76+
FF_ARGS="$FF_ARGS --enable-libx264"
77+
78+
fi
79+
4280
./build-make-dep.sh nv-codec-headers
4381

4482
CMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded ./build-cmake-dep.sh zlib
@@ -56,8 +94,16 @@ if [ -n "$ENABLE_SDL" ]; then
5694
fi
5795

5896
if [ -n "$ENABLE_LIBJXL" ]; then
59-
./build-cmake-dep.sh openexr -DOPENEXR_INSTALL_TOOLS=OFF
60-
./build-cmake-dep.sh libjxl -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_BUNDLE_LIBPNG=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF #-DJPEGXL_STATIC=ON
97+
98+
if [ "$BUILD_TYPE" == "shared" ]; then
99+
JPEGXL_STATIC=OFF
100+
else
101+
JPEGXL_STATIC=ON
102+
fi
103+
104+
apply-patch libjxl libjxl.patch
105+
./build-cmake-dep.sh openexr -DOPENEXR_INSTALL_TOOLS=OFF -DOPENEXR_BUILD_TOOLS=OFF -DBUILD_TESTING=OFF -DOPENEXR_IS_SUBPROJECT=ON
106+
./build-cmake-dep.sh libjxl -DBUILD_TESTING=OFF -DJPEGXL_ENABLE_BENCHMARK=OFF -DJPEGXL_ENABLE_JNI=OFF -DJPEGXL_BUNDLE_LIBPNG=OFF -DJPEGXL_ENABLE_TOOLS=OFF -DJPEGXL_ENABLE_EXAMPLES=OFF -DJPEGXL_STATIC=$JPEGXL_STATIC
61107
fi
62108

63109
./build-ffmpeg.sh FFmpeg $FF_ARGS

0 commit comments

Comments
 (0)