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()