Closed pashadude closed 5 years ago
The library provides a saving functionality but you don't have to use it. If you want you can save the video,which is returned as a numpy array using menpo.
Thanks @DinoMan , however if anyone might need an alternative way to save the vid due to menpo problems one can use this function (add to the class VideoAnimator())
import imageio
from moviepy.editor import *
from moviepy.audio.AudioClip import AudioArrayClip
...
def save_video_alternative(self, video, audio, path):
if not os.path.isabs(path):
path = os.getcwd() + "/" + path
with tempdir() as dirpath:
videowriter = imageio.get_writer(dirpath + '/tmp.avi', fps=self.video_rate)
for i in range(video.shape[0]):
frame = np.rollaxis(video[i, :, :, :], 0, 3)
videowriter.append_data(frame)
videowriter.close()
aclip = AudioArrayClip(audio, self.audio_rate)
clip = VideoFileClip(dirpath + '/tmp.avi')
clip.set_audio(aclip)
clip.write_videofile(path, temp_audiofile=dirpath+'/temp-audio.m4a', remove_temp=True, codec="libx264", audio_codec="aac")
Good day I run into same error both at floyd-hub and local machine
might not it be caused my requirements conflict between menpo and scikit which disturbs work of ffmpeg-python?