Zulko / moviepy

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

Audio getting out of sync when merging back audio and video #2124

Open WaqarAnwar opened 4 months ago

WaqarAnwar commented 4 months ago
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