ffmpeg-cli-wrapper
ffmpeg-cli-wrapper copied to clipboard
Non thread blocking?
The question I'm trying to use this library to encode something when an events happens. However, the library isn't thread-blocking, so when I return the file, it has not been written yet, and therefore my program throws an error.
Example ffmpeg command Not relevant, I tested the same piece of code in a test program and it's working great (as there is a new thread created, the programs outputs when the job is done)
Is there any way to listen for the job to finish, or make the code thread-blocking?
The FFmpegExecutor is blocking. For example:
FFmpegExecutor executor = new FFmpegExecutor(ffmpeg, ffprobe);
// Run a one-pass encode
executor.createJob(builder).run();
That won't return until either a error happens, or it is difficult. If it is returning quickly, then I suspect a error is occurring.
Would you be able up provide an example of what's not working?
When my code is executed in a Runnable (because it's in a Task), I get no error, and my output file (an mp4) just contains the first frame of the video. When I run the same code (except that the input and output are hardcoded) in a Java program created to test the library (so absolutely no extra code, just the part with the library in a psvm), the output is correct.
I think you'll need to provide a short code sample, that demonstrates the problem.