Skip to content

Commit

Permalink
fix ffmpeg filter drawtext on the containers (#413)
Browse files Browse the repository at this point in the history
* fix drawtext on the containers
  • Loading branch information
jsheffie authored Nov 14, 2024
1 parent 1e5a763 commit 9907f08
Show file tree
Hide file tree
Showing 43 changed files with 213 additions and 23 deletions.
16 changes: 9 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,38 @@ If you are not running the amd64 platform, you may need to pass in the --platfor
- 7.1-ubuntu2404

```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-desktop-build docker-images/7.1/ubuntu2404
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-desktop-build docker-images/7.1/ubuntu2404
$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest
```

- 7.1-ubuntu2404-edge

```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-edge-desktop-build docker-images/7.1/ubuntu2404-edge
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-ubuntu2404-edge-desktop-build docker-images/7.1/ubuntu2404-edge
$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-edge-desktop-build:latest
```

- 7.1-nvidia2404

```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-nvidia2404-desktop-build docker-images/7.1/nvidia2404
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-nvidia2404-desktop-build docker-images/7.1/nvidia2404
$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-nvidia2404-desktop-build:latest
```

- vaapi2404
```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-vaapi2404-desktop-build docker-images/7.1/vaapi2404
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-vaapi2404-desktop-build docker-images/7.1/vaapi2404
$ docker run -it --rm --entrypoint='bash' --platform="linux/amd64" ffmpeg-7.1-vaapi2404-desktop-build:latest
```

- alpine320
```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-alpine320-desktop-build docker-images/7.1/alpine320
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-alpine320-desktop-build docker-images/7.1/alpine320
$ docker run -it --rm --entrypoint='sh' --platform="linux/amd64" ffmpeg-7.1-alpine320-desktop-build:latest
```

```sh
$ ./update.py; time docker build --platform linux/amd64 -t ffmpeg-7.1-scratch320-desktop-build docker-images/7.1/scratch320
$ ./update.py; docker build --platform linux/amd64 -t ffmpeg-7.1-scratch320-desktop-build docker-images/7.1/scratch320
$ docker run -it --rm --entrypoint='sh' --platform="linux/amd64" ffmpeg-7.1-scratch320-desktop-build:latest
```

Expand All @@ -110,15 +110,17 @@ In the bash shell, run the following commands
but they are all there
$ for i in ogg amr vorbis theora mp3lame opus vpx xvid fdk x264 x265;do echo $i; find /usr/local/ -name *$i*;done
$ ffmpeg -buildconf
$ ffmpeg -filters
3: Convert an avi file to an mp4 file.
`docker run --rm -v $(pwd):$(pwd) -w $(pwd) --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest -i drop_video_1.avi outfile/dv_converted.mp4`
4: Convert a asf file to an mp4
`docker run --rm -v $(pwd):$(pwd) -w $(pwd) --platform="linux/amd64" ffmpeg-7.1-ubuntu2404-desktop-build:latest -i MU_2_Discharge_Bottle___Inlet_to_Discharge.asf outfile/mpu2_discharge_bottle_converted.mp4`
5: using a drawtext filter
`docker run --rm -v $(pwd):$(pwd) -w $(pwd) --platform="linux/amd64" jrottenberg/ffmpeg:7.1-ubuntu2404 -i sample-5s_1.mp4 -vf "drawtext=text='Stack Overflow':fontcolor=white:fontsize=24:box=1:boxcolor=black@0.5:boxborderw=5:x=(w-text_w)/2:y=(h-text_h)/2" outfile/sample-5s_1_with_text.mp4`
```

</details>

# Reviewing
Expand Down
7 changes: 7 additions & 0 deletions docker-images/6.1/alpine320/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ RUN libDeps="libgomp \
fontconfig \
fontconfig-static \
fontconfig-dev \
font-dejavu \
# https://github.com/libass/libass
libass \
libass-dev \
Expand Down Expand Up @@ -198,6 +199,12 @@ RUN /tmp/workdir/install_ffmpeg.sh
### Release Stage
FROM alpine:3.20 AS release
# RUN apk add --no-cache --update bash less tree file vim
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local
COPY --from=builder /tmp/fakeroot/ /

Expand Down
3 changes: 3 additions & 0 deletions docker-images/6.1/alpine320/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
6 changes: 6 additions & 0 deletions docker-images/6.1/ubuntu2404-edge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ RUN /tmp/workdir/install_ffmpeg.sh
# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04 AS runtime

# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/6.1/ubuntu2404-edge/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
8 changes: 7 additions & 1 deletion docker-images/6.1/ubuntu2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
Expand Down Expand Up @@ -189,6 +189,12 @@ RUN /tmp/workdir/install_ffmpeg.sh

# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04 AS runtime
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/6.1/ubuntu2404/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
10 changes: 8 additions & 2 deletions docker-images/6.1/vaapi2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
Expand Down Expand Up @@ -193,7 +193,13 @@ RUN /tmp/workdir/install_ffmpeg.sh


# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04
FROM ubuntu:24.04 AS runtime
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/6.1/vaapi2404/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
7 changes: 7 additions & 0 deletions docker-images/7.0/alpine320/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ RUN libDeps="libgomp \
fontconfig \
fontconfig-static \
fontconfig-dev \
font-dejavu \
# https://github.com/libass/libass
libass \
libass-dev \
Expand Down Expand Up @@ -198,6 +199,12 @@ RUN /tmp/workdir/install_ffmpeg.sh
### Release Stage
FROM alpine:3.20 AS release
# RUN apk add --no-cache --update bash less tree file vim
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local
COPY --from=builder /tmp/fakeroot/ /

Expand Down
3 changes: 3 additions & 0 deletions docker-images/7.0/alpine320/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
7 changes: 6 additions & 1 deletion docker-images/7.0/nvidia2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
Expand Down Expand Up @@ -213,6 +213,11 @@ COPY --from=builder /usr/local/share /usr/local/share/
COPY --from=builder /usr/local/lib /usr/local/lib/
COPY --from=builder /usr/local/include /usr/local/include/

# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

ENV NVIDIA_DRIVER_CAPABILITIES=compute,utility,video
ENV DEBIAN_FRONTEND=nonintercative
WORKDIR /tmp/workdir
Expand Down
2 changes: 2 additions & 0 deletions docker-images/7.0/nvidia2404/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
Expand Down
8 changes: 8 additions & 0 deletions docker-images/7.0/scratch320/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ RUN buildDeps="autoconf \
fribidi \
fribidi-static \
fribidi-dev\
font-dejavu \
# https://github.com/libass/libass
libass \
libass-dev\
Expand Down Expand Up @@ -197,6 +198,13 @@ RUN /tmp/workdir/install_ffmpeg.sh --strip
### Release Stage
FROM alpine:3.20 AS release
# RUN apk add --no-cache --update bash less tree file vim
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
# Probably don't want the fc-* utilities in the scratch image
# COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local
COPY --from=builder /tmp/fakeroot/ /

Expand Down
3 changes: 3 additions & 0 deletions docker-images/7.0/scratch320/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
6 changes: 6 additions & 0 deletions docker-images/7.0/ubuntu2404-edge/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ RUN /tmp/workdir/install_ffmpeg.sh
# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04 AS runtime

# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/7.0/ubuntu2404-edge/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
8 changes: 7 additions & 1 deletion docker-images/7.0/ubuntu2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
Expand Down Expand Up @@ -189,6 +189,12 @@ RUN /tmp/workdir/install_ffmpeg.sh

# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04 AS runtime
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/7.0/ubuntu2404/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
10 changes: 8 additions & 2 deletions docker-images/7.0/vaapi2404/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ ARG OPENJP_PKGS="libopenjp2-7 libopenjp2-7-dev"
# libwebp7 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxpm4 linux-libc-dev
# manpages manpages-dev rpcsvc-proto zlib1g-dev
ARG FREETYPE_PKGS="libfreetype6-dev"
ARG FONTCONFIG_PKGS="libfontconfig-dev libfontconfig1 fontconfig-config fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG FONTCONFIG_PKGS="fontconfig libfontconfig-dev libfontconfig1 fontconfig-config fonts-dejavu-core fonts-dejavu-mono"
ARG VIDSTAB_PKGS="libvidstab-dev libvidstab1.1"
ARG FRIBIDI_PKGS="libfribidi-dev libfribidi0"
# libass-dev wanted to install a boat-load of packages
Expand Down Expand Up @@ -193,7 +193,13 @@ RUN /tmp/workdir/install_ffmpeg.sh


# Stage 2: Final Image ( shrink the size back down )
FROM ubuntu:24.04
FROM ubuntu:24.04 AS runtime
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local/

LABEL org.opencontainers.image.authors="julien@rottenberg.info" \
Expand Down
3 changes: 3 additions & 0 deletions docker-images/7.0/vaapi2404/build_source.sh
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,10 @@ build_ffmpeg() {
--enable-libbluray \
--enable-libdav1d \
--enable-libfdk-aac \
--enable-libfontconfig \
--enable-libfreetype \
--enable-libfribidi \
--enable-libharfbuzz \
--enable-libkvazaar \
--enable-libmp3lame \
--enable-libopencore-amrnb \
Expand Down
7 changes: 7 additions & 0 deletions docker-images/7.1/alpine320/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ RUN libDeps="libgomp \
fontconfig \
fontconfig-static \
fontconfig-dev \
font-dejavu \
# https://github.com/libass/libass
libass \
libass-dev \
Expand Down Expand Up @@ -198,6 +199,12 @@ RUN /tmp/workdir/install_ffmpeg.sh
### Release Stage
FROM alpine:3.20 AS release
# RUN apk add --no-cache --update bash less tree file vim
# Copy fonts and fontconfig from builder
COPY --from=builder /usr/share/fonts /usr/share/fonts
COPY --from=builder /usr/share/fontconfig /usr/share/fontconfig
COPY --from=builder /usr/bin/fc-* /usr/bin/

# Copy rest of the content
COPY --from=builder /usr/local /usr/local
COPY --from=builder /tmp/fakeroot/ /

Expand Down
Loading

0 comments on commit 9907f08

Please sign in to comment.