added ASF format
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / converters / AvconvVideo.java
index c63837a..6a43d26 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Meviz - Various tools collection to work with multimedia.
  * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
- * 
+ *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of version 2 of the GNU General Public License
  * as published by the Free Software Foundation.
@@ -30,8 +30,8 @@ public class AvconvVideo extends AbstractConverter {
                        break;
 
                case MEDIUM:
-                       videoBitrate = 3500;
-                       audioBitrate = 128;
+                       videoBitrate = 4000;
+                       audioBitrate = 192;
                        break;
 
                case HIGH:
@@ -47,27 +47,36 @@ public class AvconvVideo extends AbstractConverter {
                // convert
                final StringBuffer codecParams = new StringBuffer();
 
-               codecParams.append("-acodec libmp3lame -vcodec libx264");
+               String videoCodec = "libx264 ";
+
+               if (options.forPortablePlayer) {
+                       videoBitrate = 1000;
+                       audioBitrate = 128;
+                       videoCodec = "libxvid ";
+                       codecParams.append("-s 640x480 ");
+               }
+
+               codecParams.append("-acodec libmp3lame -vcodec " + videoCodec);
 
-               codecParams.append(" -b " + videoBitrate + "k");
-               codecParams.append(" -b:a " + audioBitrate + "k");
+               codecParams.append("-b " + videoBitrate + "k ");
+               codecParams.append("-b:a " + audioBitrate + "k ");
 
                if (options.deinterlace)
-                       codecParams.append(" -filter:v yadif");
+                       codecParams.append("-filter:v yadif ");
 
                return "avconv -i \"" + inputFile.getAbsolutePath() + "\" "
-                               + codecParams.toString() + " \"" + targetFile.getAbsolutePath()
+                               + codecParams.toString() + "\"" + targetFile.getAbsolutePath()
                                + "\"";
        }
 
        @Override
        public List<String> getSourceFileExtensions() {
-               return toList("mkv", "mts");
+               return toList("mkv", "mts", "mp4", "avi", "mpg", "mpeg", "vob");
        }
 
        @Override
        public List<String> getTargetFileExtensions() {
-               return toList("mp4");
+               return toList("mkv", "mts", "mp4", "avi", "mpg", "mpeg", "vob");
        }
 
        @Override