Итак, у меня есть очень простой скрипт, который объединяет два видео и добавляет фоновый звук.
def intro():
voiceoverIntro = AudioFileClip(audio[3]) #get path for intro.mp3
introVideo = []
temp = p1vid + p2vid + p3vid
for x in temp: # add product videos to introVideo if they are longer than intro.mp3
x = VideoFileClip(x)
if x.duration >= voiceoverIntro.duration:
introVideo.append(x)
if len(introVideo) >= 1:
#Get the video and turn off its volume
introBg = introVideo[0].volumex(0).resize((1280,720))
introBg = introBg.set_audio(voiceoverIntro).set_duration(voiceoverIntro.duration)
introBg.reader.close()
introBg.audio.reader.close_proc()
return introBg
И эта функция создает второй клип
def productThreeOpener(productName):
opener3 = VideoFileClip("media/number3.mp4").volumex(0).resize((1280,720))
text = TextClip(productName,fontsize=60,color='white', font="Dekar")\
.set_pos(("right", "center"))\
.set_duration(3)\
.set_start(2)\
.crossfadein(1)\
.crossfadeout(1)\
.margin(right=200,opacity=0)
opener3 = CompositeVideoClip([opener3, text])
return opener3
Теперь мы просто объединяем два выхода
final_clip = concatenate_videoclips ([intro, productThreeOpener], method = "compose")
final_clip.resize ((1280, 720)). Write_videofile ("output / intro.mp4", threads = 8, fps = 24, progress_bar = False)
Запуск приведенного выше кода возвращает эту ошибку;
Traceback (most recent call last):
[MoviePy] >>>> Building video output/intro.mp4
File "C:/Users/Akbulut/PycharmProjects/youtubeVideoEditor/vidEditor/sandbox.py", line 145, in <module>
[MoviePy] Writing audio in introTEMP_MPY_wvf_snd.mp3
final_clip.write_videofile("output/intro.mp4", threads=8, fps=24, progress_bar=False)
File "<decorator-gen-51>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-50>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 137, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-49>", line 2, in write_videofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\video\VideoClip.py", line 318, in write_videofile
progress_bar=progress_bar)
File "<decorator-gen-73>", line 2, in write_audiofile
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\AudioClip.py", line 213, in write_audiofile
progress_bar=progress_bar)
File "<decorator-gen-70>", line 2, in ffmpeg_audiowrite
File "C:\Program Files\Python36\lib\site-packages\moviepy\decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 165, in ffmpeg_audiowrite
ffmpeg_params=ffmpeg_params)
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 71, in __init__
self.proc = sp.Popen(cmd, **popen_params)
File "C:\Program Files\Python36\lib\subprocess.py", line 594, in __init__
_cleanup()
File "C:\Program Files\Python36\lib\subprocess.py", line 205, in _cleanup
res = inst._internal_poll(_deadstate=sys.maxsize)
File "C:\Program Files\Python36\lib\subprocess.py", line 1025, in _internal_poll
if _WaitForSingleObject(self._handle, 0) == _WAIT_OBJECT_0:
OSError: [WinError 6] İşleyici geçersiz
Exception ignored in: <bound method FFMPEG_AudioWriter.__del__ of <moviepy.audio.io.ffmpeg_audiowriter.FFMPEG_AudioWriter object at 0x0000000A885019B0>>
Traceback (most recent call last):
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 134, in __del__
self.close()
File "C:\Program Files\Python36\lib\site-packages\moviepy\audio\io\ffmpeg_audiowriter.py", line 122, in close
if self.proc:
AttributeError: 'FFMPEG_AudioWriter' object has no attribute 'proc'
Process finished with exit code 1
Я строго следовал руководству по установке MoviePY, установил его и все его зависимости около 2 дней назад. Я работаю на 64-битной Windows-машине. Python версия 3.6.1
Я застрял с этой ошибкой уже более суток, и я не знаю, что попробовать. Любая помощь / совет высоко ценится.
Спасибо.