I am using this code to add an audio file to a video file in Python, but, when video ends, the audio keeps playing until the end. I want to end when the video ends.
Any suggestion?
from moviepy.editor import *
videoclip = VideoFileClip(filename)
audioclip = AudioFileClip("audio.mp3")
new_audioclip = CompositeAudioClip([audioclip])
videoclip.audio = new_audioclip
videoclip.write_videofile("new_filename.mp4")