[FFmpeg-user] How to properly escape a literal comma ", " in drawtext filter text?

Carl Zwanzig cpz at tuunq.com
Tue Dec 29 03:44:14 EET 2020

On 12/28/2020 5:20 PM, Steven Kan wrote:
> Hmmm. I just tried:
> ./ffmpeg -i /Users/steven/Documents/Baking/4Up.mp4 -t 00:00:02 -vf drawtext="fontfile=/System/Library/Fonts/Keyboard.ttf: fontcolor=white: textfile=/Users/steven/Documents/Baking/UpperLeft.txt'" -c:v libx264 /Users/steven/Documents/Baking/TextwOverlayTest.mp4

> where the file UpperLeft.txt contains "Room Temp Water, No Heat
Mat,,,,,,,,,” and all the commas renders as boxes.

We know it's not the shell messing with things, then. Did you also try it as 
\, just to see what happens? (If I have a chance later tonight, I might look 
into the filter's source code.)

> Text encoding for UpperLeft.txt is UTF-8.
> Does this indicate that this is happening within drawtext itself?

Assuming that \, in a files doesn't work nicely, then it's either there or 
in the rendering library. However, it might not actually be an error, just 
unwanted. The question I might have asked earlier- is that really a comma 
(0x2C) in the file? There are a few possibilities for why it might not be. 
It's also possible that the truetype libs might be rendering the value into 
a different visual bitmap. Most of those would be outside the realm of 
ffmpeg and into your system's font configurations.

(Please let us know what you find.)



More information about the ffmpeg-user mailing list