├── .dockerignore ├── .github └── workflows │ ├── docker-build.yml │ └── docker-image.yml ├── .gitignore ├── .travis.yml ├── Dockerfile ├── LICENSE ├── README.md ├── docker-compose.yml └── snapshot └── Dockerfile /.dockerignore: -------------------------------------------------------------------------------- 1 | tmp/ -------------------------------------------------------------------------------- /.github/workflows/docker-build.yml: -------------------------------------------------------------------------------- 1 | name: Build Docker Image 2 | 3 | on: 4 | push: 5 | branches: [ master ] 6 | pull_request: 7 | branches: [ master ] 8 | 9 | jobs: 10 | 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - uses: actions/checkout@v3 15 | - name: Build the Docker image 16 | run: docker build . --file Dockerfile --tag ffmpeg:$(date +%s) 17 | -------------------------------------------------------------------------------- /.github/workflows/docker-image.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | 8 | jobs: 9 | ffmpeg_latest: 10 | name: Push Docker image to Docker Hub 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Check out the repo 14 | uses: actions/checkout@v2 15 | 16 | - name: Log in to Docker Hub 17 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 18 | with: 19 | username: ${{ secrets.DOCKER_USERNAME }} 20 | password: ${{ secrets.DOCKER_PASSWORD }} 21 | 22 | - name: Extract metadata (tags, labels) for Docker 23 | id: meta 24 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 25 | with: 26 | images: alfg/ffmpeg 27 | 28 | - name: Build and push Docker image 29 | uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc 30 | with: 31 | context: . 32 | push: true 33 | tags: alfg/ffmpeg:latest 34 | 35 | ffmpeg_snapshot: 36 | name: Push Docker image to Docker Hub 37 | runs-on: ubuntu-latest 38 | steps: 39 | - name: Check out the repo 40 | uses: actions/checkout@v2 41 | 42 | - name: Log in to Docker Hub 43 | uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 44 | with: 45 | username: ${{ secrets.DOCKER_USERNAME }} 46 | password: ${{ secrets.DOCKER_PASSWORD }} 47 | 48 | - name: Extract metadata (tags, labels) for Docker 49 | id: meta 50 | uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 51 | with: 52 | images: alfg/ffmpeg 53 | 54 | - name: Build and push snapshot Docker image 55 | uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc 56 | with: 57 | context: ./snapshot 58 | file: ./snapshot/Dockerfile 59 | push: true 60 | tags: alfg/ffmpeg:snapshot 61 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | tmp/ -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | language: bash 4 | services: docker 5 | 6 | env: 7 | - DOCKER_IMAGE=ffmpeg 8 | 9 | script: 10 | - docker build -t ${DOCKER_IMAGE} . 11 | 12 | after_script: 13 | - docker images 14 | - docker run -it ${DOCKER_IMAGE} ffmpeg -buildconf 15 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Build the FFmpeg-build image. 3 | FROM alpine:3.16.0 as build 4 | 5 | ARG FFMPEG_VERSION=5.0 6 | 7 | ARG PREFIX=/opt/ffmpeg 8 | ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib 9 | ARG MAKEFLAGS="-j4" 10 | 11 | # FFmpeg build dependencies. 12 | RUN apk add --update \ 13 | build-base \ 14 | coreutils \ 15 | freetype-dev \ 16 | gcc \ 17 | lame-dev \ 18 | libogg-dev \ 19 | libass \ 20 | libass-dev \ 21 | libvpx-dev \ 22 | libvorbis-dev \ 23 | libwebp-dev \ 24 | libtheora-dev \ 25 | opus-dev \ 26 | openssl \ 27 | openssl-dev \ 28 | pkgconf \ 29 | pkgconfig \ 30 | rtmpdump-dev \ 31 | wget \ 32 | x264-dev \ 33 | x265-dev \ 34 | yasm 35 | 36 | # Get fdk-aac from community. 37 | RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \ 38 | apk add --update fdk-aac-dev 39 | 40 | # Get rav1e from testing. 41 | RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ 42 | apk add --update rav1e-dev 43 | 44 | # Get ffmpeg source. 45 | RUN cd /tmp/ && \ 46 | wget http://ffmpeg.org/releases/ffmpeg-${FFMPEG_VERSION}.tar.gz && \ 47 | tar zxf ffmpeg-${FFMPEG_VERSION}.tar.gz && rm ffmpeg-${FFMPEG_VERSION}.tar.gz 48 | 49 | # Compile ffmpeg. 50 | RUN cd /tmp/ffmpeg-${FFMPEG_VERSION} && \ 51 | ./configure \ 52 | --enable-version3 \ 53 | --enable-gpl \ 54 | --enable-nonfree \ 55 | --enable-small \ 56 | --enable-libmp3lame \ 57 | --enable-libx264 \ 58 | --enable-libx265 \ 59 | --enable-libvpx \ 60 | --enable-libtheora \ 61 | --enable-libvorbis \ 62 | --enable-libopus \ 63 | --enable-libfdk-aac \ 64 | --enable-libass \ 65 | --enable-libwebp \ 66 | --enable-librtmp \ 67 | --enable-librav1e \ 68 | --enable-postproc \ 69 | --enable-libfreetype \ 70 | --enable-openssl \ 71 | --disable-debug \ 72 | --disable-doc \ 73 | --disable-ffplay \ 74 | --extra-cflags="-I${PREFIX}/include" \ 75 | --extra-ldflags="-L${PREFIX}/lib" \ 76 | --extra-libs="-lpthread -lm" \ 77 | --prefix="${PREFIX}" && \ 78 | make && make install && make distclean 79 | 80 | # Cleanup. 81 | RUN rm -rf /var/cache/apk/* /tmp/* 82 | 83 | ########################## 84 | # Build the release image. 85 | FROM alpine:3.16.0 86 | LABEL MAINTAINER Alfred Gutierrez 87 | ENV PATH=/opt/ffmpeg/bin:$PATH 88 | 89 | RUN apk add --update \ 90 | ca-certificates \ 91 | openssl \ 92 | pcre \ 93 | lame \ 94 | libogg \ 95 | libass \ 96 | libvpx \ 97 | libvorbis \ 98 | libwebp \ 99 | libtheora \ 100 | opus \ 101 | rtmpdump \ 102 | x264-dev \ 103 | x265-dev 104 | 105 | COPY --from=build /opt/ffmpeg /opt/ffmpeg 106 | COPY --from=build /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2 107 | COPY --from=build /usr/lib/librav1e.so /usr/lib/librav1e.so 108 | 109 | CMD ["/usr/local/bin/ffmpeg"] 110 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Alfred Gutierrez 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 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # docker-ffmpeg 2 | An FFmpeg Dockerfile built from source. Built on Alpine Linux. 3 | 4 | * ffmpeg 4.4 (compiled from source). See [FFmpeg Build](#ffmpeg-build) for build configuration. 5 | 6 | [![Docker Stars](https://img.shields.io/docker/stars/alfg/ffmpeg.svg)](https://hub.docker.com/r/alfg/ffmpeg/) 7 | [![Docker Pulls](https://img.shields.io/docker/pulls/alfg/ffmpeg.svg)](https://hub.docker.com/r/alfg/ffmpeg/) 8 | [![Docker Automated build](https://img.shields.io/docker/automated/alfg/ffmpeg.svg)](https://hub.docker.com/r/alfg/ffmpeg/builds/) 9 | [![Build Status](https://travis-ci.org/alfg/docker-ffmpeg.svg?branch=master)](https://travis-ci.org/alfg/docker-ffmpeg) 10 | 11 | ## Usage 12 | 13 | * Pull Docker image and run: 14 | ``` 15 | docker pull alfg/ffmpeg 16 | docker run -it --rm alfg/ffmpeg ffmpeg -buildconf 17 | ``` 18 | 19 | * or build and run container from source: 20 | 21 | ``` 22 | docker build -t ffmpeg . 23 | docker run -it ffmpeg ffmpeg -buildconf 24 | ``` 25 | 26 | * or use as a base image in your Dockerfile: 27 | ``` 28 | FROM alfg/ffmpeg:latest 29 | ``` 30 | 31 | * Example using a mounted volume: 32 | ``` 33 | docker run -v ${PWD}:/opt/tmp/ -it --rm alfg/ffmpeg ffmpeg -i /opt/tmp/input.mp4 -c copy output.mp4 34 | ``` 35 | 36 | ## FFmpeg Snapshot Builds 37 | For building ffmpeg from snapshot, see [snapshot/Dockerfile](/snapshot/Dockerfile) for FFmpeg snapshot builds including support for libaom-av1. 38 | 39 | Or pull from the Docker tag: 40 | ``` 41 | docker pull alfg/ffmpeg:snapshot 42 | ``` 43 | 44 | The snapshot tag may be out of date. Build from [snapshot/Dockerfile](/snapshot/Dockerfile) to get the latest build. 45 | 46 | ### FFmpeg Build 47 | ``` 48 | ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers 49 | built with gcc 10.2.1 (Alpine 10.2.1_pre1) 20201203 50 | configuration: --enable-version3 --enable-gpl --enable-nonfree --enable-small --enable-libmp3lame --enable-libx264 --enable-libx265 --enable-libvpx --enable-libtheora --enable-libvorbis --enable-libopus --enable-libfdk-aac --enable-libass --enable-libwebp --enable-librtmp --enable-librav1e --enable-postproc --enable-avresample --enable-libfreetype --enable-openssl --disable-debug --disable-doc --disable-ffplay --extra-cflags=-I/opt/ffmpeg/include --extra-ldflags=-L/opt/ffmpeg/lib --extra-libs='-lpthread -lm' --prefix=/opt/ffmpeg 51 | libavutil 56. 70.100 / 56. 70.100 52 | libavcodec 58.134.100 / 58.134.100 53 | libavformat 58. 76.100 / 58. 76.100 54 | libavdevice 58. 13.100 / 58. 13.100 55 | libavfilter 7.110.100 / 7.110.100 56 | libavresample 4. 0. 0 / 4. 0. 0 57 | libswscale 5. 9.100 / 5. 9.100 58 | libswresample 3. 9.100 / 3. 9.100 59 | libpostproc 55. 9.100 / 55. 9.100 60 | configuration: 61 | --enable-version3 62 | --enable-gpl 63 | --enable-nonfree 64 | --enable-small 65 | --enable-libmp3lame 66 | --enable-libx264 67 | --enable-libx265 68 | --enable-libvpx 69 | --enable-libtheora 70 | --enable-libvorbis 71 | --enable-libopus 72 | --enable-libfdk-aac 73 | --enable-libass 74 | --enable-libwebp 75 | --enable-librtmp 76 | --enable-librav1e 77 | --enable-postproc 78 | --enable-avresample 79 | --enable-libfreetype 80 | --enable-openssl 81 | --disable-debug 82 | --disable-doc 83 | --disable-ffplay 84 | --extra-cflags=-I/opt/ffmpeg/include 85 | --extra-ldflags=-L/opt/ffmpeg/lib 86 | --extra-libs='-lpthread -lm' 87 | --prefix=/opt/ffmpeg 88 | ``` 89 | 90 | ## Resources 91 | * https://alpinelinux.org/ 92 | * https://www.ffmpeg.org 93 | 94 | ## License 95 | MIT 96 | -------------------------------------------------------------------------------- /docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: '3' 2 | 3 | services: 4 | ffmpeg: 5 | build: . 6 | volumes: 7 | - ./tmp:/opt/tmp -------------------------------------------------------------------------------- /snapshot/Dockerfile: -------------------------------------------------------------------------------- 1 | ############################### 2 | # Build the FFmpeg-build image. 3 | FROM alpine:3.13 as build 4 | 5 | ARG FFMPEG_VERSION=ffmpeg-snapshot.tar.bz2 6 | ARG AOM_VERSION=master 7 | 8 | ARG PREFIX=/opt/ffmpeg 9 | ARG PKG_CONFIG_PATH=/opt/ffmpeg/lib64/pkgconfig 10 | ARG LD_LIBRARY_PATH=/opt/ffmpeg/lib 11 | ARG MAKEFLAGS="-j4" 12 | 13 | # FFmpeg build dependencies. 14 | RUN apk add --update \ 15 | build-base \ 16 | cmake \ 17 | freetype-dev \ 18 | lame-dev \ 19 | libogg-dev \ 20 | libass \ 21 | libass-dev \ 22 | libvpx-dev \ 23 | libvorbis-dev \ 24 | libwebp-dev \ 25 | libtheora-dev \ 26 | libtool \ 27 | opus-dev \ 28 | openssl \ 29 | openssl-dev \ 30 | perl \ 31 | pkgconf \ 32 | pkgconfig \ 33 | rtmpdump-dev \ 34 | wget \ 35 | x264-dev \ 36 | x265-dev \ 37 | yasm 38 | 39 | # Install fdk-aac from testing. 40 | RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories && \ 41 | apk add --update fdk-aac-dev 42 | 43 | # Get rav1e from testing. 44 | RUN echo http://dl-cdn.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \ 45 | apk add --update rav1e-dev 46 | 47 | # Build libaom for av1. 48 | RUN mkdir -p /tmp/aom && cd /tmp/ && \ 49 | wget https://aomedia.googlesource.com/aom/+archive/${AOM_VERSION}.tar.gz && \ 50 | tar zxf ${AOM_VERSION}.tar.gz && rm ${AOM_VERSION}.tar.gz && \ 51 | rm -rf CMakeCache.txt CMakeFiles && \ 52 | mkdir -p ./aom_build && \ 53 | cd ./aom_build && \ 54 | cmake -DCMAKE_INSTALL_PREFIX="${PREFIX}" -DBUILD_SHARED_LIBS=1 .. && \ 55 | make && make install 56 | 57 | # Get ffmpeg source. 58 | RUN cd /tmp/ && \ 59 | wget https://ffmpeg.org/releases/${FFMPEG_VERSION} && \ 60 | tar xjvf ${FFMPEG_VERSION} && rm ${FFMPEG_VERSION} 61 | 62 | # Compile ffmpeg. 63 | RUN cd /tmp/ffmpeg && \ 64 | ./configure \ 65 | --enable-version3 \ 66 | --enable-gpl \ 67 | --enable-nonfree \ 68 | --enable-small \ 69 | --enable-libaom \ 70 | --enable-libmp3lame \ 71 | --enable-libx264 \ 72 | --enable-libx265 \ 73 | --enable-libvpx \ 74 | --enable-libtheora \ 75 | --enable-libvorbis \ 76 | --enable-libopus \ 77 | --enable-libfdk-aac \ 78 | --enable-libass \ 79 | --enable-libwebp \ 80 | --enable-librtmp \ 81 | --enable-librav1e \ 82 | --enable-postproc \ 83 | --enable-libfreetype \ 84 | --enable-openssl \ 85 | --disable-debug \ 86 | --disable-doc \ 87 | --disable-ffplay \ 88 | --extra-cflags="-I${PREFIX}/include" \ 89 | --extra-ldflags="-L${PREFIX}/lib" \ 90 | --extra-libs="-lpthread -lm" \ 91 | --prefix="${PREFIX}" && \ 92 | make && make install && make distclean 93 | 94 | # Cleanup. 95 | RUN rm -rf /var/cache/apk/* /tmp/* 96 | 97 | ########################## 98 | # Build the release image. 99 | FROM alpine:3.13 100 | LABEL MAINTAINER Alfred Gutierrez 101 | ENV PATH=/opt/ffmpeg/bin:$PATH 102 | 103 | RUN apk add --update \ 104 | ca-certificates \ 105 | openssl \ 106 | pcre \ 107 | lame \ 108 | libogg \ 109 | libass \ 110 | libvpx \ 111 | libvorbis \ 112 | libwebp \ 113 | libtheora \ 114 | opus \ 115 | rtmpdump \ 116 | x264-dev \ 117 | x265-dev 118 | 119 | COPY --from=build /opt/ffmpeg /opt/ffmpeg 120 | COPY --from=build /usr/lib/libfdk-aac.so.2 /usr/lib/libfdk-aac.so.2 121 | COPY --from=build /usr/lib/librav1e.so /usr/lib/librav1e.so 122 | COPY --from=build /opt/ffmpeg/lib64/libaom.so.3 /usr/lib/libaom.so.3 123 | 124 | CMD ["/opt/ffmpeg/bin/ffmpeg"] 125 | --------------------------------------------------------------------------------