Moviepy concatenate_videoclips(method='compose') AttributeError: 'NoneType' object has no attribute 'stdout'
Moviepy concatenate_videoclips(method='compose') AttributeError: 'NoneType' object has no attribute 'stdout'
我正在编写一个脚本来将短片合并到一个视频中,但是这些视频包含不同的大小和帧率。当我 运行 下面的代码时,输出视频充满了第二个剪辑的故障。
from moviepy.editor import *
clips = [ VideoFileClip("clips/clip-1.mp4"),
VideoFileClip("clips/clip-2.mp4"),
VideoFileClip("clips/clip-3.mp4")]
final_clip = concatenate_videoclips(clips)
final_clip.write_videofile("final.mp4")`
更好地搜索我认为这可能是因为它们在属性上有所不同,所以我包括了 compose() 方法:
final_clip = concatenate_videoclips(clips, method='compose')
并得到以下错误:
File "c:/video machine/test.py", line 8, in <module> final_clip.write_videofile("final.mp4")
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-51>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-50>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 137, in use_clip_fps_by_default return f(clip, *new_a, **new_kw)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-49>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB return f(clip, *a, **k)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\video\VideoClip.py", line 317, in write_videofile logger=logger)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-73>", line 2, in write_audiofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 209, in write_audiofile logger=logger) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-70>", line 2, in ffmpeg_audiowrite File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 169, in ffmpeg_audiowrite logger=logger): File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 85, in iter_chunks fps=fps, buffersize=chunksize) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-72>", line 2, in to_soundarray File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 126, in to_soundarray snd_array = self.get_frame(tt) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-10>", line 2, in get_frame File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 89, in wrapper return f(*new_a, **new_kw) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\Clip.py", line 95, in get_frame return self.make_frame(t) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 296, in make_frame for c, part in zip(self.clips, played_parts) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 297, in <listcomp> if (part is not False)] File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-10>", line 2, in get_frame File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 89, in wrapper return f(*new_a, **new_kw) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\Clip.py", line 95, in get_frame return self.make_frame(t) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 78, in <lambda> self.make_frame = lambda t: self.reader.get_frame(t)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\readers.py", line 184, in get_frame self.buffer_around(fr_max)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\readers.py", line 238, in buffer_around array = self.read_chunk(chunksize)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\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
电影版本:1.0.1
我认为这是 moviepy 中的一个未解决的错误,请尝试安装 1.0.0 版
pip install moviepy == 1.0.0
或者
pip install moviepy==1.0.0
我正在编写一个脚本来将短片合并到一个视频中,但是这些视频包含不同的大小和帧率。当我 运行 下面的代码时,输出视频充满了第二个剪辑的故障。
from moviepy.editor import *
clips = [ VideoFileClip("clips/clip-1.mp4"),
VideoFileClip("clips/clip-2.mp4"),
VideoFileClip("clips/clip-3.mp4")]
final_clip = concatenate_videoclips(clips)
final_clip.write_videofile("final.mp4")`
更好地搜索我认为这可能是因为它们在属性上有所不同,所以我包括了 compose() 方法:
final_clip = concatenate_videoclips(clips, method='compose')
并得到以下错误:
File "c:/video machine/test.py", line 8, in <module> final_clip.write_videofile("final.mp4")
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-51>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-50>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 137, in use_clip_fps_by_default return f(clip, *new_a, **new_kw)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-49>", line 2, in write_videofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB return f(clip, *a, **k)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\video\VideoClip.py", line 317, in write_videofile logger=logger)
File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-73>", line 2, in write_audiofile
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 209, in write_audiofile logger=logger) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-70>", line 2, in ffmpeg_audiowrite File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 169, in ffmpeg_audiowrite logger=logger): File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 85, in iter_chunks fps=fps, buffersize=chunksize) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-72>", line 2, in to_soundarray File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration return f(clip, *a, **k) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 126, in to_soundarray snd_array = self.get_frame(tt) File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-10>", line 2, in get_frame File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 89, in wrapper return f(*new_a, **new_kw) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\Clip.py", line 95, in get_frame return self.make_frame(t) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 296, in make_frame for c, part in zip(self.clips, played_parts) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\AudioClip.py", line 297, in <listcomp> if (part is not False)] File "<C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\decorator.py:decorator-gen-10>", line 2, in get_frame File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\decorators.py", line 89, in wrapper return f(*new_a, **new_kw) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\Clip.py", line 95, in get_frame return self.make_frame(t) File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\AudioFileClip.py", line 78, in <lambda> self.make_frame = lambda t: self.reader.get_frame(t)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\readers.py", line 184, in get_frame self.buffer_around(fr_max)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\site-packages\moviepy\audio\io\readers.py", line 238, in buffer_around array = self.read_chunk(chunksize)
File "C:\Users\LT1Kqob5UDEML61gCyjnAcfMXgkdP3wGcg45UBcFon37-32\lib\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
电影版本:1.0.1
我认为这是 moviepy 中的一个未解决的错误,请尝试安装 1.0.0 版
pip install moviepy == 1.0.0
或者
pip install moviepy==1.0.0