Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f88b91a

Browse filesBrowse files
committed
Readme update, gpl-and-non-free
1 parent e7ae427 commit f88b91a
Copy full SHA for f88b91a

File tree

Expand file treeCollapse file tree

5 files changed

+65
-51
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+65
-51
lines changed

‎.github/workflows/build.yml

Copy file name to clipboardExpand all lines: .github/workflows/build.yml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: build ffmpeg
2424
run: |
2525
while sleep 300; do echo "=====[ $SECONDS seconds still running ]====="; done &
26-
SKIPINSTALL=yes VERBOSE=yes ./build-ffmpeg --build
26+
SKIPINSTALL=yes VERBOSE=yes ./build-ffmpeg --build --enable-gpl-and-non-free
2727
kill %1
2828
- name: check shared library
2929
run: |
@@ -45,7 +45,7 @@ jobs:
4545
- name: build ffmpeg
4646
run: |
4747
while sleep 300; do echo "=====[ $SECONDS seconds still running ]====="; done &
48-
SKIPINSTALL=yes VERBOSE=yes ./build-ffmpeg --build
48+
SKIPINSTALL=yes VERBOSE=yes ./build-ffmpeg --build --enable-gpl-and-non-free
4949
kill %1
5050
- name: check shared library
5151
run: |

‎README.md

Copy file name to clipboardExpand all lines: README.md
+27-29Lines changed: 27 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
build-ffmpeg
88
==========
99

10-
The FFmpeg build script provides an easy way to build a static FFmpeg on **macOS** and **Linux** with **non-freecodecs** included.
10+
The FFmpeg build script provides an easy way to build a static FFmpeg on **macOS** and **Linux** with optional **non-free and GPL codecs** (--enable-gpl-and-non-free) included.
1111

1212
[![How-To build FFmpeg on MacOS](https://img.youtube.com/vi/Z9p3mM757cM/0.jpg)](https://www.youtube.com/watch?v=Z9p3mM757cM "How-To build FFmpeg on OSX")
1313

@@ -16,8 +16,8 @@ The FFmpeg build script provides an easy way to build a static FFmpeg on **macOS
1616
## Disclaimer And Data Privacy Notice
1717

1818
This script will download different packages with different licenses from various sources, which may track your usage.
19-
These sources are out of control by the developers of this script. Also, this script creates a non-free and unredistributable binary. By downloading and using this script, you are fully
20-
aware of this.
19+
These sources are out of control by the developers of this script. Also, this script can create a non-free and unredistributable binary.
20+
By downloading and using this script, you are fully aware of this.
2121

2222
Use this script at your own risk. I maintain this script in my spare time. Please do not file bug reports for systems
2323
other than Debian 10 and macOS 11.x, because I don't have the resources or time to maintain different systems.
@@ -126,38 +126,35 @@ $ sudo dnf install @development-tools curl
126126
With Docker, FFmpeg can be built reliably without altering the host system. Also, there is no need to have the CUDA SDK
127127
installed outside of the Docker image.
128128

129-
A Docker engine with version 19.03 or higher is required to build images based on the following distributions:
129+
##### Default
130130

131-
* Ubuntu >= 16.04 (16.04, 18.04, 20.04)
132-
* Centos >= 7 (7, 8)
133-
134-
1. Enable Docker BuildKit
131+
If you're running an operating system other than the one above, a completely static build may work. To build a full
132+
statically linked binary inside Docker, just run the following command:
135133

136134
```bash
137-
$ export DOCKER_BUILDKIT=1
135+
$ docker build --tag=ffmpeg:default --output type=local,dest=build -f Dockerfile .
138136
```
139137

140-
2. Set the DIST (`ubuntu` or `centos`) and VER (ubuntu: `16.04` , `18.04`, `20.04` or centos: `7`, `8`) environment
141-
variables to select the preferred Docker base image.
142-
138+
##### CUDA
139+
These builds are always built with the --enable-gpl-and-non-free switch, as CUDA is non-free. See https://ffmpeg.org/legal.html
143140
```bash
141+
export DOCKER_BUILDKIT=1
142+
143+
## Set the DIST (`ubuntu` or `centos`) and VER (ubuntu: `16.04` , `18.04`, `20.04` or centos: `7`, `8`) environment variables to select the preferred Docker base image.
144144
$ export DIST=centos
145145
$ export VER=8
146-
```
147146

148-
3. Start the build as follows.
149-
150-
```bash
151-
$ sudo -E docker build --tag=ffmpeg:cuda-$DIST -f cuda-$DIST.dockerfile --build-arg VER=$VER .
147+
## Start the build
148+
$ docker build --tag=ffmpeg:cuda-$DIST -f cuda-$DIST.dockerfile --build-arg VER=$VER .
152149
```
153150

154-
4. Build an `export.dockerfile` that copies only what you need from the image you just built as follows. When running,
155-
move the library in the lib to a location where the linker can find it or set the `LD_LIBRARY_PATH`. Since we have
156-
matched the operating system and version, it should work well with dynamic links. If it doesn't work, edit
157-
the `export.dockerfile` and copy the necessary libraries and try again.
151+
Build an `export.dockerfile` that copies only what you need from the image you just built as follows. When running,
152+
move the library in the lib to a location where the linker can find it or set the `LD_LIBRARY_PATH`. Since we have
153+
matched the operating system and version, it should work well with dynamic links. If it doesn't work, edit
154+
the `export.dockerfile` and copy the necessary libraries and try again.
158155

159156
```bash
160-
$ sudo -E docker build --output type=local,dest=build -f export.dockerfile --build-arg DIST=$DIST .
157+
$ docker build --output type=local,dest=build -f export.dockerfile --build-arg DIST=$DIST .
161158
$ ls build
162159
bin lib
163160
$ ls build/bin
@@ -166,7 +163,7 @@ $ ls build/lib
166163
libnppc.so.11 libnppicc.so.11 libnppidei.so.11 libnppig.so.11
167164
```
168165

169-
### Build in Docker (full static ver.) (Linux)
166+
##### Full static version
170167

171168
If you're running an operating system other than the one above, a completely static build may work. To build a full
172169
statically linked binary inside Docker, just run the following command:
@@ -238,12 +235,13 @@ $ sudo dnf install libva-devel libva-intel-driver libva-utils
238235
```bash
239236
Usage: build-ffmpeg [OPTIONS]
240237
Options:
241-
-h, --help Display usage information
242-
--version Display version information
243-
-b, --build Starts the build process
244-
-c, --cleanup Remove all working dirs
245-
-f, --full-static Complete static build of ffmpeg (eg. glibc, pthreads etc...) **only Linux**
246-
Note: Because of the NSS (Name Service Switch), glibc does not recommend static links.
238+
-h, --help Display usage information
239+
--version Display version information
240+
-b, --build Starts the build process
241+
--enable-gpl-and-non-free Enable non-free codecs - https://ffmpeg.org/legal.html
242+
-c, --cleanup Remove all working dirs
243+
--full-static Complete static build of ffmpeg (eg. glibc, pthreads etc...) **only Linux**
244+
Note: Because of the NSS (Name Service Switch), glibc does not recommend static links.
247245
```
248246

249247
## Notes of static link

‎build-ffmpeg

Copy file name to clipboardExpand all lines: build-ffmpeg
+34-18Lines changed: 34 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# LICENSE: https://github.com/markus-perl/ffmpeg-build-script/blob/master/LICENSE
55

66
PROGNAME=$(basename "$0")
7-
VERSION=1.23
7+
VERSION=1.24
88
CWD=$(pwd)
99
PACKAGES="$CWD/packages"
1010
WORKSPACE="$CWD/workspace"
@@ -14,6 +14,8 @@ LDEXEFLAGS=""
1414
EXTRALIBS="-ldl -lpthread -lm -lz"
1515
MACOS_M1=false
1616
CONFIGURE_OPTIONS=()
17+
NONFREE_AND_GPL=false
18+
1719
# Check for Apple Silicon
1820
if [[ ("$(uname -m)" == "arm64") && ("$OSTYPE" == "darwin"*) ]]; then
1921
# If arm64 AND darwin (macOS)
@@ -182,12 +184,13 @@ cleanup() {
182184
usage() {
183185
echo "Usage: $PROGNAME [OPTIONS]"
184186
echo "Options:"
185-
echo " -h, --help Display usage information"
186-
echo " --version Display version information"
187-
echo " -b, --build Starts the build process"
188-
echo " -c, --cleanup Remove all working dirs"
189-
echo " -f, --full-static Build a full static FFmpeg binary (eg. glibc, pthreads etc...) **only Linux**"
190-
echo " Note: Because of the NSS (Name Service Switch), glibc does not recommend static links."
187+
echo " -h, --help Display usage information"
188+
echo " --version Display version information"
189+
echo " -b, --build Starts the build process"
190+
echo " --enable-gpl-and-non-free Enable GPL and non-free codecs - https://ffmpeg.org/legal.html"
191+
echo " -c, --cleanup Remove all working dirs"
192+
echo " --full-static Build a full static FFmpeg binary (eg. glibc, pthreads etc...) **only Linux**"
193+
echo " Note: Because of the NSS (Name Service Switch), glibc does not recommend static links."
191194
echo ""
192195
}
193196

@@ -202,14 +205,19 @@ while (($# > 0)); do
202205
exit 0
203206
;;
204207
-*)
205-
if [[ "$1" == "--build" || "$1" =~ 'b' ]]; then
208+
if [[ "$1" == "--build" || "$1" =~ '-b' ]]; then
206209
bflag='-b'
207210
fi
208-
if [[ "$1" == "--cleanup" || "$1" =~ 'c' && ! "$1" =~ '--' ]]; then
211+
if [[ "$1" == "--enable-gpl-and-non-free" ]]; then
212+
CONFIGURE_OPTIONS+=("--enable-nonfree")
213+
CONFIGURE_OPTIONS+=("--enable-gpl")
214+
NONFREE_AND_GPL=true
215+
fi
216+
if [[ "$1" == "--cleanup" || "$1" =~ '-c' && ! "$1" =~ '--' ]]; then
209217
cflag='-c'
210218
cleanup
211219
fi
212-
if [[ "$1" == "--full-static" || "$1" =~ 'f' ]]; then
220+
if [[ "$1" == "--full-static" ]]; then
213221
if [[ "$OSTYPE" == "darwin"* ]]; then
214222
echo "Error: A full static binary can only be build on Linux."
215223
exit 1
@@ -373,6 +381,7 @@ if build "zlib"; then
373381
build_done "zlib"
374382
fi
375383

384+
if $NONFREE_AND_GPL; then
376385
if build "openssl"; then
377386
download "https://www.openssl.org/source/openssl-1.1.1i.tar.gz"
378387
if $MACOS_M1; then
@@ -386,10 +395,12 @@ if build "openssl"; then
386395
build_done "openssl"
387396
fi
388397
CONFIGURE_OPTIONS+=("--enable-openssl")
398+
fi
389399

390400
if build "cmake"; then
391401
download "https://cmake.org/files/v3.18/cmake-3.18.4.tar.gz"
392-
execute ./configure --prefix="${WORKSPACE}" --system-zlib
402+
execute ./bootstrap -- -DCMAKE_USE_OPENSSL=OFF
403+
execute ./configure --prefix="${WORKSPACE}"
393404
execute make -j $MJOBS
394405
execute make install
395406
build_done "cmake"
@@ -409,10 +420,7 @@ if ! $MACOS_M1; then
409420
CONFIGURE_OPTIONS+=("--enable-libsvtav1")
410421
fi
411422

412-
##
413-
## video library
414-
##
415-
423+
if $NONFREE_AND_GPL; then
416424
if build "x264"; then
417425
download "https://code.videolan.org/videolan/x264/-/archive/0d754ec36013fee82978496cd56fbd48824910b3/x264-0d754ec36013fee82978496cd56fbd48824910b3.tar.gz" "x264-0d754ec.tar.gz"
418426
cd "${PACKAGES}"/x264-0d754ec || exit
@@ -430,7 +438,9 @@ if build "x264"; then
430438
build_done "x264"
431439
fi
432440
CONFIGURE_OPTIONS+=("--enable-libx264")
441+
fi
433442

443+
if $NONFREE_AND_GPL; then
434444
if build "x265"; then
435445
download "https://github.com/videolan/x265/archive/Release_3.5.tar.gz" "x265-3.5.tar.gz"
436446
cd build/linux || exit
@@ -446,6 +456,7 @@ if build "x265"; then
446456
build_done "x265"
447457
fi
448458
CONFIGURE_OPTIONS+=("--enable-libx265")
459+
fi
449460

450461
if build "libvpx"; then
451462
download "https://github.com/webmproject/libvpx/archive/v1.9.0.tar.gz" "libvpx-1.9.0.tar.gz"
@@ -464,6 +475,7 @@ if build "libvpx"; then
464475
fi
465476
CONFIGURE_OPTIONS+=("--enable-libvpx")
466477

478+
if $NONFREE_AND_GPL; then
467479
if build "xvidcore"; then
468480
download "https://downloads.xvid.com/downloads/xvidcore-1.3.7.tar.gz"
469481
cd build/generic || exit
@@ -482,12 +494,13 @@ if build "xvidcore"; then
482494
build_done "xvidcore"
483495
fi
484496
CONFIGURE_OPTIONS+=("--enable-libxvid")
497+
fi
485498

499+
if $NONFREE_AND_GPL; then
486500
if build "vid_stab"; then
487501
download "https://github.com/georgmartius/vid.stab/archive/v1.1.0.tar.gz" "vid.stab-1.1.0.tar.gz"
488502

489503
if $MACOS_M1; then
490-
491504
curl -s -o "$PACKAGES/vid.stab-1.1.0/fix_cmake_quoting.patch" https://raw.githubusercontent.com/Homebrew/formula-patches/5bf1a0e0cfe666ee410305cece9c9c755641bfdf/libvidstab/fix_cmake_quoting.patch
492505
patch -p1 <fix_cmake_quoting.patch
493506
fi
@@ -499,6 +512,7 @@ if build "vid_stab"; then
499512
build_done "vid_stab"
500513
fi
501514
CONFIGURE_OPTIONS+=("--enable-libvidstab")
515+
fi
502516

503517
if build "av1"; then
504518
download "https://aomedia.googlesource.com/aom/+archive/b52ee6d44adaef8a08f6984390de050d64df9faa.tar.gz" "av1.tar.gz" "av1"
@@ -581,6 +595,7 @@ if build "libtheora"; then
581595
fi
582596
CONFIGURE_OPTIONS+=("--enable-libtheora")
583597

598+
if $NONFREE_AND_GPL; then
584599
if build "fdk_aac"; then
585600
download "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.1.tar.gz/download?use_mirror=gigenet" "fdk-aac-2.0.1.tar.gz"
586601
execute ./configure --prefix="${WORKSPACE}" --disable-shared --enable-static
@@ -590,6 +605,7 @@ if build "fdk_aac"; then
590605
build_done "fdk_aac"
591606
fi
592607
CONFIGURE_OPTIONS+=("--enable-libfdk-aac")
608+
fi
593609

594610
##
595611
## image library
@@ -620,6 +636,7 @@ if build "libsdl"; then
620636
build_done "libsdl"
621637
fi
622638

639+
if $NONFREE_AND_GPL; then
623640
if build "srt"; then
624641
download "https://github.com/Haivision/srt/archive/v1.4.1.tar.gz" "srt-1.4.1.tar.gz"
625642
export OPENSSL_ROOT_DIR="${WORKSPACE}"
@@ -635,6 +652,7 @@ if build "srt"; then
635652
build_done "srt"
636653
fi
637654
CONFIGURE_OPTIONS+=("--enable-libsrt")
655+
fi
638656

639657
##
640658
## HWaccel library
@@ -683,8 +701,6 @@ download "https://git.ffmpeg.org/gitweb/ffmpeg.git/snapshot/553eb0773763798a6b96
683701
--disable-debug \
684702
--disable-doc \
685703
--disable-shared \
686-
--enable-gpl \
687-
--enable-nonfree \
688704
--enable-pthreads \
689705
--enable-static \
690706
--enable-small \

‎cuda-centos.dockerfile

Copy file name to clipboardExpand all lines: cuda-centos.dockerfile
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ RUN yum group install -y "Development Tools" \
1313
WORKDIR /app
1414
COPY ./build-ffmpeg /app/build-ffmpeg
1515

16-
RUN SKIPINSTALL=yes /app/build-ffmpeg --build
16+
RUN SKIPINSTALL=yes /app/build-ffmpeg --build --enable-gpl-and-non-free
1717

1818

1919
FROM centos:${VER}

‎cuda-ubuntu.dockerfile

Copy file name to clipboardExpand all lines: cuda-ubuntu.dockerfile
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ RUN apt-get update \
1414
WORKDIR /app
1515
COPY ./build-ffmpeg /app/build-ffmpeg
1616

17-
RUN SKIPINSTALL=yes /app/build-ffmpeg --build
17+
RUN SKIPINSTALL=yes /app/build-ffmpeg --build --enable-gpl-and-non-free
1818

1919

2020
FROM ubuntu:${VER}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.