possibility to remove audio from video
authorSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 24 Dec 2014 20:17:50 +0000 (22:17 +0200)
committerSvjatoslav Agejenko <svjatoslav@svjatoslav.eu>
Wed, 24 Dec 2014 20:17:50 +0000 (22:17 +0200)
src/main/java/eu/svjatoslav/meviz/encoder/BitrateParameter.java
src/main/java/eu/svjatoslav/meviz/encoder/converters/AvconvVideo.java

index 18c3a2c..ec88b61 100755 (executable)
@@ -15,7 +15,7 @@ import eu.svjatoslav.commons.commandline.parameterparser.Parameter;
 public class BitrateParameter extends Parameter<BitrateParameter> {
 
        static public enum bitrate {
-               LOW, MEDIUM, HIGH, COPY
+               NONE, LOW, MEDIUM, HIGH, COPY
        }
 
        public BitrateParameter(final String description) {
@@ -24,7 +24,7 @@ public class BitrateParameter extends Parameter<BitrateParameter> {
 
        @Override
        public String describeFormat() {
-               return "Target bitrate [LOW / MEDIUM / HIGH / COPY]";
+               return "Target bitrate [NONE / LOW / MEDIUM / HIGH / COPY ]";
        };
 
        @Override
index 87a7880..f0d80bf 100644 (file)
@@ -23,8 +23,12 @@ public class AvconvVideo extends AbstractConverter {
                        final StringBuffer codecParams, final String videoCodec,
                        final String audioCodec) {
 
-               codecParams.append("-acodec " + audioCodec + " -vcodec " + videoCodec
-                               + " ");
+               if (audioCodec == null)
+                       codecParams.append("-an ");
+               else
+                       codecParams.append("-acodec " + audioCodec + " ");
+
+               codecParams.append("-vcodec " + videoCodec + " ");
 
                if (videoBitrate != -1)
                        codecParams.append("-b " + videoBitrate + "k ");
@@ -50,6 +54,9 @@ public class AvconvVideo extends AbstractConverter {
                case COPY:
                        return -1;
 
+               case NONE:
+                       return -1;
+
                default:
                        throw new RuntimeException("Audio bitrate: " + bitRate
                                        + " is not supported.");
@@ -75,6 +82,9 @@ public class AvconvVideo extends AbstractConverter {
                if (options.getAudioBitrate() == bitrate.COPY)
                        audioCodec = "copy";
 
+               if (options.getAudioBitrate() == bitrate.NONE)
+                       audioCodec = null;
+
                if (options.forPortablePlayer) {
                        videoBitrate = 1000;
                        audioBitrate = 128;