prog_SAHIL
prog_SAHIL

Reputation: 63

No audio on concatenating clips in MoviePy

I am trying to concatenate two clips using MoviePy [ Windows 10 , Python 3.7.4 ] , but there is no audio in the output video. I can see the temporary audio file while the videos are being concatenated.

from moviepy.editor import VideoFileClip, concatenate_videoclips

clip1 = VideoFileClip("C1.mp4")
clip2 = VideoFileClip("C2.mp4")
final_clip = concatenate_videoclips([clip1,clip2])
final_clip.write_videofile("my_concatenation.mp4")

Terminal gives this ouput,

Moviepy - Building video my_concatenation.mp4.
MoviePy - Writing audio in %s
MoviePy - Done.
Moviepy - Writing video my_concatenation.mp4

Moviepy - Done !
Moviepy - video ready my_concatenation.mp4

I have also tried this answer but it doesn't solve the issue. Any ideas why this might be happening?

Upvotes: 1

Views: 2366

Answers (2)

user9695535
user9695535

Reputation: 1

The issue is caused by a ffmpeg parameter , just go to moviepy -> video -> io -> ffmpeg_wrtier.py. Then search for ['-i', '-', '-an']. Then change the order into ['-an','-i','-']. Now the audio will work in any player. The first order binds the -an flag to the next stream, which is the audio file (which is subsequently ignored).

Upvotes: 0

Tom Burrows
Tom Burrows

Reputation: 2365

Update MoviePy to v1.0.2 or greater, or apply the changes from https://github.com/Zulko/moviepy/pull/968 to your installation.

Upvotes: 2

Related Questions