NullParameter recursiveParameter = parser.createNullParameter(
"Enable recursive mode.").addAliases("-r", "--recursive");
+ NullParameter forPortableParameter = parser.createNullParameter(
+ "Encode for portable player.").addAliases("-p", "--portable");
+
StringParameter inputPatternParameter = parser
.createStringParameter("File input pattern.")
.addAliases("-i", "--input-pattern").setMandatory();
parser.parse(args);
- if (recursiveParameter.isParameterSpecified())
- options.recursive = true;
+ options.recursive = recursiveParameter.isParameterSpecified();
- if (deinterlaceParameter.isParameterSpecified())
- options.deinterlace = true;
+ options.deinterlace = deinterlaceParameter.isParameterSpecified();
- if (testParameter.isParameterSpecified())
- options.testOnly = true;
+ options.testOnly = testParameter.isParameterSpecified();
if (outputFormatParameter.isParameterSpecified())
options.outputFormats.addAll(outputFormatParameter
options.inputPatterns.addAll(inputPatternParameter
.getArgumentsAsStrings());
+ options.forPortablePlayer = forPortableParameter.isParameterSpecified();
+
if (videoBitrateParameter.isParameterSpecified())
try {
options.videoBitrate = videoBitrateParameter.getValue();
public boolean testOnly;
+ public boolean forPortablePlayer = false;
+
public File workingDirectory = new File(System.getProperty("user.dir"));
List<String> outputFormats = new ArrayList<String>();
import java.util.ArrayList;
import java.util.List;
-import eu.svjatoslav.meviz.encoder.converters.Ffmpeg2theora;
import eu.svjatoslav.meviz.encoder.converters.AbstractConverter;
-import eu.svjatoslav.meviz.encoder.converters.AvconvVideo;
-import eu.svjatoslav.meviz.encoder.converters.Ffmpeg;
import eu.svjatoslav.meviz.encoder.converters.AvconvAudio;
-import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav;
+import eu.svjatoslav.meviz.encoder.converters.AvconvVideo;
import eu.svjatoslav.meviz.encoder.converters.Convert;
+import eu.svjatoslav.meviz.encoder.converters.Ffmpeg;
+import eu.svjatoslav.meviz.encoder.converters.Ffmpeg2theora;
import eu.svjatoslav.meviz.encoder.converters.Flac;
+import eu.svjatoslav.meviz.encoder.converters.Ogg2Wav;
public class FormatsRegistry {
// convert
final StringBuffer codecParams = new StringBuffer();
- codecParams.append("-acodec libmp3lame -vcodec libx264");
+ String videoCodec = "libx264 ";
- codecParams.append(" -b " + videoBitrate + "k");
- codecParams.append(" -b:a " + audioBitrate + "k");
+ 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 ");
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");
}
@Override
public List<String> getTargetFileExtensions() {
- return toList("mp4");
+ return toList("mkv", "mts", "mp4", "avi");
}
@Override