moviepy icon indicating copy to clipboard operation
moviepy copied to clipboard

Audio getting out of sync when merging back audio and video

Open WaqarAnwar opened this issue 11 months ago • 0 comments

import moviepy.editor as mp
#Input audio file
audio = mp.AudioFileClip('a.mp3')
#Input video file
video = mp.VideoFileClip('a.mp4')
#adding external audio to video
final_video = video.set_audio(audio)
#Extracting final output video
final_video.write_videofile("a Denoised.mp4")

Expected Behavior

When I denoise an audio file and merge it back into the video, then the audio and video should be perfectly in sync.

Actual Behavior

When I merge back audio and video after denoising audio from the video file, then after around 1 hour of video, the audio and video go out of sync i.e. offtrack.

Steps to Reproduce the Problem

  1. Split audio and video from a video file into separate parts (the video must be longer than an hour).
  2. Then merge back audio and video using the above provided code.
  3. In the output video file, the video and audio will go out of sync after around 1 hour.

Specifications

  • Python Version: 3.8.10
  • MoviePy Version: 1.0.3
  • Platform Name: Linux Mint
  • Platform Version: Linux Mint 20.1 Cinnamon

WaqarAnwar avatar Feb 29 '24 10:02 WaqarAnwar