I am developing an encoder with java swing and ffmpeg. I created a GUI interface in which I specify my inputs (devices, frame rate, bitrate..)
. Then I call ffmpeg
to encode and stream.
My problem is that the encoding class is well executed from a main class but it is blocked when called from the swing interface (specifically jButtonactionperformed()
).
Can anyone help me?
here is my button action
private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
Encode s = new Encode();
s.Encode(cmdLine);
}
and here is my encoding method
public void Encode(String cmdLine) {
try {
Process p2 = Runtime.getRuntime().exec(cmdLine);
//logProcessOutputAndErrors(p2);
}
catch(Exception ex) {
ex.printStackTrace();
}
}
Ps: Cmdline is the command i collect from inputs