Help me please, i have to use ffmpeg cmdline in my application. I built the ffmpeg binary and now i'm able to start using ffmpeg as follows:
public class FfmpegCmd {
...
public ProcessRunnable create(){
final List<String> cmd = new LinkedList<String>();
... // filling ffmpeg parameters
final ProcessBuilder pb = new ProcessBuilder(cmd);
return new ProcessRunnable(pb);
}
...
}
And i start ffmpeg conversion as follows:
final FfmpegCmd task = new FfmpegCmd();
new AsyncTask<Void, Void, Void>() {
@Override
protected Void doInBackground(Void... arg0) {
task.create().run();
return null;
}
@Override
protected void onPostExecute(Void result) {
Toast.makeText(MainActivity.this, "Ffmpeg cmd complete.", Toast.LENGTH_SHORT).show();
}
}.execute();
It works fine. But I wanna to add ability to terminate ffmpeg command execution. How can i do that? How ProcessRunnable can be terminated?
I need something like "send CTRL+C to ProcessRunnable"