@Override
public String describeFormat() {
- return "Target bitrate [LOW / MEDIUM / HIGH]";
+ return "Target bitrate [LOW / MEDIUM / HIGH / COPY]";
}
@Override
}
static public enum bitrate {
- LOW, MEDIUM, HIGH
+ LOW, MEDIUM, HIGH, COPY
};
public bitrate getValue() {
import java.io.File;
+import eu.svjatoslav.meviz.encoder.BitrateParameter;
import eu.svjatoslav.meviz.encoder.EncodingOptions;
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:
audioBitrate = 500;
break;
+ case COPY:
+ break;
+
default:
throw new RuntimeException("Video bitrate: " + options.videoBitrate
+ " is not supported.");
// 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()
+ "/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;
};
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);