moviepy将一个视频的音频加入到另一个视频中
import os
import moviepy.video.io.ImageSequenceClip
from moviepy.editor import VideoFileClip
def add_mp3(video_src1, video_src2, video_dst):
' 将video_src1的音频嵌入video_src2视频中'
video_src1 = VideoFileClip(video_src1)
video_src2 = VideoFileClip(video_src2)
audio = video_src1.audio
videoclip2 = video_src2.set_audio(audio)
videoclip2.write_videofile(video_dst, codec='libx264')
video_src2 = 'E:\\VideoData\\VideoSRC\\src1.mp4'
video_src2 = 'E:\\VideoData\\VideoSRC\\src2.mp4'
video_dst = 'E:\\VideoData\\VideoDST\\11.mp4'
add_mp3(video_src1, video_src2, video_dst)