Zulko / moviepy

Video editing with Python
https://zulko.github.io/moviepy/
MIT License
12.09k stars 1.51k forks source link

TextClip with_position(relative=True) displays two clips #2055

Closed kandeng closed 8 months ago

kandeng commented 8 months ago
#  1. Save this program as 'textclip_moviepy.py'
#  2. Put a jpg image in the same file directory, name it as 'snowy_forrest.jpg'
#  3. To execute the program,  $ python textclip_moviepy.py

from moviepy.editor import *

image_clip = ImageClip("snowy_forrest.jpg")

text_clip = TextClip(
    text="Welcome to the world!".upper(),
    size=(.8*image_clip.size[0], 0),
    font="Helvetica-Narrow",
    color="black",
    bg_color="transparent"
    )

# text_clip = text_clip.with_position('center')
text_clip = text_clip.with_position((0.15,0.55), relative=True)

final_clip = CompositeVideoClip([image_clip, text_clip])
final_clip.save_frame("textclip_moviepy.png")

Expected Behavior

  1. Only one text clip on top of the image,
  2. The background color is transparent.

Actual Behavior

  1. Two text clips display.
  2. The one text clip at the initial corner of the image with non-transparent background color.

Steps to Reproduce the Problem

  1. Save this program as 'textclip_moviepy.py'
  2. Put a jpg image in the same file directory, name it as 'snowy_forrest.jpg'
  3. To execute the program, $ python textclip_moviepy.py

Specifications

textclip_moviepy

kandeng commented 8 months ago

The bug has been found. In fact, the version I used was not 1.0.3.

Solution: pip install -U moviepy