最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

python - Why does "'VideoFileClip' object has no attribute 'subclip'" error oc

programmeradmin3浏览0评论

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/

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论