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;
13 import java.util.List;
15 import eu.svjatoslav.meviz.encoder.EncodingOptions;
17 public class AvconvVideo extends AbstractConverter {
20 public String getCommand(final File inputFile, final File targetFile,
21 final EncodingOptions options) {
26 switch (options.videoBitrate) {
43 throw new RuntimeException("Video bitrate: " + options.videoBitrate
44 + " is not supported.");
48 final StringBuffer codecParams = new StringBuffer();
50 String videoCodec = "libx264 ";
52 if (options.forPortablePlayer) {
55 videoCodec = "libxvid ";
56 codecParams.append("-s 640x480 ");
59 codecParams.append("-acodec libmp3lame -vcodec " + videoCodec);
61 codecParams.append("-b " + videoBitrate + "k ");
62 codecParams.append("-b:a " + audioBitrate + "k ");
64 if (options.deinterlace)
65 codecParams.append("-filter:v yadif ");
67 return "avconv -i \"" + inputFile.getAbsolutePath() + "\" "
68 + codecParams.toString() + "\"" + targetFile.getAbsolutePath()
73 public List<String> getSourceFileExtensions() {
74 return toList("mkv", "mts", "mp4", "avi", "mpg", "mpeg", "vob");
78 public List<String> getTargetFileExtensions() {
79 return toList("mkv", "mts", "mp4", "avi", "mpg", "mpeg", "vob");
83 public boolean isTerminalMandatory() {