gonypy可以添加阿拉伯语字幕Python
我遇到了一个问题,我无法将阿拉伯语字幕添加到mp4
视频中。我的旧笔记本电脑运行ubuntu 20.04
可以用阿拉伯语字幕导出视频。但是在运行Ubuntu的新PC上,20.04
我似乎无法做同样的事情。
请查看下面的代码。
generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
subtitles = SubtitlesClip(final_subs, generator)
video = VideoFileClip("english.mp4")
result = CompositeVideoClip([video, subtitles.set_pos(('center','bottom'))])
result.write_videofile("output_english.mp4", fps=video.fps, temp_audiofile="temp-audio.m4a", codec="libx264", audio_codec="aac", threads=12, verbose=False)
导出的视频仅包含标点符号,而不包含阿拉伯文字。我尝试了其他语言,它们正常工作,仅使用阿拉伯语的情况下,
I am having an issue where i am unable to add arabic subtitles to an mp4
video. My old laptop running Ubuntu 20.04
can export video with arabic subtitles just fine. But on a new PC running Ubuntu 20.04
i cant't seem to do the same thing.
Please have a look of the code below.
generator = lambda txt: TextClip(txt, font='Arial', fontsize=24, color='white')
subtitles = SubtitlesClip(final_subs, generator)
video = VideoFileClip("english.mp4")
result = CompositeVideoClip([video, subtitles.set_pos(('center','bottom'))])
result.write_videofile("output_english.mp4", fps=video.fps, temp_audiofile="temp-audio.m4a", codec="libx264", audio_codec="aac", threads=12, verbose=False)
Where this is the content of final_subs
The exported video has contains only the sentence punctuation, and not the Arabic text. I have tried other languages and they work fine, this is only the case with Arabic
The image below shows the punctuation subtitles without text.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
经过很长时间的调查后,我发现新系统没有安装阿拉伯字体。
我使用以下命令安装了Microsoft Arabic Fonts。
验证安装运行以下命令。
fc-手牌Arial
该视频已成功地用阿拉伯语字幕导出,但需要重塑,因为阿拉伯文本是镜像的。我使用
Arabic_reshaper
重塑了文本。After investigating for a long time, I found that the new system doesnt have arabic fonts installed.
I have used the following command to install Microsoft arabic fonts.
To verify installation run the following command.
fc-match Arial
The video was exported successfully with the Arabic subtitles, but needed to be reshaped because the arabic text was mirrored. I reshaped the text using
arabic_reshaper
.