-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
MoviePy adds sound artifact to the end of the audio file after reading it #1936
Comments
+1 Thanks for posting this. I thought I was going crazy, or I implemented something odd, but every so often, maybe by the 3rd of 4th clip, its like the first microsecond of the audio is played back before the next file starts. It happens no matter what encoding I use for the audio. |
I ended up adding audio to my clips by specifying an audio file path to the video_clip.write_videofile(out_file_path, fps=moviepy_fps, audio=audio_path) |
So you have multiple clips? But then you have an audio_path? I don't get it, the clips have associated audios, then what is the audio_path for? How do you keep the audio for each clip synced with the clip? |
I have a single |
This is caused by ffmepg incorrectly reporting the duration of the audio. |
@jake-nz I thought it was maybe some kind of padding to get the correct fps but I don't see any pattern in length of the audios that produce artifact and the ones that don't. Update: audio = AudioFileClip(audio_path)
audio = audio.subclip(0, audio.duration - 0.05)
# Combine with image and add pause at the end (optional)
image_clip = ImageClip(image_path, duration=audio.duration + 0.2)
video_clip = image_clip.set_audio(audio) |
why is this closed while the problem is not solved ? |
Expected Behavior
The resulting audio file will be just a copy of the original one.
Actual Behavior
The resulting audio file has a small artifact added to its end.
Steps to Reproduce the Problem
Here is a code to reproduce the problem:
Example audio file:
https://soundcloud.com/yaroslav-schubert/sample-audio-to-reproduce-moviepy-issue/s-IZjaAlFxn3L
Here are the screenshots from Audacity:
End of the original audio file
End of the resulting audio file
Specifications
The text was updated successfully, but these errors were encountered: