简体   繁体   中英

I am facing a problem with the cutout() tool in the moviepy library. The cutout() tool delet audio from the end of the video

I am facing a problem with the cutout() tool in the moviepy library. The problem is when i use cutout() it cuts the audio from the end of the video. for example: if I do this

clip1 = VideoFileClip("wow.mp4").cutout(2,4)
clip1.write_videofile("wow2.mp4")

it will 2 seconds from the end of the video. note: wow.mp4 is a 13 seconds video.

This what I see in the audio part when it runs. It doesn't continue until 100%:

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

chunk:   0%|          | 0/206 [00:00<?, ?it/s, now=None]
chunk:   1%|          | 2/206 [00:00<00:11, 18.41it/s, now=None]
chunk:  14%|#3        | 28/206 [00:00<00:07, 25.29it/s, now=None]
chunk:  30%|###       | 62/206 [00:00<00:04, 34.99it/s, now=None]
chunk:  49%|####9     | 101/206 [00:00<00:02, 48.13it/s, now=None]
chunk:  67%|######7   | 139/206 [00:00<00:01, 64.78it/s, now=None]
chunk:  84%|########4 | 174/206 [00:00<00:00, 85.36it/s, now=None]

MoviePy - Done.

I found a solution !

Essentially what you want to do is just go into your

python3/site-packages/moviepy/decorators.py

On line 45 change

- new_clip.audio = func(new_clip.audio, *args, **kwargs)

to

+ new_clip.audio = func(clip.audio, *args, **kwargs)

save file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM