LogoLogo
  • About
  • Installation
  • Update & migration
  • Configuration
    • Hostname
    • TLS / HTTPS
    • Database
    • Logging
    • API Security
    • Storage
      • Disk
      • In-memory
      • S3
    • RTMP
    • SRT
    • FFmpeg
    • Sessions
    • Metrics
    • Router
    • Debug
  • API Swagger-Documentation
  • API Clients
  • Web-Interface
  • Guides
    • Beginner
    • RTMP
    • SRT
    • Filesystems
  • General
    • Prometheus metrics
  • API
    • Login
    • Config
    • Log
    • Filesystem
      • Disk
      • In-memory
      • S3
    • Metrics
    • Sessions
    • Profiling
    • Ping
  • API / FFmpeg
    • Process
      • Command
      • Metadata
      • State
      • Probe
      • Report
    • Skills
    • Widget (Website)
  • API / RTMP
    • RTMP
  • API / SRT
    • SRT
  • Development
    • Architecture
    • Coding
    • Custom Docker images
    • Benchmark
    • Support
Powered by GitBook
On this page
  • 1. Create a custom FFmpeg image
  • 1.1 Clone the FFmpeg build files
  • 1.2 Switch to the cloned folder
  • 1.2 Change a Dockerfile
  • 1.3 Build a custom image
  • 2. Create a custom Core image
  • 2.1 Clone the Core build files
  • 2.2 Switch into the cloned folder
  • 2.3 Build a custom image
  • 3. Create a custom Core-FFmpeg bundle
  • 3.1 Build a custom image

Was this helpful?

Export as PDF
  1. Development

Custom Docker images

PreviousCodingNextBenchmark

Last updated 2 years ago

Was this helpful?

The Core-FFmpeg bundle uses Docker's multi-stage process so that FFmpeg and the Core can be updated and maintained independently.

When building the Core-FFmpeg bundle, an FFmpeg image is used. The previously created Golang libraries and folder structures are copied into this image.

This process speeds up the creation of the final Core-FFmpeg bundle, as existing or previously created images can be used, and compiling all the code is no longer required.

The following base images are available:

  • docker.io/datarhei/base:alpine-ffmpeg-latest

  • docker.io/datarhei/base:alpine-ffmpeg-rpi-latest

  • docker.io/datarhei/base:ubuntu-ffmpeg-cuda-latest

  • docker.io/datarhei/base:ubuntu-ffmpeg-vaapi-latest

  • docker.io/datarhei/base:alpine-core-latest

  • docker.io/datarhei/base:ubuntu-core-latest

Specific versions are available on the Docker website:

1. Create a custom FFmpeg image

1.1 Clone the FFmpeg build files

git clone github.com/datarhei/ffmpeg

Repository

1.2 Switch to the cloned folder

cd ffmpeg

1.2 Change a Dockerfile

Edit: Dockerfile.alpine
...
RUN cd /dist/ffmpeg-${FFMPEG_VERSION} && \
  patch -p1 < /contrib/ffmpeg-jsonstats.patch && \
  patch -p1 < /contrib/ffmpeg-hlsbitrate.patch && \
  ./configure \
  --extra-version=datarhei \
  --prefix="${SRC}" \
  --extra-libs="-lpthread -lxml2 -lm -lz -lsupc++ -lstdc++ -lssl -lcrypto -lz -lc -ldl" \
  --enable-nonfree \
  --enable-gpl \
  --enable-version3 \
  --enable-postproc \
  --enable-static \
  --enable-openssl \
  --enable-libxml2 \
  --enable-libv4l2 \
  --enable-v4l2_m2m \
  --enable-libfreetype \
  --enable-libsrt \
  --enable-libx264 \
  --enable-libx265 \
  --enable-libvpx \
  --enable-libmp3lame \
  --enable-libopus \
  --enable-libvorbis \
  --disable-ffplay \
  --disable-shared && \
  make -j$(nproc) && \
  make install
...

Dockerfile without --disable-debug and --disable-doc.

1.3 Build a custom image

./Build.sh default

Arguments:

  • default Dockerfile: Dockerfile.alpine Image name: datarhei/base:alpine-ffmpeg-latest

  • rpi Dockerfile: Dockerfile.alpine.rpi Image name: datarhei/base:alpine-ffmpeg-rpi-latest

  • cuda Dockerfile: Dockerfile.ubuntu.cuda Image name: datarhei/base:ubuntu-ffmpeg-cuda-latest

  • vaapi Dockerfile: Dockerfile.ubuntu.vaapi Image name: datarhei/base:alpine-ffmpeg-vaapi-latest

2. Create a custom Core image

2.1 Clone the Core build files

git clone git@github.com:datarhei/core.git

Repository

2.2 Switch into the cloned folder

cd core

2.3 Build a custom image

docker build -t datarhei/base:alpine-core-latest .

3. Create a custom Core-FFmpeg bundle

You can find the Dockerfile for the bundle (Dockerfile.bundle) in the cloned Core repository.

3.1 Build a custom image

docker build \
    -f Dockerfile.bundle \
    --build-arg CORE_IMAGE=datarhei/base:alpine-core-latest \
    --build-arg FFMPEG_IMAGE=datarhei/base:alpine-ffmpeg-latest \
    -t core-bundle:dev .

Docker supports multi-architecture images via --platform linux/amd64,linux/arm64,linux/arm/v7.

Docker
GitHub - datarhei/ffmpeg: FFmpeg base image for datarhei/core.GitHub
https://github.com/datarhei/coregithub.com
Logo
Logo