Open HenriquePassarelli opened 10 months ago
Have you checked force stop example?
I'm using it, but even calling it sometimes doesn't stop the process.
Sometimes? Could you be more specific? Does force stop work in case you described in this issue?
The messages when the force is called, are being shown, however, when I check the processes the ffmpeg execution is still there. I'm running with executeAsync
providing the executor.
Could you post debug logs? For that you need to configure both ffmpeg log level and java log level (logback or whatever you use)
https://github.com/kokorin/Jaffree/assets/71354731/0437e38d-ee25-4ec6-bdcb-28f958375157
https://github.com/kokorin/Jaffree/assets/71354731/c45a64ce-e4d2-4b7f-a347-c8080bedfaa8
I implemented a workaround that reads all ffmpeg processes on my machine and checks the command to see if they match the arguments, if so, I keep the pid and then I can kill it. That's why I wanted the pid
exposed to be used or an internal call to it besides canceling the future.
Please, provide logs as requested.
Here I'm logging the stop call that comes from my code that calls the future forceStop
4380793 INFO [qtp1643944254-970] FFMpegHelper: Kill rtsp jobs - 1
4380794 INFO [qtp1643944254-970] FFMPEGRunner: STOP FFMPEGRunner
4380794 INFO [qtp1643944254-970] FFMPEGRunner: Future status before - false
4380794 INFO [qtp1643944254-970] FFMPEGRunner: Future status - true
So as you can see the future was cancelled but the process is still running.
My stop method
public void stop() {
if (isStopping.getAndSet(true)) return;
LOGGER.info("STOP FFMPEGRunner");
isRunning.set(false);
connections.set(0);
reference.get().clear();
if (future != null) {
LOGGER.info("Future status before - {}", future.isCancelled());
future.forceStop();
LOGGER.info("Future status - {}\n\n\n\n\n", future.isCancelled());
}
onClose.run();
}
Could you post debug logs? For that you need to configure both ffmpeg log level and java log level (logback or whatever you use)
Please, provide logs as requested
The logs aren't providing much.
The basics. A call to stop the process.
It had to be closed using the Ubuntu UI
Reloading without connection no action needs to be taken.
Common user flow, start and stop stream, working.
The full log is a not working example.
The full log is a working example.
I used a workaround to deal with it that could be added to the code, which is the https://github.com/profesorfalken/jProcesses lib to handle to close the process. It is really handy cause it deals with UNIX and Windows systems.
Please, notice that I asked for debug logs both ffmpeg and Jaffree.
@kokorin If FFmpeg doesn't abide by the force request of the stopper then you are effectively leaving a process alive even if the JVM shuts down. So exposing the Process instance itself would be nice. Especially if you have a highly multithreaded application that doesn't require a lot of Processing power but a lot of traffic on your Storage drives. Having to go to taskmanager and having to cancel these tasks while the taskmanager isn't responding well because your PC is overloaded for some reason, kinda makes this more important too.
So i highly suggest that there is a way where you can configure a bit more control over it. (Started using the library when i was using the command line directly before because i wanted a nicer interface, and this is the first thing i realized)
@HenriquePassarelli You can solve this yourself temporary, by creating your own FFmpeg/Probe class that extends the original one and implement a custom Stopper interface that just wraps around the existing one. Because that gets the process info :) Meaning you can even do that without async then :)
Describe the issue When I lose connection to the internet, the process sometimes doesn't close by itself, so I would like to get the
pid
for each process I run FFMpeg to close/kill/verify manually.To Reproduce Steps to reproduce the behavior: While running the RTSP stream, stop the connection with the internet, and you will see that the process will still run even though no one is consuming it.
Expected behavior Close the process after losing connection or add a way to close it.
Additional context Linux Ubuntu 20.04