moviepy: AttributeError: 'NoneType' object has no attribute 'stdout'
Notice
If you have arrived here from google, you will probably find that updating your moviepy version to v1.0.3 or higher will fix the issue (pip install moviepy --upgrade
). See #1185.
Expected Behavior
Expected to get an edited version of the inputted video.
Actual Behavior
Produces this error:
Moviepy - Building video test.webm.
MoviePy - Writing audio in testTEMP_MPY_wvf_snd.ogg
chunk: 0%| | 0/552 [00:00<?, ?it/s, now=None]Traceback (most recent call last):
File "/home/tech/Developement/CrabRaveGenerator/Test.py", line 8, in <module>
]).write_videofile("test.webm", fps = 30)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-51>", line 2, in write_videofile
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-50>", line 2, in write_videofile
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 137, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-49>", line 2, in write_videofile
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/video/VideoClip.py", line 317, in write_videofile
logger=logger)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-73>", line 2, in write_audiofile
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/AudioClip.py", line 209, in write_audiofile
logger=logger)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-70>", line 2, in ffmpeg_audiowrite
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/io/ffmpeg_audiowriter.py", line 169, in ffmpeg_audiowrite
logger=logger):
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/AudioClip.py", line 85, in iter_chunks
fps=fps, buffersize=chunksize)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-72>", line 2, in to_soundarray
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/AudioClip.py", line 126, in to_soundarray
snd_array = self.get_frame(tt)
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-10>", line 2, in get_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/AudioClip.py", line 296, in make_frame
for c, part in zip(self.clips, played_parts)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/AudioClip.py", line 297, in <listcomp>
if (part is not False)]
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-10>", line 2, in get_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/Clip.py", line 138, in <lambda>
newclip = self.set_make_frame(lambda t: fun(self.get_frame, t))
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/Clip.py", line 190, in <lambda>
return self.fl(lambda gf, t: gf(t_func(t)), apply_to,
File "</usr/local/lib/python3.5/dist-packages/decorator.py:decorator-gen-10>", line 2, in get_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/Clip.py", line 95, in get_frame
return self.make_frame(t)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/io/AudioFileClip.py", line 78, in <lambda>
self.make_frame = lambda t: self.reader.get_frame(t)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/io/readers.py", line 180, in get_frame
self.buffer_around(fr_min)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/io/readers.py", line 238, in buffer_around
array = self.read_chunk(chunksize)
File "/usr/local/lib/python3.5/dist-packages/moviepy-1.0.0-py3.5.egg/moviepy/audio/io/readers.py", line 112, in read_chunk
s = self.proc.stdout.read(L)
AttributeError: 'NoneType' object has no attribute 'stdout'
Steps to Reproduce the Problem
Run the following code:
from moviepy.editor import CompositeVideoClip, VideoFileClip, TextClip
CompositeVideoClip([
VideoFileClip("template.webm").subclip(5, 30),
TextClip("Test Text", fontsize = 70, color = 'white').set_position('center').set_duration(10)
]).write_videofile("test.webm", fps = 30)
Specifications
- Python Version: 3.5.3
- Moviepy Version: 1.0.0
- Platform Name: Debian
- Platform Version: 9.8
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 17
- Comments: 42 (2 by maintainers)
Commits related to this issue
- Temporary fix with bug in moviepy 1.0.1 https://github.com/Zulko/moviepy/issues/938 — committed to dcaravana/heatmappy by dcaravana 5 years ago
- Fix for sdout error https://github.com/Zulko/moviepy/issues/938 — committed to tagmix/moviepy by dannyshisler 5 years ago
- problem with write_videofile refer to: https://github.com/Zulko/moviepy/issues/938 — committed to smartops-project/sofa by aaamourao 4 years ago
I’ve got the same problem (macOS Mojave, python 3.6.x) with moviepy 1.0.1 but I’ve managed to work around it downgrading it to 1.0.0.
Hope it helps.
pip install moviepy==1.0.0
bug fixed!
@Ethan0429 So here are the steps:
cd /usr/local/lib/python3.7/dist-packages/moviepy/
vim audio/io/AudioFileClip.py +93
#
in front of them):# def __del__(self):
# self.close()
And you should be done.
Could you please confirm if this works for you? Cheers
PS: I’ve put it quite detailed to potentially assist other people. 😃
This one surprisingly working solution to the issue. Thanks @dcaravana ✌. It’s really under my estimation to think of downgrading can be a solution!
Fixed in #1185 and version 1.0.3. Thank you everyone for your patience! Use `pip install moviepy --upgrade`` to update to the latest version.
Hey all! This is obviously a problem that needs sorting. It has built up over time with people making quick fixes to small parts of the code without taking into consideration that the same methods should be applied consistently to all of moviepy, and also that different operating systems handle resources differently. Around eastertime I intend to have a proper look at it across different OSs and hopefully come up with a solution that works for everyone.
Same issue. Python 3.7. None of the solutions above worked.
After trying multiple times, I can confirm that the solution also works for 1.0.2.
However I am getting “OSError: [WinError 6] The handle is invalid” errors. I added “clip.reader.close()”, but this did not solve the problem. After a couple of runs, the error would occur again, and I had to restart my IDE. I suppose this is an unrelated issue.
Thank you @sebasi it worked for me perfectly.
This fixed it for me. Tnaks
Same problem on OSX high sierra, python 3.6. Downgrade to 1.0.0 fixes issue.
Changed to v1.0.0 and it gives no error. Thanks guys
I changed to v1.0.0, and it works well.
@mraduldubey I believe you meant to tag @kaiqueocanha. I was trying to overlay text, not concatenate multiple videos into one.