possibility to use stream COPY
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 30 Nov 2013 22:00:10 +0000 (00:00 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Sat, 30 Nov 2013 22:00:10 +0000 (00:00 +0200)
src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java
src/main/java/eu/svjatoslav/meviz/encoder/converters/Mts2Mp4.java
src/main/java/eu/svjatoslav/meviz/grabmemcard/Main.java

index 3ab0fe1..168f2b4 100755 (executable)
@@ -20,7 +20,7 @@ public class BitrateParameter extends Parameter {
 
        @Override
        public String describeFormat() {
-               return "Target bitrate [LOW / MEDIUM / HIGH]";
+               return "Target bitrate [LOW / MEDIUM / HIGH / COPY]";
        }
 
        @Override
@@ -35,7 +35,7 @@ public class BitrateParameter extends Parameter {
        }
 
        static public enum bitrate {
-               LOW, MEDIUM, HIGH
+               LOW, MEDIUM, HIGH, COPY
        };
 
        public bitrate getValue() {
index 9ea8da7..9af415f 100755 (executable)
@@ -11,6 +11,7 @@ package eu.svjatoslav.meviz.encoder.converters;
 
 import java.io.File;
 
+import eu.svjatoslav.meviz.encoder.BitrateParameter;
 import eu.svjatoslav.meviz.encoder.EncodingOptions;
 
 public class Mts2Mp4 implements Converter {
@@ -19,8 +20,8 @@ public class Mts2Mp4 implements Converter {
        public String getCommand(final File inputFile, final File targetFile,
                        final EncodingOptions options) {
 
-               int videoBitrate;
-               int audioBitrate;
+               int videoBitrate = 0;
+               int audioBitrate = 0;
 
                switch (options.videoBitrate) {
                case LOW:
@@ -38,6 +39,9 @@ public class Mts2Mp4 implements Converter {
                        audioBitrate = 500;
                        break;
 
+               case COPY:
+                       break;
+
                default:
                        throw new RuntimeException("Video bitrate: " + options.videoBitrate
                                        + " is not supported.");
@@ -46,16 +50,19 @@ public class Mts2Mp4 implements Converter {
                // convert
                final StringBuffer codecParams = new StringBuffer();
 
-               codecParams.append("-acodec libmp3lame -vcodec libx264");
+               if (options.videoBitrate == BitrateParameter.bitrate.COPY) {
+                       // pass through
+                       codecParams.append("-acodec copy -vcodec copy");
 
-               codecParams.append(" -b " + videoBitrate + "k");
-               codecParams.append(" -b:a " + audioBitrate + "k");
+               } else {
+                       codecParams.append("-acodec libmp3lame -vcodec libx264");
+                       codecParams.append(" -b " + videoBitrate + "k");
+                       codecParams.append(" -b:a " + audioBitrate + "k");
+               }
 
-               if (options.deinterlace)
+               if (options.deinterlace) {
                        codecParams.append(" -filter:v yadif");
-
-               // pass through
-               // final String codecParams = "-acodec copy -vcodec copy";
+               }
 
                return "avconv -i \"" + inputFile.getAbsolutePath() + "\" "
                                + codecParams.toString() + " \"" + targetFile.getAbsolutePath()
index cb3406a..f078634 100755 (executable)
@@ -35,16 +35,18 @@ public class Main implements Module {
                                + "/AVCHD/BDMV/STREAM/";
                final File videosDirectory = new File(videosPath);
 
-               if (!videosDirectory.exists())
+               if (!videosDirectory.exists()) {
                        return new File[0];
+               }
 
                return videosDirectory.listFiles();
        }
 
        public String getDoubleDigit(final int value) {
                String valueString = Integer.toString(value);
-               if (valueString.length() == 1)
+               if (valueString.length() == 1) {
                        valueString = "0" + valueString;
+               }
                return valueString;
        };
 
@@ -90,7 +92,9 @@ public class Main implements Module {
 
                final String userName = System.getProperty("user.name");
 
-               final File file = new File("/media/" + userName + "/");
+               // final File file = new File("/media/" + userName + "/");
+
+               final File file = new File("/media/");
 
                for (final File insertedDisk : file.listFiles()) {
                        final File[] diskVideos = getDiskVideos(insertedDisk);