Moviepy: audio.write_audiofile just stucks while writing frames

Created on 18 Mar 2020  路  5Comments  路  Source: Zulko/moviepy

I have a videofile for which I am trying to write_audiofile. in ffmpeg_writer.py it just stucks in the for loop after 34%. Doesn't give error just keeps the process open for infinite time and after some time i get too many open files error, because there are many open processes

I just want to error out whenever such problem occurs. i saw there is no configuration for timing out the write_audiofile. Let me know if there is a workaround for closing the processes opened by ffmpeg_writer.
Also i have tried video_clip.close(). it doesn't kill the process

here is the video file for which it is happening
https://invideo-uploads-ap-south-1.s3.ap-south-1.amazonaws.com/Screenrecorder202003162040087215843703161681584506036640.mp4

Screenshot 2020-03-17 at 12 03 15 PM

bug

Most helpful comment

Not at all! You can see the milestone here: https://github.com/Zulko/moviepy/milestone/6, which are all issues/PRs that I've thought would be nice to get sorted. A lot of them are pretty much ready to merge though. At some point we'll have to make the decision to stop trying to add new things and focus on getting the release out. The main focus is on things that improve usability but break backwards compatibility (of which the clip closing stuff may well be one of them), as these things should only be done in major versions.

At any time though, a beta/pre-release version could be released if you need it, which would include all the features merged at a given point.

All 5 comments

Thanks for the bug report. I can confirm that with VideoFileClip("buggy.mp4").write_videofile("out.mp4") using your example file, it does get stuck at 35% audio.

A workaround for closing processes is to use Python's multiprocessing library. When the python process closes, all processes opened in it must also close, I think. A bit of a hack, but it might be what you want?

Thanks for the bug report. I can confirm that with VideoFileClip("buggy.mp4").write_videofile("out.mp4") using your example file, it does get stuck at 35% audio.

A workaround for closing processes is to use Python's multiprocessing library. When the python process closes, all processes opened in it must also close, I think. A bit of a hack, but it might be what you want?

Are there known reasons why write_audiofile (or write_videofile) get stuck. My write_audiofile gets stuck on rare occasions as well and I'd really like to avoid it happening.

Are there known reasons why write_audiofile (or write_videofile) get stuck. My write_audiofile gets stuck on rare occasions as well and I'd really like to avoid it happening.

I don't think so I'm afraid :/

The way that moviepy deals with file handlers/pipes/processes and closing of clips is a bit inconsistent and it is on my todo list to clean up before v2.0. You may find that your problem goes away then.

Thank you. At the risk of showing my ignorance, how close is v2.0?

Not at all! You can see the milestone here: https://github.com/Zulko/moviepy/milestone/6, which are all issues/PRs that I've thought would be nice to get sorted. A lot of them are pretty much ready to merge though. At some point we'll have to make the decision to stop trying to add new things and focus on getting the release out. The main focus is on things that improve usability but break backwards compatibility (of which the clip closing stuff may well be one of them), as these things should only be done in major versions.

At any time though, a beta/pre-release version could be released if you need it, which would include all the features merged at a given point.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Netherdrake picture Netherdrake  路  5Comments

buddhashrestha picture buddhashrestha  路  3Comments

Netherdrake picture Netherdrake  路  4Comments

djevo1 picture djevo1  路  3Comments

tburrows13 picture tburrows13  路  3Comments