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

Steven Kan steven at kan.org
Sun Dec 27 21:01:38 EET 2020


I am attempting to overlay the text, “Room Temp Water, No Heat Mat” onto some video.

If I use that exact string, the comma renders as a white box. According to the drawtext documentation, I should escape the comma, but depending on the context I may have to escape the escape character before the comma, etc.

Values from 0 to 7 escape slashes do not work, as they each result in a white box where I want my comma. This results in 8 white boxes:

./ffmpeg -i /Users/steven/Documents/Baking/4Up.mp4 -vf "drawtext=fontfile=/System/Library/Fonts/Keyboard.ttf: text='Room Temp Water,\,\\,\\\,\\\\,\\\\\,\\\\\\,\\\\\\\ No Heat Mat': fontcolor=white: fontsize=24: box=1: boxcolor=black at 0.5: boxborderw=5: x=(w-text_w)*0.05: y=(h-text_h)*0.05" -c:v libx264 /Users/steven/Documents/Baking/TextwOverlay.mp4

What is the proper way to insert a literal comma into the text argument of drawtext?

Or should I continue adding slashes until it works? ;-) 

Thanks!


More information about the ffmpeg-user mailing list