You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trying to create a SubtitlesClip without make_textclip() causes a TypeError
Steps to Reproduce the Problem
from moviepy.video.tools.subtitles import SubtitlesClip
from moviepy import VideoFileClip, CompositeVideoClip
video = VideoFileClip(filename="video.mp4")
subtitles = SubtitlesClip(subtitles="subtitles.srt", font="font.otf") # ERROR
output = CompositeVideoClip([video, subtitles])
output.write_videofile("output.mp4", fps=24)
Traceback (most recent call last):
File "c:\Users\Yeo Hong\Desktop\test\test.py", line 6, in <module>
subtitles = SubtitlesClip(subtitles="subtitles.srt", font="font.otf")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\moviepy\video\tools\subtitles.py", line 123, in __init__
hasmask = bool(self.make_textclip("T").mask)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\moviepy\video\tools\subtitles.py", line 76, in make_textclip
return TextClip(
^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\decorator.py", line 232, in fun
return caller(func, *(extras + args), **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\moviepy\decorators.py", line 94, in wrapper
return func(*new_args, **new_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\moviepy\video\VideoClip.py", line 1763, in __init__
draw.multiline_text(
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\PIL\ImageDraw.py", line 775, in multiline_text
self.text(
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\PIL\ImageDraw.py", line 690, in text
draw_text(stroke_ink, stroke_width)
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\PIL\ImageDraw.py", line 635, in draw_text
mask, offset = font.getmask2( # type: ignore[union-attr,misc]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Yeo Hong\Desktop\test\.venv\Lib\site-packages\PIL\ImageFont.py", line 607, in getmask2
return self.font.render(
^^^^^^^^^^^^^^^^^
TypeError: 'float' object cannot be interpreted as an integer
Specifications
Python Version: 3.12.4
MoviePy Version: v2.1.1
The text was updated successfully, but these errors were encountered:
Trying to create a SubtitlesClip without make_textclip() causes a TypeError
Steps to Reproduce the Problem
Specifications
The text was updated successfully, but these errors were encountered: