I want to convert webm to mp4. I have implemeted this Code but I don't know what's wrong I hope someone can help me with this.
Here my Code how I have already tried to do it:
private String ffmpegApp; public FLVConverter(String ffmpegApp) { this.ffmpegApp = ffmpegApp;
} public void convert(String filenameIn, String filenameOut, int width, int height) throws IOException, InterruptedException { convert(filenameIn, filenameOut, width, height, -1);
} public int convert(String filenameIn, String filenameOut, int width, int height, int quality) throws IOException, InterruptedException { ProcessBuilder processBuilder; if (quality > -1) { processBuilder = new ProcessBuilder(ffmpegApp, "-i", filenameIn, "-ar", "44100", "-s", width + "*" + height, "-qscale", quality + "", filenameOut); } else { processBuilder = new ProcessBuilder(ffmpegApp, "-i", filenameIn, "-ar", "44100", "-s", width + "*" + height, filenameOut); } Process process = processBuilder.start(); InputStream stderr = process.getErrorStream(); InputStreamReader isr = new InputStreamReader(stderr); BufferedReader br = new BufferedReader(isr); String line; while ((line = br.readLine()) != null) ; { } return process.waitFor();
} public static void main(String[] args) throws Exception { FLVConverter FLVConverter = new FLVConverter("C:\\Users\\Casper\\Desktop\\ffmpeg\\bin\\ffmpeg.exe"); FLVConverter.convert("C:\\Users\\Casper\\Desktop\\videoplayback.webm", "C:\\Users\\Casper\\Desktop\\a.mp4", 300, 200, 5);
}
}