Search code examples
ffmpegdrawtext

German umlauts in ffmpeg drawtext filter


I need help getting german umlauts 'äüö' displayed properly/(at all) in ffmpeg drawtext filter. I can't say at this time if my inability comes from lack of ffmpeg know-how or machine configuration or both. Your input is much appreciated.

In ffmpeg cmd line I have :

/home/tools/bin/ffmpeg -loop 1 -i RAW2TIF_01_png_1080/IMG_1119.png -c:v libx264 -vf drawtext="fontsize=60:fontcolor=yellow:fontfile=/usr/share/fonts/truetype/freefont/FreeSans.ttf:textfile=./Scripts/header_text.txt:x=(w-text_w)/2:y=(h-text_h-line_h)/2" -t 10 -pix_fmt yuv420p  -crf 16 -r 24 -y ./Video/header_txt.mp4

Note the 'drawtext' call.

My linux machine where I run ffmpeg is setup for US keyboard and characters. So my first roadblock is to get the umlauts into the text in some editor. I tried typing 'alt-numerical' sequences, but the special characters will not show in vi, vim, emacs.

If I were to have the special characters in a textfile I would not know if/how ffmpeg is able to handle them.

A search on popular engine for 'ffmpeg drawtext umlaut' does not return any (for me) meaningful returns.

Thanks, Gert


Solution

  • Use a unicode font, and make sure the text file is a sequence of UTF-8 characters. ASCII codes won't work.