From 3e5c4ae5e9e2a67702e37124ed38cacdbd4fcdf1 Mon Sep 17 00:00:00 2001 From: Svjatoslav Agejenko Date: Fri, 25 Dec 2015 13:19:11 +0200 Subject: [PATCH] copy audio (do not encode) when copying from memory card --- .../eu/svjatoslav/meviz/grabmemcard/Main.java | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/main/java/eu/svjatoslav/meviz/grabmemcard/Main.java b/src/main/java/eu/svjatoslav/meviz/grabmemcard/Main.java index dac58fd..920a95c 100755 --- a/src/main/java/eu/svjatoslav/meviz/grabmemcard/Main.java +++ b/src/main/java/eu/svjatoslav/meviz/grabmemcard/Main.java @@ -98,14 +98,7 @@ public class Main implements Module { for (final File sourceFile : diskVideos) { - // compute target file path - final StringBuffer targetFilePath = new StringBuffer(); - targetFilePath.append(targetDirectory.getAbsolutePath()); - targetFilePath.append("/"); - targetFilePath.append(FilePathParser - .getFileNameWithoutExtension(sourceFile)); - targetFilePath.append(".mp4"); - final File targetFile = new File(targetFilePath.toString()); + final File targetFile = getTargetFile(targetDirectory, sourceFile); final EncodingTask encodingTask = new EncodingTask(sourceFile, targetFile, converter, "mp4"); @@ -113,10 +106,26 @@ public class Main implements Module { } } + encodingPlan.execute(getEncodingOptions()); + } + + private EncodingOptions getEncodingOptions() { final EncodingOptions options = new EncodingOptions(); options.setVideoBitrate(BitrateParameter.bitrate.COPY); + options.setAudioBitrate(BitrateParameter.bitrate.COPY); + return options; + } - encodingPlan.execute(options); + private File getTargetFile(final File targetDirectory, final File sourceFile) { + // compute target file path + final StringBuffer targetFilePath = new StringBuffer(); + targetFilePath.append(targetDirectory.getAbsolutePath()); + targetFilePath.append("/"); + targetFilePath.append(FilePathParser + .getFileNameWithoutExtension(sourceFile)); + targetFilePath.append(".mp4"); + final File targetFile = new File(targetFilePath.toString()); + return targetFile; } @Override -- 2.20.1