import eu.svjatoslav.meviz.encoder.EncodingPlan;
import eu.svjatoslav.meviz.encoder.EncodingTask;
import eu.svjatoslav.meviz.encoder.converters.AbstractConverter;
-import eu.svjatoslav.meviz.encoder.converters.Ffmpeg;
+import eu.svjatoslav.meviz.encoder.converters.AvconvVideo;
public class Main implements Module {
final File targetDirectory = getTargetDirectory();
targetDirectory.mkdirs();
- final AbstractConverter converter = new Ffmpeg();
+ final AbstractConverter converter = new AvconvVideo();
final EncodingPlan encodingPlan = new EncodingPlan();
final String userName = System.getProperty("user.name");
for (final File sourceFile : diskVideos) {
- // compute target file path
- final StringBuffer targetFilePath = new StringBuffer();
- targetFilePath.append(targetDirectory.getAbsolutePath());
- targetFilePath.append("/");
- targetFilePath.append(FilePathParser
- .getFileNameWithoutExtension(sourceFile));
- targetFilePath.append(".mp4");
- final File targetFile = new File(targetFilePath.toString());
+ final File targetFile = getTargetFile(targetDirectory, sourceFile);
final EncodingTask encodingTask = new EncodingTask(sourceFile,
- targetFile, converter);
+ targetFile, converter, "mp4");
encodingPlan.scheduleTask(encodingTask);
}
}
+ encodingPlan.execute(getEncodingOptions());
+ }
+
+ private EncodingOptions getEncodingOptions() {
final EncodingOptions options = new EncodingOptions();
options.setVideoBitrate(BitrateParameter.bitrate.COPY);
+ options.setAudioBitrate(BitrateParameter.bitrate.COPY);
+ return options;
+ }
- encodingPlan.execute(options);
+ private File getTargetFile(final File targetDirectory, final File sourceFile) {
+ // compute target file path
+ final StringBuffer targetFilePath = new StringBuffer();
+ targetFilePath.append(targetDirectory.getAbsolutePath());
+ targetFilePath.append("/");
+ targetFilePath.append(FilePathParser
+ .getFileNameWithoutExtension(sourceFile));
+ targetFilePath.append(".mp4");
+ final File targetFile = new File(targetFilePath.toString());
+ return targetFile;
}
@Override