简体   繁体   English

尝试使用 moviepy 编写 CompositeVideoClip 时,如何修复“AttributeError:‘NoneType’对象没有属性‘stdout’”?

[英]How do I fix "AttributeError: 'NoneType' object has no attribute 'stdout'" when trying to write a CompositeVideoClip with moviepy?

I am using the following:我正在使用以下内容:

from moviepy.editor import *

ukulele = VideoFileClip("./clips/513732763.mp4")

txt = TextClip("some text", color='white').set_duration(3)

final = CompositeVideoClip([ukulele,txt])
final.write_videofile("video.mp4",codec="libx264")

What I am trying to do is to add text over a video file clip.我想要做的是在视频文件剪辑上添加文本。 Writing normally with VideoFileClip is working, however, when using CompositeVideoClip it doesn't.使用 VideoFileClip 正常编写是可行的,但是,当使用 CompositeVideoClip 时则不起作用。 However, when running with Python 3.6.9 I get the following errors:但是,在使用 Python 3.6.9 运行时出现以下错误:

Moviepy - Building video video.mp4.
MoviePy - Writing audio in videoTEMP_MPY_wvf_snd.mp3
chunk:  12% 52/447 [00:00<00:00, 518.22it/s, now=None]Traceback (most recent call last):
  File "main.py", line 8, in <module>
    final.write_videofile("video.mp4",codec="libx264")
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-51>", line 2, in write_videofile
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-50>", line 2, in write_videofile
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-49>", line 2, in write_videofile
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
    return f(clip, *a, **k)
  File "/usr/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 317, in write_videofile
    logger=logger)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-73>", line 2, in write_audiofile
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 209, in write_audiofile
    logger=logger)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-70>", line 2, in ffmpeg_audiowrite
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/io/ffmpeg_audiowriter.py", line 169, in ffmpeg_audiowrite
    logger=logger):
  File "/usr/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 85, in iter_chunks
    fps=fps, buffersize=chunksize)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-72>", line 2, in to_soundarray
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 54, in requires_duration
    return f(clip, *a, **k)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 126, in to_soundarray
    snd_array = self.get_frame(tt)
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-10>", line 2, in get_frame
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 296, in make_frame
    for c, part in zip(self.clips, played_parts)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/AudioClip.py", line 297, in <listcomp>
    if (part is not False)]
  File "</usr/lib/python3.6/site-packages/decorator.py:decorator-gen-10>", line 2, in get_frame
  File "/usr/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "/usr/lib/python3.6/site-packages/moviepy/Clip.py", line 95, in get_frame
    return self.make_frame(t)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/io/AudioFileClip.py", line 78, in <lambda>
    self.make_frame = lambda t: self.reader.get_frame(t)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/io/readers.py", line 184, in get_frame
    self.buffer_around(fr_max)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/io/readers.py", line 238, in buffer_around
    array = self.read_chunk(chunksize)
  File "/usr/lib/python3.6/site-packages/moviepy/audio/io/readers.py", line 112, in read_chunk
    s = self.proc.stdout.read(L)
AttributeError: 'NoneType' object has no attribute 'stdout'

Everything is correct and is working except for writing the CompositeVideoClip.除了编写 CompositeVideoClip 之外,一切都是正确的并且正在工作。 How would I go about fixing this?我将如何解决这个问题?

This is a known issue with moveipy 1.0.1 that has an open github issue here https://github.com/Zulko/moviepy/issues/938这是 moveipy 1.0.1 的一个已知问题,这里有一个开放的 github 问题https://github.com/Zulko/moviepy/issues/938

For now the best course of action seems to be reverting to version 1.0.0 which has helped a few people on that thread and myself also.现在最好的做法似乎是恢复到 1.0.0 版,它已经帮助了该线程上的一些人和我自己。 You can do this using pip install moviepy==1.0.0 (note the double "=")您可以使用pip install moviepy==1.0.0执行此操作(注意双“=”)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我该如何解决这个 AttributeError: 'NoneType' object has no attribute 'text'? - How do i fix this AttributeError: 'NoneType' object has no attribute 'text'? 如何修复 AttributeError: 'NoneType' object 没有属性 'lower'? - How do i fix AttributeError: 'NoneType' object has no attribute 'lower'? Moviepy concatenate_videoclips(method=&#39;compose&#39;) AttributeError: &#39;NoneType&#39; 对象没有属性 &#39;stdout&#39; - Moviepy concatenate_videoclips(method='compose') AttributeError: 'NoneType' object has no attribute 'stdout' 我该如何修复,AttributeError: 'NoneType' 对象没有属性 'send' - How can I fix, AttributeError: 'NoneType' object has no attribute 'send' 我该如何解决这个问题:AttributeError: 'NoneType' object has no attribute 'strip - How can i fix this :AttributeError: 'NoneType' object has no attribute 'strip 我该如何解决 AttributeError 'NoneType' object has no attribute 'write' - how can i solve AttributeError 'NoneType' object has no attribute 'write' 为什么在尝试删除目标窗口小部件时出现此错误AttributeError:&#39;NoneType&#39;对象没有属性&#39;remove_widget&#39;? - Why do i get this error AttributeError: 'NoneType' object has no attribute 'remove_widget' when im trying to remove Target widget? “如何解决&#39;AttributeError:&#39;NoneType&#39;对象在Python中没有属性&#39;tbody&#39;错误? - "How to fix 'AttributeError: 'NoneType' object has no attribute 'tbody'' error in Python? 如何修复 AttributeError: 'NoneType' object has no attribute 'strip' in this specific code? - how to fix AttributeError: 'NoneType' object has no attribute 'strip' in this specific code? 如何修复 AttributeError: 'NoneType' object 在 insta bot 中没有属性 'click' - How to fix AttributeError: 'NoneType' object has no attribute 'click' in insta bot
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM