Skip to content
Advertisement

problem using ffmpeg drawtext for rtl languge

i use this command to write on a video:

 ffmpeg -i source.mp4 -vf drawtext="text_shaping=1:fontfile=font.ttf:
    text='یه نوشته فارسی!': fontcolor=black: fontsize=$font_size: box=1: boxcolor=black@0:boxborderw=0: x=(w-text_w)/2: y=(h-text_h)/2 :enable='between(t,5,10)'"  -c:a copy -force_key_frames 0:05:00,0:6:00 end.mp4

it work fine when i don’t have numbers and symbols(!,?,$ and …) in first and end of my text. my lang is right to left and this commmand not support rtl. what i must do to solve this problem ?

Advertisement

Answer

First of all, the issue isn’t really rtl or FFMPEG related. If you want to use characters like “!” you need to escape them. I was able to draw the text without any issues by escaping the exclamation mark (like this: text='مرحبا بيتر!'), without any other special measures taken.

Secondly, you should always be careful of leaving whitespace inside filters or in between filter parameters.

Thirdly, when asking questions it’s always better to provide additional details (like reports, logs etc.) and not general statements like “it’s not working”.

I know it’s already an old question, but I really hope this helps you and/or other people.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement