Zulko / moviepy

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

Framerate suffers and doubles length of video when previewing a clip using a PNG file #1973

Open Philosopho opened 1 year ago

Philosopho commented 1 year ago

Hello!

Whenever I use a PNG file and preview it, the framerate of the VideoClip suffers and doubles the length of the video. Although there is no framerate issue when writing to the file, I would like to preview the video before writing it to reduce the wear on my SSD.

I don't understand why this happens? When I convert it to a JPG, there is no framerate issue when previewing, but I can't use transparency anymore which I need.

Is there anything I can do to preview using PNG without framerate issue? I tried reducing the size, reducing the fps of the ImageClip but that didn't work. Thank you!

MoviePy version: 1.0.3

Here's the code:

duration = 2
azure: ImageClip = ImageClip(r'../images/Azure11.png', duration=duration).resize(height=1080)
car: VideoFileClip = VideoFileClip("../videos/driving_720.mp4")
audio_clip: AudioFileClip = AudioFileClip("../audio/cute avalanche.mp3")
shocked: VideoFileClip = VideoFileClip("../videos/shocked man 1080.mp4")

clips = [shocked, car, azure]

c: CompositeVideoClip = CompositeVideoClip(clips, size=shocked.size).set_audio(audio_clip).set_duration(duration).resize(height=480)
c.preview(audio=False)
for clip in clips:
    clip.close()
audio_clip.close()
c.close() 
keikoro commented 1 year ago

Please always include your specs like we ask for in our issue templates – MoviePy version, platform used etc. – to help pinpoint what causes your problem, thanks.