Skip to content

denismakogon/ffmpeg-debian

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FFMPEG & Golang binding for Go Media Framework (GMF)

What's inside?

In this repo you'll find the following images:

  • base (something that you don't need but used across all other images)
  • -build (ffmpeg compiled from source with all plugins available, you don't need that as well)
  • -golang- (golang + ffmpeg build environment)
  • -runtime (ffmpeg runtime for golang compiled application)
  • -openjdk- (ffmpeg runtime for openjdk compiled application)
  • test (test image with one of the Go Media Framework applications complied and executed as the verification that all images work fine)

How to build a GMF application?

Check the following GMF application:

FROM ghcr.io/denismakogon/ffmpeg-debian:5.0.1-golang-1 as build-stage
RUN go get github.com/3d0c/gmf
WORKDIR $GOPATH/src/github.com/3d0c/gmf/examples
RUN mkdir -p /examples/tmp && \
    cp tmp/big_buck_bunny.webm /examples/tmp/big_buck_bunny.webm
RUN go build -o /examples/video-to-frames video-to-jpeg-avio.go


FROM ghcr.io/denismakogon/ffmpeg-debian:5.0.1-runtime
COPY --from=build-stage /examples /examples
WORKDIR /examples
ENTRYPOINT ["./video-to-frames"]

In this dockerfile:

  • you need denismakogon/ffmpeg-debian:5.0.1-golang-1 as a build environment for GMF-based applications
  • you need denismakogon/ffmpeg-debian:5.0.1-runtime as a runtime for complied application from the build stage
  • compile a binary at the build stage
  • copy binary through docker multi-stage feature to the runtime
docker build -t test-ffmpeg --build-arg "FFMPEG_VERSION=5.0.1" --build-arg "GOLANG_VERSION=1" -f test/Dockerfile .

How to build docker images

base image:

docker build -t ghcr.io/denismakogon/ffmpeg-debian:base -f base/Dockerfile .

FFMPEG build stage image:

docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-build -f ffmpeg/5.0.1/Dockerfile .

optional build arg is BASE_IMAGE_DIGEST_TAG, it used to point to a specific version of ffmpeg-debian:base image.

docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-build -f ffmpeg/5.0.1/Dockerfile \
  --build-arg "BASE_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:f6781e831ef68a7ff7170374639be85098b49c6a7740a3652d2f8f1ba43afc1e" \
  .

see the following documentation.

runtime image:

docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-runtime -f runtime/Dockerfile \
    --build-arg "BASE_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:f6781e831ef68a7ff7170374639be85098b49c6a7740a3652d2f8f1ba43afc1e" \
    --build-arg "BUILD_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:2b421ef4be773ce80d3f82717d9fd845e6cc03dfad4c961b2886b7a59117a609" \
      .

Golang image:

docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-golang-1 -f golang/Dockerfile \
  --build-arg "BUILD_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:2b421ef4be773ce80d3f82717d9fd845e6cc03dfad4c961b2886b7a59117a609" \
  --build-arg "GOLANG_VERSION=1" \
  .

Please note, golang version must in ffmpeg image must match to GOLANG_VERSION build arg.

OpenJDK image:

docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-openjdk-18 -f openjdk/Dockerfile \
  --build-arg "BASE_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:f6781e831ef68a7ff7170374639be85098b49c6a7740a3652d2f8f1ba43afc1e" \
  --build-arg "BUILD_IMAGE_DIGEST_TAG=ghcr.io/denismakogon/ffmpeg-debian@sha256:2b421ef4be773ce80d3f82717d9fd845e6cc03dfad4c961b2886b7a59117a609" \
  --build-arg "JDK_PKG_URL=https://download.java.net/java/GA/jdk18.0.1.1/65ae32619e2f40f3a9af3af1851d6e19/2/GPL/openjdk-18.0.1.1_linux-x64_bin.tar.gz" \
  .
docker build -t ghcr.io/denismakogon/ffmpeg-debian:5.0.1-openjdk-19-ea-panama -f openjdk/Dockerfile \
  --build-arg "FFMPEG_VERSION=5.0.1" \
  --build-arg "JDK_PKG_URL=https://download.java.net/java/early_access/panama/1/openjdk-19-panama+1-13_linux-x64_bin.tar.gz" .