ffmpeg drawtext - 阿拉伯字体无法正确呈现

ffmpeg drawtext - 阿拉伯字体无法正确呈现

我想要实现的目标:

将图像循环放入视频中,并使用自定义字体在其上叠加《古兰经》中的阿拉伯语文本(包括文本变音符号)。

要呈现的文本示例:

بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ

使用的字体: https://fonts.qurancomplex.gov.sa/wp02/wp-content/uploads/2024/01/UthmanicHafs_v22.zip

字体的unicode模块:

Unicode Module 
 
The Research and Development Unit in the Computer Department at King Fahd Glorious Qur’an Printing Complex relied on the unicode system unicode to create (Hafs) font in the Uthmanic Script, because this system is followed globally among computer and systems manufacturing companies in the world.

Unicode organization is a global code group that is used to define all codes and letters used in most of the world's languages and gathered in one code to facilitate the presentation and delivery on information despite of the language used. This global coding uses 1 to 4 bytes (byte = 8 bits) to encode letters, and so far only a third of the number available in Unicode organization to encode the letters of these languages.

Taking into account Hafs font with the Uthmanic Script, which was built entirely on the unicode system. We can explore the basic letters that were formed according to the following figure:

Whereas the font was developed starting from code (0600) to code (066FF), taking into account there are several encoded letters that haven't been used at all so they were replaced with the code []. The displayed copy above is the one that is been developed from the basic Arabic coding (0600-06FF) which was updated by Unicode organization in 2009.

预期结果:

使用给定的字体导出具有正确呈现文本的视频。

实际结果:

呈现的文本仅包含变音符号(字母顶部的重音符号),而不包含实际字母。

结果图像

我尝试过的:

这是我的测试命令,它仅导出图像以获得更快的结果:

Ffmpeg -loop 1  -i "image-2.jpg" -vf "drawtext=text='بِسْمِ ٱللَّهِ ٱلرَّحْمَـٰنِ ٱلرَّحِيمِ':fontsize=124:fontcolor=white:fontfile='UthmanicHafsV22.ttf':x=(w-text_w)/2:y=(h-text_h)/2" -frames:v 1  "output.png"
  • 尝试添加ft_load_flags,几乎尝试了所有
  • 尝试过text_shaping=1,但没有成功
  • 尝试过textfile而不是text
  • 尝试过更换字体,但每次尝试使用任何字体时,总会遇到不同的问题,要么是出现方框,要么是变音符号

ffmpegPS - 我在 MacOS 终端上自己编译的最新版本(启用了所有必需的库)和 上都得到了相同的结果flutter ffmpeg kit full gpl

相关内容