[Python] Add audio to video using moviepy

Discussão em 'Python' iniciado por Stack, Julho 18, 2025.

  1. Stack

    Stack Membro Participativo

    Title basically explains it. Trying to add audio to a video. I have a sequence of mp3 files that I want to play sequentially during the video. There're no errors or anything with the code but when I run the code theres still no audio in the video. Just a recreation of the old video with no audio (the original video doesnt have audio either).

    video = VideoFileClip("finished_video.mp4")
    title_clip = AudioFileClip("title.mp3")

    audio_list = [title_clip]

    for x in range(1, counter):
    audio = AudioFileClip("p{}.mp3".format(x))
    audio_list.append(audio)

    video.set_audio(audio_list)
    video.write_videofile("new_filename.mp4")

    Continue reading...

Compartilhe esta Página