how could i fix the problem about srt file process
my project is a image convert to video include srt text then merge all in one new video but stuck the srt stage now
when srt content include traditional chinese text or char will show error (even i use traditional chinese font file) but if all english text content will no error
my python code
import os
import glob
from moviepy.editor import CompositeAudioClip, VideoFileClip, AudioFileClip
from moviepy.video.tools.subtitles import SubtitlesClip
from PyQt6.QtGui import QColor
from moviepy.editor import *
srt = ("./test.srt")
generator = lambda txt: TextClip(txt, font='./TaipeiSansTCBeta-Bold.ttf',fontsize=20, color='white')
sub = SubtitlesClip(srt, generator).set_position((250,250))
my srt content
1
00:00:00,000 --> 00:00:03,000
繁體中文(this is traditional chinese text)
2
00:00:04,000 --> 00:00:07,000
bbbbbbbbbbbb
3
00:00:08,000 --> 00:00:11,000
ccccccccccc
4
00:00:12,000 --> 00:00:15,000
ddddddddddddddd
my error message
C:\Users\uting\PycharmProjects\imgs_to_video_v1\venv\Scripts\python.exe C:/Users/uting/PycharmProjects/imgs_to_video_v1/test/test01.py
Traceback (most recent call last):
File "C:\Users\uting\PycharmProjects\imgs_to_video_v1\test\test01.py", line 11, in <module>
sub = SubtitlesClip(srt, generator).set_position((250,250))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\uting\PycharmProjects\imgs_to_video_v1\venv\Lib\site-packages\moviepy\video\tools\subtitles.py", line 42, in __init__
subtitles = file_to_subtitles(subtitles)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\uting\PycharmProjects\imgs_to_video_v1\venv\Lib\site-packages\moviepy\video\tools\subtitles.py", line 154, in file_to_subtitles
for line in f:
UnicodeDecodeError: 'cp950' codec can't decode byte 0x81 in position 36: illegal multibyte sequence
Process finished with exit code 1
Finally I find the key problem
not code
Need to install imagemagick
And the srt file need to save as ansi Into Coding structure
compile will successful