admin管理员组

文章数量:1323224

i'm using MoviePy version 2.1.2, and I'm encountering the following error:

AttributeError: 'VideoFileClip' object has no attribute 'subclip'

Here is the code snippet where the error occurs:

from moviepy.editor import VideoFileClip

clip = VideoFileClip("example.mp4")
subclip = clip.subclip(10, 20)  # Extracts a 10-second clip
subclip.write_videofile("output.mp4")

This same code worked perfectly in an older version of MoviePy. I'm guessing there might have been changes or deprecations in the latest version.

MoviePy version: 2.1.2 Python version: 3.9.10

Could someone please confirm if subclip() has been renamed, removed, or replaced with a different method? If so, what is the new way to extract a portion of a video?

Any help or documentation references would be greatly appreciated!

i'm using MoviePy version 2.1.2, and I'm encountering the following error:

AttributeError: 'VideoFileClip' object has no attribute 'subclip'

Here is the code snippet where the error occurs:

from moviepy.editor import VideoFileClip

clip = VideoFileClip("example.mp4")
subclip = clip.subclip(10, 20)  # Extracts a 10-second clip
subclip.write_videofile("output.mp4")

This same code worked perfectly in an older version of MoviePy. I'm guessing there might have been changes or deprecations in the latest version.

MoviePy version: 2.1.2 Python version: 3.9.10

Could someone please confirm if subclip() has been renamed, removed, or replaced with a different method? If so, what is the new way to extract a portion of a video?

Any help or documentation references would be greatly appreciated!

Share Improve this question asked Jan 18 at 10:47 whoistariwhoistari 639 bronze badges 0
Add a comment  | 

1 Answer 1

Reset to default 2

Since moviepy 2, you can import the VideoFileClip class directly from moviepy. So your import statement should be:

from moviepy import VideoFileClip

Also you're getting the error because you're calling the wrong method here clip.subclip(10, 20) it should be:

subclip = clip.subclipped(10, 20)

See the Example on https://pypi./project/moviepy/

本文标签: