Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There are still broken pipe errors #2337

Open
F4k3r22 opened this issue Jan 21, 2025 · 0 comments
Open

There are still broken pipe errors #2337

F4k3r22 opened this issue Jan 21, 2025 · 0 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@F4k3r22
Copy link

F4k3r22 commented Jan 21, 2025

There should be no more broken pipes

There are still broken pipe errors

I come to rescue this FFMPEG error from the broken pipe, because I have noticed when I have been doing tests and deployments that the error occurs at a certain memory usage of the system, the initial system I have is 8GB of RAM and if I pass the 6.5GB of use it throws this same error:

Moviepy - Building video /tmp/output/video.mp4.
MoviePy - Writing audio in /tmp/output/temp-audio.mp3
MoviePy - Done.
Moviepy - Writing video /tmp/output/video.mp4

t: 8%|███████████▏ | 48/624 [00:06<06:34, 1.46it/s, now=None]Traceback (most recent call last):
File "/usr/local/lib/python3.10/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 136, in write_frame
self.proc.stdin.write(img_array.tobytes())
BrokenPipeError: [Errno 32] Broken pipe

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/srv/yt1/lambda_function.py", line 424, in
lambda_handler("", "")
File "/srv/yt1/lambda_function.py", line 422, in lambda_handler
cm.CreateMP4(upload_to_yt)
File "/srv/yt1/lambda_function.py", line 371, in CreateMP4
f1.write_videofile(file, fps = 24 , temp_audiofile=os.path.join(DIR_PATH_OUTPUT, 'temp-audio.mp3' ))
File "", line 2, in write_videofile
File "/usr/local/lib/python3.10/dist-packages/moviepy/decorators.py", line 54, in requires_duration
return f(clip, *a, **k)
File "", line 2, in write_videofile
File "/usr/local/lib/python3.10/dist-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "", line 2, in write_videofile
File "/usr/local/lib/python3.10/dist-packages/moviepy/decorators.py", line 22, in convert_masks_to_RGB
return f(clip, *a, **k)
File "/usr/local/lib/python3.10/dist-packages/moviepy/video/VideoClip.py", line 300, in write_videofile
ffmpeg_write_video(self, filename, fps, codec,
File "/usr/local/lib/python3.10/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 228, in ffmpeg_write_video
writer.write_frame(frame)
File "/usr/local/lib/python3.10/dist-packages/moviepy/video/io/ffmpeg_writer.py", line 180, in write_frame
raise IOError(error)
OSError: [Errno 32] Broken pipe

MoviePy error: FFMPEG encountered the following error while writing file /tmp/output/video.mp4
<!-- Please include code that demonstrates this problem so that we can reproduce it. For advice on how to do this, see https://stackoverflow.com/help/mcve

It's higlhy helpfull if you can provide an exact and complete code reproducing the bug, *along with all necessary medias (videos, images, sounds, etc.).* 

Ideally you should provide a functional code snippet that maintainers can run to investigate the bug. 

And investigating a little more it turns out that the continuous use of final_video.write_videofile(
str(output_path),
fps=24,
threads=64,
codec='libx264',
audio_codec='aac',
)
The memory is not cleaned correctly to be able to make a continuous execution of my App, so I had to implement an automatic memory cleaning to avoid that, but sometimes I still get the same error because my cleaning functions are not sufficient.
-->

Used medias

Specifications

  • Python Version: 3.10.13
  • MoviePy Version: 2.1.2
  • Platform Name:
  • Platform Version:
@F4k3r22 F4k3r22 added the bug Issues that report (apparent) bugs. label Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Projects
None yet
Development

No branches or pull requests

1 participant