0

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:

  1. Bad quality
  2. 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:

  1. Specify a higher bitrate
  2. Change the video output file to another
final.write_videofile(os.path.join("VIDEOS", filename2), codec="mpeg4", audio_codec="libvorbis", bitrate="12000k")
Ldvlpr
  • 33
  • 1
  • 6

1 Answers1

1

You can't write into the same filename that you are reading from. @Tom Burrows

Ldvlpr
  • 33
  • 1
  • 6