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

Audio glitches when using concatenate_videoclips. #1005

Closed
josewails opened this issue Sep 5, 2019 · 3 comments
Closed

Audio glitches when using concatenate_videoclips. #1005

josewails opened this issue Sep 5, 2019 · 3 comments
Labels
audio Related to AudioClip, or handling of audio in general. video Related to VideoClip and related classes, or handling of video in general.

Comments

@josewails
Copy link

I have written a function that creates a bunch of video clips and then finally combines them into one.

`
def process_video(self):

    """

    This combines the text and audio into a video

    """

    intermediate_clips = list()

    n = len(self.audio_paths)

    first_clip = self.make_first_clip()
    last_clip = self.make_last_clip()

    for i in range(1, n - 1):
        self.current_index = i

        intermediate_clips.append(self.make_sliding_video_clip())
        intermediate_clips.append(self.make_video_clip())

    self.current_index = 0
    final_clips = [first_clip] + intermediate_clips + [last_clip]

    final_clip = concatenate_videoclips(final_clips, method='compose')
    final_clip.write_videofile('final.mp4', fps=60, codec='mpeg4')

`

However, the resulting clip has some audio glitches.

Here is the resulting video. https://www.youtube.com/watch?v=QYURIo3dWPk. If you watch it, you will realize there are a couple of glitches at the end of the clips. Doesn't happen all the time but sometimes.

Any ideas on how to avoid those glitches?

@Zulko
Copy link
Owner

Zulko commented Sep 5, 2019

I can't hear much glitching, but the best way to remove it would be to add a 0.01 second audio fade-in/fade-out in all your clips:

final_clips = [
    clip.audio_fadein(0.01).audio_fadeout(0.01)
    for clip in ([first_clip] + intermediate_clips + [last_clip])
]

@josewails
Copy link
Author

@Zulko. Thanks a lot for this. The audio_fade effect did the trick.

@jake-nz
Copy link

jake-nz commented Sep 29, 2023

This problem has been reported many many times.
#1854
#1005
#1717
#1710
#1936

Here's the root cause: #1936 (comment)

@keikoro keikoro added audio Related to AudioClip, or handling of audio in general. video Related to VideoClip and related classes, or handling of video in general. labels Feb 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
audio Related to AudioClip, or handling of audio in general. video Related to VideoClip and related classes, or handling of video in general.
Projects
None yet
Development

No branches or pull requests

4 participants