You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that the documentation for spawn says that I should call wait to clean up the process once I am done, however, none of the usage examples in this repo seem to call wait.
What is the correct cleanup logic when using this library?
Is wait called somewhere automatically when I drop FfmpegIterator or do I need to call it manually? If I need to call it manually then what is the intended way to handle calling wait? I am especially thinking of cases where my function returns early due to some error and does not process all the frames.
The text was updated successfully, but these errors were encountered:
The short answer is it does not happen automatically, so you should call wait manually if you want to be 100% sure the process gets cleaned up. Preferably after you've consumed the whole iterator and you know the wait call will return right away.
A lot of the examples in the repo don't do this, and it's not really a big deal if you skip it, because these "zombie processes" consume virtually no resources and only stick around until your Rust program ends. However if your Rust program will be long-living and spawning many instances of FFmpeg, it's a good idea to clean them up. There's a little more background about the issue in the Rust docs -- it's not an FFmpeg thing, it's an operating system quirk that applies to all child processes.
I would also recommend using kill() instead for your early exit case without processing all frames.
My use case is similar to https://docs.rs/ffmpeg-sidecar/latest/ffmpeg_sidecar/#example, except I start multiple ffmpeg processes over the lifetime of my program.
I noticed that the documentation for spawn says that I should call
wait
to clean up the process once I am done, however, none of the usage examples in this repo seem to callwait
.What is the correct cleanup logic when using this library?
Is
wait
called somewhere automatically when I dropFfmpegIterator
or do I need to call it manually? If I need to call it manually then what is the intended way to handle callingwait
? I am especially thinking of cases where my function returns early due to some error and does not process all the frames.The text was updated successfully, but these errors were encountered: