Download raw body.
graphics/ffmpeg: Fix drawtext filter
Hi Brad, ports,
After upgrading to OpenBSD 7.7 I notice that the drawtext filter in FFmpeg no
longer works.
For example:
ffmpeg -i input.jpeg -vf "drawtext=fontsize=20:fontcolor=Red:fontfile='/usr/X11R6/lib/X11/fonts/TTF/DejaVuSans.ttf':text='test'" output.jpeg
The expected behaviour is to generate a new image file output.jpeg with the text
"test" in red on top-left corner. At the time of writing, running the command
gives the following error:
[AVFilterGraph @ 0xe9320c9fc00] No such filter: 'drawtext'
[vost#0:0/mjpeg @ 0xe9320c9b400] Error initializing a simple filtergraph
Looking at the manpage of ffmpeg-filters [0], regarding the drawtext filter, it
says:
To enable compilation of this filter, you need to configure FFmpeg with
"--enable-libfreetype" and "--enable-libharfbuzz". To enable default font
fallback and the font option you need to configure FFmpeg with
"--enable-libfontconfig". To enable the text_shaping option, you need to
configure FFmpeg with "--enable-libfribidi".
In the Makefile, all options are set, except "--enable-libharfbuzz". I can
confirm that the harfbuzz-11.0.0 package is installed on the computer, though.
This patch was prepared by Brad, I tested it on OpenBSD 7.7 amd64. I can see the
image file being generated as expected.
[0]: https://ffmpeg.org/ffmpeg-filters.html#drawtext-1
Ok?
Index: graphics/ffmpeg/Makefile
===================================================================
RCS file: /cvs/ports/graphics/ffmpeg/Makefile,v
diff -u -p -r1.244 Makefile
--- graphics/ffmpeg/Makefile 20 Mar 2025 08:48:34 -0000 1.244
+++ graphics/ffmpeg/Makefile 20 May 2025 07:11:56 -0000
@@ -2,7 +2,7 @@ COMMENT= audio/video converter and strea
V= 6.1.2
DISTNAME= ffmpeg-${V}
-REVISION= 1
+REVISION= 2
EPOCH= 1
CATEGORIES= graphics multimedia
SITES= https://ffmpeg.org/releases/
@@ -27,11 +27,11 @@ MAINTAINER= Brad Smith <brad@comstyle.co
PERMIT_PACKAGE= Yes
WANTLIB += SDL2 X11 Xext Xv aom ass bz2 c crypto dav1d fontconfig
-WANTLIB += freetype fribidi gsm iconv lzma m mp3lame opus pthread
-WANTLIB += sndio speex ssl theoradec theoraenc v4l2 va va-drm
-WANTLIB += va-x11 vidstab vorbis vorbisenc vpx webp webpmux x264
-WANTLIB += x265 xcb xcb-shape xcb-shm xcb-xfixes xml2 xvidcore z
-WANTLIB += zimg
+WANTLIB += freetype fribidi gsm harfbuzz iconv lzma m mp3lame opus
+WANTLIB += pthread sndio speex ssl theoradec theoraenc v4l2 va
+WANTLIB += va-drm va-x11 vidstab vorbis vorbisenc vpx webp webpmux
+WANTLIB += x264 x265 xcb xcb-shape xcb-shm xcb-xfixes xml2 xvidcore
+WANTLIB += z zimg
COMPILER= base-clang ports-gcc
COMPILER_LANGS= c
@@ -52,6 +52,7 @@ LIB_DEPENDS= archivers/bzip2 \
audio/speex \
audio/gsm \
converters/libiconv \
+ devel/harfbuzz \
devel/sdl2 \
graphics/libwebp \
graphics/zimg \
@@ -120,6 +121,7 @@ CONFIGURE_ARGS+=--enable-shared \
--enable-libfreetype \
--enable-libfribidi \
--enable-libgsm \
+ --enable-libharfbuzz \
--enable-libmp3lame \
--enable-libopus \
--enable-libspeex \
graphics/ffmpeg: Fix drawtext filter