bramp / ffmpeg-cli-wrapper

Java wrapper around the FFmpeg command line tool
BSD 2-Clause "Simplified" License
1.72k stars 413 forks source link

Re-attaching to the progress TCP port #299

Open curiousurick opened 11 months ago

curiousurick commented 11 months ago

Is your feature request related to a problem? Please describe. This isn't necessarily a problem, but for my use-case, I sometimes have to restart the server while ffmpeg is still running. I've been messing around with the code, trying to create some sort of attach job that will connect to the previously created progress TCP server for the running ffmpeg process, but I haven't figured it out.

Describe the solution you'd like My idea is a job that allows you to re-attach the progress parser to the progress server created before. So if I create a single pass job and was listening on port 12345, then have to restart the server, I can check for existing ffmpeg processes with ps, extract the port from the command, then I can create an FFmpegAttachJob with my listener implementation and port for the server.

Describe alternatives you've considered Just what I posted above.

Please let me know if this isn't feasible. I have a suspicion that the progress server isn't actually running in ffmpeg, but in the previous java runtime that is my own server that I've restarted. Please let me know if that's the case because if so, maybe this isn't feasible.

Euklios commented 8 months ago

Theoretically possible. FFmpeg uses the -progress option to configure where to send progress updates to.

If you figure out the parameter passed to ffmpeg using -progress, then you should be able to re-attach using:

TcpProgressParser parser = new TcpProgressParser(yourListener, portFromCommand, inetAddressFromCommand);
parser.start();

Hope that helps!