Skip to content

Commit

Permalink
Merge pull request #2271 from akx/sub-correct
Browse files Browse the repository at this point in the history
Correct SubtitlesClip example to not pass the generator lambda as `font`
  • Loading branch information
OsaAjani authored Jan 5, 2025
2 parents b52b487 + ae799ea commit 261a32a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions moviepy/video/tools/subtitles.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ class SubtitlesClip(VideoClip):
from moviepy.video.tools.subtitles import SubtitlesClip
from moviepy.video.io.VideoFileClip import VideoFileClip
generator = lambda text: TextClip(text, font='Georgia-Regular',
generator = lambda text: TextClip(text, font='./path/to/font.ttf',
font_size=24, color='white')
sub = SubtitlesClip("subtitles.srt", generator)
sub = SubtitlesClip("subtitles.srt", generator, encoding='utf-8')
sub = SubtitlesClip("subtitles.srt", make_textclip=generator, encoding='utf-8')
myvideo = VideoFileClip("myvideo.avi")
final = CompositeVideoClip([clip, subtitles])
final.write_videofile("final.mp4", fps=myvideo.fps)
Expand Down

0 comments on commit 261a32a

Please sign in to comment.