Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moviepy 2.0 : TypeError: 'float' object cannot be interpreted as an integer #2287

Closed
q273255702 opened this issue Dec 10, 2024 · 1 comment
Closed
Labels
bug Issues that report (apparent) bugs.

Comments

@q273255702
Copy link

q273255702 commented Dec 10, 2024

when use SubtitlesClip.

sub = SubtitlesClip(subtitle_path, font_path, encoding="utf-8")     ###ERROR HERE
text_clips = []
for item in sub.subtitles:
    clip = create_text_clip(subtitle_item=item)
    text_clips.append(clip)
video_clip = CompositeVideoClip([video_clip, *text_clips])

error:

Traceback (most recent call last):
  File "/Users/jack/Ai/MoneyPrinterTurbo/.venv/lib/python3.11/site-packages/PIL/ImageDraw.py", line 443, in draw_text
    mask, offset = font.getmask2(
                   ^^^^^^^^^^^^^^
  File "/Users/jack/Ai/MoneyPrinterTurbo/.venv/lib/python3.11/site-packages/PIL/ImageFont.py", line 748, in getmask2
    im = fill("RGBA" if mode == "RGBA" else "L", size, 0)
**TypeError: 'float' object cannot be interpreted as an integer**

moviepy. update. 2.0!

how can i do ??

python 3.11
pillow~=10.0.0

@q273255702 q273255702 added the bug Issues that report (apparent) bugs. label Dec 10, 2024
@OsaAjani
Copy link
Collaborator

I cannot reproduce the bug, so I guess it must come from your create_text_clip function, also I dont understand the objective of your demo code, you shouldn't need to iterate of subtitles, if you need some code to custom handling generation of subtitles you should look into the make_textclip parameter of SubtitlesClip instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

2 participants