├── .dockerignore ├── .gitignore ├── LICENSE ├── Dockerfile └── README.md /.dockerignore: -------------------------------------------------------------------------------- 1 | packages/ 2 | workspace/ -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | packages 2 | workspace 3 | .idea 4 | linux 5 | .artifacts 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2016 Markus Perl 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:22.04 AS build 2 | 3 | ENV DEBIAN_FRONTEND noninteractive 4 | 5 | RUN apt-get update \ 6 | && apt-get -y --no-install-recommends install build-essential curl ca-certificates libva-dev python3 tcl meson gperf m4 \ 7 | && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* \ 8 | && update-ca-certificates 9 | 10 | WORKDIR /app 11 | COPY ./build-ffmpeg /app/build-ffmpeg 12 | COPY ./ffmpeg_ac4.patch /app/ffmpeg_ac4.patch 13 | 14 | RUN SKIPINSTALL=yes /app/build-ffmpeg --build --enable-gpl-and-non-free 15 | 16 | FROM ubuntu:22.04 17 | 18 | ENV DEBIAN_FRONTEND noninteractive 19 | 20 | # install va-driver 21 | RUN apt-get update && \ 22 | apt-get -y dist-upgrade && \ 23 | apt-get -y install curl ca-certificates libva-drm2 && \ 24 | apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* && \ 25 | update-ca-certificates 26 | 27 | # Copy ffmpeg 28 | COPY --from=build /app/workspace/bin/ffmpeg /usr/bin/ffmpeg 29 | COPY --from=build /app/workspace/bin/ffprobe /usr/bin/ffprobe 30 | COPY --from=build /app/workspace/bin/ffplay /usr/bin/ffplay 31 | 32 | # Check shared library 33 | RUN ldd /usr/bin/ffmpeg 34 | RUN ldd /usr/bin/ffprobe 35 | RUN ldd /usr/bin/ffplay 36 | 37 | CMD ["--help"] 38 | ENTRYPOINT ["/usr/bin/ffmpeg"] 39 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Build FFmpeg 6.1 with AC4 Audio Support (static or Docker image) 2 | 3 | This is based on the original project [here](https://github.com/AkashiSN/ffmpeg-build-script). Those files were updated with newer packages, FFmpeg 6.1 and the AC4 decoding patches. 4 | 5 | 6 | build-ffmpeg 7 | ========== 8 | 9 | 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, see https://ffmpeg.org/legal.html) included. 10 | 11 | [![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") 12 | 13 | *Youtube: How-To build and install FFmpeg on macOS* 14 | 15 | ## Disclaimer And Data Privacy Notice 16 | 17 | This script will download different packages with different licenses from various sources, which may track your usage. 18 | These sources are out of control by the developers of this script. Also, this script can create a non-free and unredistributable binary. 19 | By downloading and using this script, you are fully aware of this. 20 | 21 | Use this script at your own risk. 22 | 23 | ### Common installation (macOS, Linux) 24 | 25 | ```bash 26 | $ git clone https://git.home.oriley.net/apps/ffmpeg.git 27 | $ cd ffmpeg-build-script 28 | $ ./build-ffmpeg --build 29 | ``` 30 | 31 | ## Supported Codecs 32 | 33 | * `x264`: H.264 Video Codec (MPEG-4 AVC) 34 | * `x265`: H.265 Video Codec (HEVC) 35 | * `libsvtav1`, SVT-AV1 Encoder and Decoder 36 | * `aom`: AV1 Video Codec (Experimental and very slow!) 37 | * `fdk_aac`: Fraunhofer FDK AAC Codec 38 | * `xvidcore`: MPEG-4 video coding standard 39 | * `VP8/VP9/webm`: VP8 / VP9 Video Codec for the WebM video file format 40 | * `AC4`: AC4 Audio Codec (used by ATSC 3.0) 41 | * `mp3`: MPEG-1 or MPEG-2 Audio Layer III 42 | * `ogg`: Free, open container format 43 | * `vorbis`: Lossy audio compression format 44 | * `theora`: Free lossy video compression format 45 | * `opus`: Lossy audio coding format 46 | * `srt`: Secure Reliable Transport 47 | * `webp`: Image format both lossless and lossy 48 | 49 | ### HardwareAccel 50 | 51 | * `vaapi`: [Video Acceleration API](https://trac.ffmpeg.org/wiki/Hardware/VAAPI). These encoders/decoders will only be 52 | available if a libva driver installation was found while building the binary. Follow [these](#Vaapi-installation) 53 | instructions for installation. Supported codecs in vaapi: 54 | * Encoders 55 | * H264 `h264_vaapi` 56 | * H265 `hevc_vaapi` 57 | * Motion JPEG `mjpeg_vaapi` 58 | * MPEG2 video `mpeg2_vaapi` 59 | * VP8 `vp8_vaapi` 60 | * VP9 `vp9_vaapi` 61 | 62 | ### Apple M1 (Apple Silicon) Support 63 | 64 | The script also builds FFmpeg on a new MacBook with an Apple Silicon M1 processor. 65 | 66 | ### LV2 Plugin Support 67 | 68 | If Python is available, the script will build a ffmpeg binary with lv2 plugin support. 69 | 70 | ## Requirements 71 | 72 | ### macOS 73 | 74 | * XCode 10.x or greater 75 | 76 | ### Linux 77 | 78 | * Debian >= Buster, Ubuntu => Focal Fossa, other Distributions might work too 79 | * A development environment and curl is required 80 | 81 | ```bash 82 | # Debian and Ubuntu 83 | $ sudo apt install build-essential curl tcl 84 | 85 | # Fedora 86 | $ sudo dnf install @development-tools curl tcl 87 | ``` 88 | 89 | ### Build in Docker (Linux) 90 | 91 | With Docker, FFmpeg can be built reliably without altering the host system. 92 | 93 | ##### Default 94 | 95 | If you're running an operating system other than the one above, a completely static build may work. To build a full 96 | statically linked binary inside Docker, just run the following command: 97 | 98 | ```bash 99 | $ docker build --tag=ffmpeg:default --output type=local,dest=build -f Dockerfile . 100 | ``` 101 | ### Run with Docker (macOS, Linux) 102 | 103 | You can also run the FFmpeg directly inside a Docker container. 104 | 105 | #### Default - Without CUDA (macOS, Linux) 106 | 107 | A dockerized FFmpeg build can be executed with the following command: 108 | 109 | ```bash 110 | $ sudo docker build --tag=ffmpeg . 111 | $ sudo docker run ffmpeg -i https://files.coconut.co.s3.amazonaws.com/test.mp4 -f webm -c:v libvpx -c:a libvorbis - > test.mp4 112 | ``` 113 | 114 | ### Common build (macOS, Linux) 115 | 116 | If you want to enable Vaapi, please refer to [these](#Vaapi-installation) and install the driver. 117 | 118 | ```bash 119 | $ ./build-ffmpeg --build 120 | ``` 121 | 122 | ## Vaapi installation 123 | 124 | You will need the libva driver, so please install it below. 125 | 126 | ```bash 127 | # Debian and Ubuntu 128 | $ sudo apt install libva-dev vainfo 129 | 130 | # Fedora and CentOS 131 | $ sudo dnf install libva-devel libva-intel-driver libva-utils 132 | ``` 133 | 134 | ## Usage 135 | 136 | ```bash 137 | Usage: build-ffmpeg [OPTIONS] 138 | Options: 139 | -h, --help Display usage information 140 | --version Display version information 141 | -b, --build Starts the build process 142 | --enable-gpl-and-non-free Enable non-free codecs - https://ffmpeg.org/legal.html 143 | -c, --cleanup Remove all working dirs 144 | --full-static Complete static build of ffmpeg (eg. glibc, pthreads etc...) **only Linux** 145 | Note: Because of the NSS (Name Service Switch), glibc does not recommend static links. 146 | ``` 147 | 148 | ## Notes of static link 149 | 150 | - Because of the NSS (Name Service Switch), glibc does **not recommend** static links. See detail 151 | below: https://sourceware.org/glibc/wiki/FAQ#Even_statically_linked_programs_need_some_shared_libraries_which_is_not_acceptable_for_me.__What_can_I_do.3F 152 | 153 | - Vaapi cannot be statically linked. 154 | 155 | Original Project 156 | ---------------- 157 | 158 | * Github: [http://www.github.com/markus-perl/](https://github.com/markus-perl/ffmpeg-build-script) 159 | --------------------------------------------------------------------------------