OSDN Git Service

自動リサイズ
authoryukihane <yukihane.feather@gmail.com>
Tue, 2 Aug 2011 07:17:29 +0000 (16:17 +0900)
committeryukihane <yukihane.feather@gmail.com>
Tue, 2 Aug 2011 07:17:29 +0000 (16:17 +0900)
frontend/bin/MediaInfo.dll [new file with mode: 0644]
frontend/bin/MediaInfo.exe [new file with mode: 0644]
frontend/src/saccubus/MainFrame.java
frontend/src/saccubus/converter/FfmpegCommand.java
frontend/src/saccubus/properties/MovieSetting.java

diff --git a/frontend/bin/MediaInfo.dll b/frontend/bin/MediaInfo.dll
new file mode 100644 (file)
index 0000000..83ff821
Binary files /dev/null and b/frontend/bin/MediaInfo.dll differ
diff --git a/frontend/bin/MediaInfo.exe b/frontend/bin/MediaInfo.exe
new file mode 100644 (file)
index 0000000..6e48fcf
Binary files /dev/null and b/frontend/bin/MediaInfo.exe differ
index 3b4af1c..41f590a 100644 (file)
@@ -846,7 +846,7 @@ public class MainFrame extends JFrame {
     private JTextField outputOptionField = new JTextField();
     private final JLabel avfilterOptionLabel = new JLabel();
     private final JTextField avfilterOptionField = new JTextField();
-    private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるようリサイズ");
+    private final JCheckBox resizeCheckBox = new JCheckBox("次のサイズに収まるよう縮小(-s)");
     private final JLabel resizeWidthLabel = new JLabel("横");
     private final JTextField resizeWidthField = new NumberFormattedTextField();
     private final JLabel resizeHeightLabel = new JLabel("縦");
index b5542ea..6b47594 100644 (file)
@@ -17,6 +17,9 @@ import saccubus.converter.profile.FfmpegOption;
 import saccubus.converter.profile.GeneralSetting;
 import saccubus.converter.profile.NgSetting;
 import saccubus.net.TextProgressListener;
+import yukihane.mediainfowrapper.Info;
+import yukihane.mediainfowrapper.MediaInfo;
+import yukihane.mediainfowrapper.Size;
 import yukihane.swf.Cws2Fws;
 
 /**
@@ -132,6 +135,14 @@ public class FfmpegCommand extends AbstractCommand {
             }
         }
 
+        if (ov.isResize()) {
+            final Info info = MediaInfo.getInfo(new File("bin", "MediaInfo"), videoFile);
+            final Size scaled = (ov.isAdjustRatio()) ? MediaInfo.adjustSize(info, ov.getResizeWidth(), ov.
+                    getResizeHeight()) : new Size(info.getWidth(), info.getHeight());
+            cmdList.add("-s");
+            cmdList.add(scaled.getWidth() + "x" + scaled.getHeight());
+        }
+
         List<String> avfilterArgs = getAvfilterOptions(ov, addComment, commPath, addTcomment, tcommPath);
 
         if (!avfilterArgs.isEmpty()) {
index e58bd36..5a84c9a 100644 (file)
@@ -23,7 +23,7 @@ public class MovieSetting {
     private static final String PROP_RESIZE_WIDTH = "CMD_RESIZE_WIDTH";
     private static final String PROP_RESIZE_HEIGHT = "CMD_RESIZE_HEIGHT";
     private static final String PROP_ADJUST_RATIO = "CMD_ADJUST_RATIO";
-    private static final String PROP_PADDING ="CMD_PADDING";
+    private static final String PROP_PADDING = "CMD_PADDING";
     private final File ffmpeg;
     private final File vhook;
     private final File optionFile;
@@ -87,10 +87,10 @@ public class MovieSetting {
         String out = prop.getProperty(PROP_CMDLINE_OUT,
                 "-f ipod -g 150 -qcomp 0.7 -qmin 20 -qmax 30 -qdiff 4 -subq 6 -me_range 16 -i_qfactor 0.714286");
         String avfilter = prop.getProperty(PROP_CMDLINE_AVFILTER, "");
-        boolean resize = Boolean.getBoolean(prop.getProperty(PROP_RESIZE,"false"));
+        boolean resize = Boolean.getBoolean(prop.getProperty(PROP_RESIZE, "false"));
         String width = prop.getProperty(PROP_RESIZE_WIDTH, "512");
         String height = prop.getProperty(PROP_RESIZE_HEIGHT, "384");
-        boolean adjust = Boolean.getBoolean(prop.getProperty(PROP_ADJUST_RATIO,"false"));
+        boolean adjust = Boolean.getBoolean(prop.getProperty(PROP_ADJUST_RATIO, "false"));
         boolean pad = Boolean.getBoolean(prop.getProperty(PROP_PADDING, "false"));
         FfmpegOption opt = new FfmpegOption(ext, main, in, out, avfilter, resize, width, height, adjust, pad);