|
@@ -58,6 +58,7 @@ public class ToolUI {
|
|
|
private final JTextArea txtAreaLog = new JTextArea();
|
|
private final JTextArea txtAreaLog = new JTextArea();
|
|
|
private final JTextField textAudioPath = new JTextField();
|
|
private final JTextField textAudioPath = new JTextField();
|
|
|
private final JPanel panelAudioPath = new JPanel();
|
|
private final JPanel panelAudioPath = new JPanel();
|
|
|
|
|
+ private final JTextField textBitrate = new JTextField();
|
|
|
|
|
|
|
|
private final JLabel labelOutInfo = new JLabel();
|
|
private final JLabel labelOutInfo = new JLabel();
|
|
|
private final Dimension labelSize = new Dimension(100, 20);
|
|
private final Dimension labelSize = new Dimension(100, 20);
|
|
@@ -103,6 +104,7 @@ public class ToolUI {
|
|
|
modelFps.setValue(commonArg.fps);
|
|
modelFps.setValue(commonArg.fps);
|
|
|
textInputPath.setText(commonArg.inputPath);
|
|
textInputPath.setText(commonArg.inputPath);
|
|
|
textAudioPath.setText(commonArg.audioPath);
|
|
textAudioPath.setText(commonArg.audioPath);
|
|
|
|
|
+ textBitrate.setText(String.valueOf(commonArg.bitrate));
|
|
|
float scale = commonArg.scale;
|
|
float scale = commonArg.scale;
|
|
|
for (int i=0; i<scaleArray.length ; i++) {
|
|
for (int i=0; i<scaleArray.length ; i++) {
|
|
|
if (scaleArray[i] == scale) {
|
|
if (scaleArray[i] == scale) {
|
|
@@ -162,6 +164,11 @@ public class ToolUI {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
+ try {
|
|
|
|
|
+ commonArg.bitrate = Integer.parseInt(textBitrate.getText());
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ TLog.e(TAG, "bitrate format error " + textBitrate.getText() + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
TLog.i(TAG, commonArg.toString());
|
|
TLog.i(TAG, commonArg.toString());
|
|
|
|
|
|
|
@@ -221,6 +228,8 @@ public class ToolUI {
|
|
|
panel.add(getCodecLayout());
|
|
panel.add(getCodecLayout());
|
|
|
// fps
|
|
// fps
|
|
|
panel.add(getFpsLayout());
|
|
panel.add(getFpsLayout());
|
|
|
|
|
+ // bitrate
|
|
|
|
|
+ panel.add(getBitrateLayout());
|
|
|
// scale
|
|
// scale
|
|
|
panel.add(getScaleLayout());
|
|
panel.add(getScaleLayout());
|
|
|
// path
|
|
// path
|
|
@@ -270,6 +279,18 @@ public class ToolUI {
|
|
|
return panel;
|
|
return panel;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private JPanel getBitrateLayout() {
|
|
|
|
|
+ JPanel panel = new JPanel();
|
|
|
|
|
+ panel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
|
|
|
|
+ JLabel label = new JLabel("bitrate");
|
|
|
|
|
+ label.setPreferredSize(labelSize);
|
|
|
|
|
+ panel.add(label);
|
|
|
|
|
+ textBitrate.setPreferredSize(new Dimension(60, 20));
|
|
|
|
|
+ panel.add(textBitrate);
|
|
|
|
|
+ panel.add(new JLabel("k (default 2000k)"));
|
|
|
|
|
+ return panel;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
private JPanel getScaleLayout() {
|
|
private JPanel getScaleLayout() {
|
|
|
JPanel panel = new JPanel();
|
|
JPanel panel = new JPanel();
|
|
|
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
|
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
|
|
@@ -446,6 +467,7 @@ public class ToolUI {
|
|
|
String inputPath = props.getProperty("inputPath", "");
|
|
String inputPath = props.getProperty("inputPath", "");
|
|
|
String scale = props.getProperty("scale", String.valueOf(scaleArray[0]));
|
|
String scale = props.getProperty("scale", String.valueOf(scaleArray[0]));
|
|
|
String audioPath = props.getProperty("audioPath", "");
|
|
String audioPath = props.getProperty("audioPath", "");
|
|
|
|
|
+ String bitrate = props.getProperty("bitrate", String.valueOf(commonArg.bitrate));
|
|
|
|
|
|
|
|
int v = Integer.parseInt(version);
|
|
int v = Integer.parseInt(version);
|
|
|
// 版本不符直接返回默认值
|
|
// 版本不符直接返回默认值
|
|
@@ -455,6 +477,7 @@ public class ToolUI {
|
|
|
commonArg.enableH265 = Boolean.TRUE.toString().equals(enableH265);
|
|
commonArg.enableH265 = Boolean.TRUE.toString().equals(enableH265);
|
|
|
commonArg.inputPath = inputPath;
|
|
commonArg.inputPath = inputPath;
|
|
|
commonArg.audioPath = audioPath;
|
|
commonArg.audioPath = audioPath;
|
|
|
|
|
+ commonArg.bitrate = Integer.parseInt(bitrate);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
TLog.e(TAG, "getProperties error:" + e.getMessage());
|
|
TLog.e(TAG, "getProperties error:" + e.getMessage());
|
|
|
}
|
|
}
|
|
@@ -463,12 +486,13 @@ public class ToolUI {
|
|
|
|
|
|
|
|
|
|
|
|
|
private void setProperties(CommonArg commonArg) throws IOException {
|
|
private void setProperties(CommonArg commonArg) throws IOException {
|
|
|
- props.setProperty("version", commonArg.version + "");
|
|
|
|
|
|
|
+ props.setProperty("version", String.valueOf(commonArg.version));
|
|
|
props.setProperty("enableH265", commonArg.enableH265? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
|
props.setProperty("enableH265", commonArg.enableH265? Boolean.TRUE.toString() : Boolean.FALSE.toString());
|
|
|
- props.setProperty("fps", commonArg.fps + "");
|
|
|
|
|
|
|
+ props.setProperty("fps", String.valueOf(commonArg.fps));
|
|
|
props.setProperty("inputPath", commonArg.inputPath == null ? "" : commonArg.inputPath);
|
|
props.setProperty("inputPath", commonArg.inputPath == null ? "" : commonArg.inputPath);
|
|
|
props.setProperty("audioPath", commonArg.audioPath == null ? "" : commonArg.audioPath);
|
|
props.setProperty("audioPath", commonArg.audioPath == null ? "" : commonArg.audioPath);
|
|
|
- props.setProperty("scale", commonArg.scale + "");
|
|
|
|
|
|
|
+ props.setProperty("scale", String.valueOf(commonArg.scale));
|
|
|
|
|
+ props.setProperty("bitrate", String.valueOf(commonArg.bitrate));
|
|
|
props.store(new OutputStreamWriter(new FileOutputStream(PROPERTIES_FILE), StandardCharsets.UTF_8), "");
|
|
props.store(new OutputStreamWriter(new FileOutputStream(PROPERTIES_FILE), StandardCharsets.UTF_8), "");
|
|
|
}
|
|
}
|
|
|
|
|
|