2 * Meviz - Various tools collection to work with multimedia.
3 * Copyright (C) 2012, Svjatoslav Agejenko, svjatoslav@svjatoslav.eu
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of version 2 of the GNU General Public License
7 * as published by the Free Software Foundation.
10 package eu.svjatoslav.meviz.encoder.converters;
14 import eu.svjatoslav.meviz.encoder.BitrateParameter;
15 import eu.svjatoslav.meviz.encoder.EncodingOptions;
17 public class Mts2Mp4 implements Converter {
20 public String getCommand(final File inputFile, final File targetFile,
21 final EncodingOptions options) {
26 switch (options.videoBitrate) {
46 throw new RuntimeException("Video bitrate: " + options.videoBitrate
47 + " is not supported.");
51 final StringBuffer codecParams = new StringBuffer();
53 if (options.videoBitrate == BitrateParameter.bitrate.COPY) {
55 codecParams.append("-acodec copy -vcodec copy");
58 codecParams.append("-acodec libmp3lame -vcodec libx264");
59 codecParams.append(" -b " + videoBitrate + "k");
60 codecParams.append(" -b:a " + audioBitrate + "k");
63 if (options.deinterlace) {
64 codecParams.append(" -filter:v yadif");
67 return "avconv -i \"" + inputFile.getAbsolutePath() + "\" "
68 + codecParams.toString() + " \"" + targetFile.getAbsolutePath()
73 public String getSourceFileExtension() {
78 public String getTargetFileExtension() {
83 public boolean isTerminalMandatory() {