Refactored to remove code duplication.
[meviz.git] / src / main / java / eu / svjatoslav / meviz / encoder / converters / Ffmpeg2theora.java
diff --git a/src/main/java/eu/svjatoslav/meviz/encoder/converters/Ffmpeg2theora.java b/src/main/java/eu/svjatoslav/meviz/encoder/converters/Ffmpeg2theora.java
new file mode 100755 (executable)
index 0000000..4df8c32
--- /dev/null
@@ -0,0 +1,42 @@
+/*
+ * 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.
+ */
+
+package eu.svjatoslav.meviz.encoder.converters;
+
+import java.io.File;
+import java.util.List;
+
+import eu.svjatoslav.meviz.encoder.EncodingOptions;
+
+public class Ffmpeg2theora extends AbstractConverter {
+
+       @Override
+       public String getCommand(final File inputFile, final File targetFile,
+                       final EncodingOptions options) {
+               return "ffmpeg2theora \"" + inputFile.getAbsolutePath() + "\" -o \""
+                               + targetFile.getAbsolutePath()
+                               + "\" --optimize --videobitrate 3000 --width 800";
+       }
+
+       @Override
+       public List<String> getSourceFileExtensions() {
+               return toList("avi", "mp4");
+       }
+
+       @Override
+       public List<String> getTargetFileExtensions() {
+               return toList("ogv");
+       }
+
+       @Override
+       public boolean isTerminalMandatory() {
+               return true;
+       }
+
+}