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

How to stop FFMPEG process gracefully with ffmpeg-cli-wrapper ? #282

Open
mertakkartal opened this issue Mar 15, 2023 · 5 comments
Open
Labels

Comments

@mertakkartal
Copy link

Hi folks ,

I wrote a simple UDP stream recorder application with using this library in Java 11. Everything works fine except stopping FFMPEG record process before the duration time. (i.e The duration time is 60 seconds but want to stop FFMPEG process like in 30th second.)

What should I do for solving this problem ? Any ideas would be appreciated .

Thanks,
Mert

@curiousurick
Copy link

I'm having the same issue. I think I'm going to just call on the shell to kill any process with the name ffmpeg. It's not ideal, but it'll work for my project.

@bramp
Copy link
Owner

bramp commented Nov 10, 2023

You'll have to execute ffmpeg manually and get a Process object that you can then read streams or kill as needed. Similar to what

public void run(List<String> args) throws IOException {
and https://github.com/bramp/ffmpeg-cli-wrapper/blob/master/src/main/java/net/bramp/ffmpeg/RunProcessFunction.java do.

@curiousurick
Copy link

Yeah, that's working for me. If there was a way to get the PID for the ffmpeg job, then I could narrow the kill command to that.

@bramp
Copy link
Owner

bramp commented Nov 10, 2023

The current API doesn't make it easy to get the Process object / PID. So that's why I suggest executing ffmpeg yourself.

@curiousurick
Copy link

Meh, I'm queuing up tasks anyway so there will only be one ffmpeg process running at a time. My personal project is just shrinking video files from blu-ray quality to x265 and moving them to a new folder so not exactly needing production quality.

I appreciate this cli wrapper! Thanks for your work making this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants