This is my code:
# Import everything needed to edit/save/watch video clips
from moviepy.editor import VideoFileClip
from IPython.display import HTML
new_clip_output = 'test_output.mp4'
test_clip = VideoFileClip("test.mp4")
new_clip = test_clip.fl_image(lambda x: cv2.cvtColor(x, cv2.COLOR_RGB2YUV)) #NOTE: this function expects color images!!
new_clip.write_videofile(new_clip_output, audio=False)
OSError: [Errno 32] Broken pipe
MoviePy error: FFMPEG encountered the following error while writing file test_output.mp4:
b"Unrecognized option 'preset'.\nError splitting the argument list: Option not found\n"
Full error details are here:
`[MoviePy] >>>> Building video test_output.mp4
[MoviePy] Writing video test_output.mp4
0%| | 0/251 [00:00<?, ?it/s]
---------------------------------------------------------------------------
BrokenPipeError Traceback (most recent call last)
~/Documents/python3/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_writer.py in write_frame(self, img_array)
133 if PY3:
--> 134 self.proc.stdin.write(img_array.tobytes())
135 else:
BrokenPipeError: [Errno 32] Broken pipe
During handling of the above exception, another exception occurred:
OSError Traceback (most recent call last)
<ipython-input-30-7a601a4eaaf5> in <module>()
----> 1 new_clip.write_videofile(new_clip_output, audio=False)
<decorator-gen-175> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, progress_bar)
~/Documents/python3/lib/python3.6/site-packages/moviepy/decorators.py in requires_duration(f, clip, *a, **k)
52 raise ValueError("Attribute 'duration' not set")
53 else:
---> 54 return f(clip, *a, **k)
55
56
<decorator-gen-174> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, progress_bar)
~/Documents/python3/lib/python3.6/site-packages/moviepy/decorators.py in use_clip_fps_by_default(f, clip, *a, **k)
135 for (k,v) in k.items()}
136
--> 137 return f(clip, *new_a, **new_kw)
<decorator-gen-173> in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, progress_bar)
~/Documents/python3/lib/python3.6/site-packages/moviepy/decorators.py in convert_masks_to_RGB(f, clip, *a, **k)
20 if clip.ismask:
21 clip = clip.to_RGB()
---> 22 return f(clip, *a, **k)
23
24 @decorator.decorator
~/Documents/python3/lib/python3.6/site-packages/moviepy/video/VideoClip.py in write_videofile(self, filename, fps, codec, bitrate, audio, audio_fps, preset, audio_nbytes, audio_codec, audio_bitrate, audio_bufsize, temp_audiofile, rewrite_audio, remove_temp, write_logfile, verbose, threads, ffmpeg_params, progress_bar)
347 verbose=verbose, threads=threads,
348 ffmpeg_params=ffmpeg_params,
--> 349 progress_bar=progress_bar)
350
351 if remove_temp and make_audio:
~/Documents/python3/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_writer.py in ffmpeg_write_video(clip, filename, fps, codec, bitrate, preset, withmask, write_logfile, audiofile, verbose, threads, ffmpeg_params, progress_bar)
214 frame = np.dstack([frame,mask])
215
--> 216 writer.write_frame(frame)
217
218 writer.close()
~/Documents/python3/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_writer.py in write_frame(self, img_array)
176
177
--> 178 raise IOError(error)
179
180 def close(self):
OSError: [Errno 32] Broken pipe
MoviePy error: FFMPEG encountered the following error while writing file test_output.mp4:
b"Unrecognized option 'preset'.\nError splitting the argument list: Option not found\n"
I have the same problem. Can we get this addressed?
Hi, I had the same problem. I resolved the problem by installing python package ffmpeg.
conda install -c conda-forge ffmpeg
Hope this would help :)
@WuyangLI 's method is also quite useful for me to solve this problem.
@WuyangLI he was right :)
I'm not using conda, so this solution does not work. Has anyone found a real universal solution?
Just leaving this here so that it can be updated if we find a proper solution: https://stackoverflow.com/questions/48486281/ffmpeg-osx-error-while-writing-file-unrecognized-option-preset-error-splitt
It looks like ffmpeg may not be being properly compiled to support this feature.
For now, you'll have to try and find some way of updating your ffmpeg install.
I am facing something weird. I wrote function to convert the RGB video into Hue equivalent. But when I write the video, nothing get's outputted. The code is:
clip = VideoFileClip(file_path, fps_source='fps')
video_clip = clip.fl_image(process_img)
video_clip.write_videofile(output)
The output I get is:
[MoviePy] Writing video /path/to/video/output.mp4
94%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枎| 189/202 [00:00<00:00, 232.95it/s]100%|鈻堚枅鈻堚枅鈻堚枅鈻堚枅鈻堚枅| 202/202 [00:00<00:00, 230.59it/s]
[MoviePy] Done.
[MoviePy] >>>> Video ready: /path/to/video/output.mp4
The video is about 5 seconds long. Can someone help me?
@Flock1 I think you want to open a separate issue for your problem (if it's still a problem).
@tburrows13 Can this issue be closed?
I am getting error while writing video. In the error below , exception is raised while writing audio.
I have installed ffmpeg and moviepy as mentioned above but it did not work:
conda install -c conda-forge ffmpeg
conda install -c conda-forge moviepy.
[MoviePy] Writing audio in -What are your weaknesses-- Job Interview Question _ 9 Great Answers! - YouTube.MKV_75_26.mp4_aligned.mp4_2TEMP_MPY_wvf_snd.mp3
error occured [Errno 32] Broken pipe | 0/88 [00:00<?, ?it/s]
MoviePy error: FFMPEG encountered the following error while writing file -What are your weaknesses-- Job Interview Question _ 9 Great Answers! - YouTube.MKV_75_26.mp4_aligned.mp4_2TEMP_MPY_wvf_snd.mp3:
b"Unrecognized option 'What are your weaknesses-- Job Interview Question _ 9 Great Answers! - YouTube.MKV_75_26.mp4_aligned.mp4_2TEMP_MPY_wvf_snd.mp3'.\nError splitting the argument list: Option not found\n"
In case it helps, make sure you are using a recent version of FFMPEG (the versions in the Ubuntu/Debian repos are deprecated).
conda install -c conda-forge ffmpeg will solve the problem. Its time to close this issue
Yes, even if you are not using conda, the issue is that you have a very outdated version of ffmpeg.
Most helpful comment
Hi, I had the same problem. I resolved the problem by installing python package ffmpeg.
conda install -c conda-forge ffmpegHope this would help :)