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 01 Answer
Reset to default 2Since 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/
本文标签:
版权声明:本文标题:python - Why does "'VideoFileClip' object has no attribute 'subclip'" error oc 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742075738a2419397.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论