0

I'm trying to visually manipulate a video by taking the following steps:

  1. Breaking the video into frames (using CV2)
  2. Editing each frame (using PIL)
  3. Compiling the frames back into a new video (using moviepy)

I'd like to use the audio of the original video in the newly created video. To do that I first extract the audio from the original video like this:

video = VideoFileClip("original_video.mp4") 
video.audio.write_audiofile("audio.mp3")

For some reason, the last few seconds of the newly created audio file ("audio.mp3") repeats themselves 2-3 times at the end of the recording. I'm not sure why it happens or how to avoid it.

I'd appreciate your help.

Thanks.

Sefi_k
  • 87
  • 8
  • If you use something besides MP3 (it's 28 years old at this point), does that fix the issue? MP3s have issues with gaps at the beginning and end, and I wouldn't be too surprised if using another format, like AAC or even just WAV, could fix the issue. – Random Davis Jul 15 '21 at 19:30
  • Does the problem related to the 3 steps you are describing above, or is it just related to the two lines of code? – Rotem Jul 15 '21 at 19:34
  • @Rotem I believe the problem isn't related to the 3 steps but I was hoping describing the macro process might give someone an idea that will make the specific problem redundant. – Sefi_k Jul 15 '21 at 19:36
  • @RandomDavis using WAV doesn't solve the problem – Sefi_k Jul 15 '21 at 19:43

0 Answers0