moviepy icon indicating copy to clipboard operation
moviepy copied to clipboard

concatenate_videoclips introduces audio loops

Open akrost opened this issue 4 years ago • 4 comments

I create two mp4 files using moviepy. They have audio tracks that are shorter than the video itself. If I write the clips to files they look and sound all good. Now I want to concatenate the two videos.

import moviepy.editor import as mpy
clip1 = mpy.VideoFileClip("path/to/clip1")
clip2 = mpy.VideoFileClip("path/to/clip2")
final_clip = mpy.concatenate_videoclips([clip1, clip2])
final_clip.write_videofile("path/to/target", fps=self.config.fps)

Expected Behavior

Both clips are combined into one clip, one clip after the other without changing the clip itself. Sound should end when it's over, even when video is not over yet. Since the audio is shorter than the video for both clips the sequence should look like: Video With Audio (clip1) - Only Video (clip1) - Video With Audio (clip2) - Only Video (clip2)

Actual Behavior

The parts of the clips where the audio is over in the original clip are filled with looping of the last second or so of the audio. So the sequence actually looks like: Video With Audio (clip1) - Video with last sec of audio looping (clip1) - Video With Audio (clip2) - Video with last sec of audio looping (clip2)

The audio should be over at the black vertical line, but instead it is looping. Screenshot from 2021-01-16 21-59-24

Specifications

  • Python Version: 3.8.5
  • Moviepy Version: 1.0.3
  • Platform Name: Ubuntu
  • Platform Version: 18.04.5 LTS

akrost avatar Jan 16 '21 21:01 akrost

I got the same issue.

a0000001 avatar Jul 21 '22 12:07 a0000001

Hi ! I have the same issue, did you succeed solving the problem ?

Thanks

arthurdbpt avatar Feb 20 '23 10:02 arthurdbpt

Same issue! +1

FujiwaraChoki avatar Sep 24 '23 16:09 FujiwaraChoki

same issue +1

The audio and the video track have the same duration. However, when using the concatenate_videoclips and write_videofile functions, an unusual sound appears after the video track ends. Additionally, an extra frame is added at the beginning of the initial video track, but once this frame passes, the concatenated clip operates normally.

audio-glitch

COROYO avatar Oct 18 '23 11:10 COROYO