I'm trying to add an audio track to a video track with Moviepy. Here's the code :
videoClip = mp.VideoFileClip(os.path.join("VIDEOS", filename))
audioClip = mp.AudioFileClip(audio_file)
final = videoClip.set_audio(audioClip)
final.write_videofile(os.path.join("VIDEOS", filename), codec="mpeg4",
audio_codec="libvorbis")
return filename
But the video has:
- Bad quality
- It gets stuck after about 0.5s
Also when Chrome opens it, it's opened as an audio file, even if it has .mp4 extension.
Solution:
- Specify a higher bitrate
- Change the video output file to another
final.write_videofile(os.path.join("VIDEOS", filename2), codec="mpeg4", audio_codec="libvorbis", bitrate="12000k")