Recently, there was a business that needed to merge video and audio. After a fierce search, I found Moviepy, which was really useful, but also had disadvantages. After merging several videos and adding audio, I found it could not be added, so I checked FFMPEG and found the following methods

    def video_add_mp3(times, file_name, mp3_file) :  Add sound to the video
        outfile_name = file_name.split('. ') [0] + '-end.mp4'
        subprocess.call("ffmpeg -i %s -i %s -t %s -y %s" % (mp3_file, file_name, times, outfile_name))
        return outfile_name
Times is the video length, file_name is the video address, and mp3_file is the audio addressOk so run itCopy the code